scribe.txt
snippets · 5.3 KB · 2010-03-30
Scribe fix: lets PCs scribe up to 3 spells on one scroll.
Download « Back to the snippets list
This is just a 'fix' that allows PCs to scribe up to 3 spells on a single
scroll. Simply replace the old do_scribe function, with this one, and then
recompile.
----------------------------Begin Code-----------------------------------
/* Re-worked by Sadiq to allow PCs to scribe up to 3 spells on a single *
* scroll. Second and third spells progressive increase the chance of *
* destroying the scroll. --Sadiq */
void do_scribe( CHAR_DATA *ch, char *argument )
{
OBJ_DATA *scroll;
int sn;
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
char buf3[MAX_STRING_LENGTH];
int mana;
if ( IS_NPC(ch) )
return;
if ( !IS_NPC(ch)
&& ch->level < skill_table[gsn_scribe]->skill_level[ch->class] )
{
send_to_char( "A skill such as this requires more magical ability than that of your class.\n\r", ch );
return;
}
if ( argument[0] == '\0' || !str_cmp(argument, "") )
{
send_to_char( "Scribe what?\n\r", ch );
return;
}
if ( ms_find_obj(ch) )
return;
if ( (sn = find_spell( ch, argument, TRUE )) < 0 )
{
send_to_char( "You have not learned that spell.\n\r", ch );
return;
}
if ( skill_table[sn]->spell_fun == spell_null )
{
send_to_char( "That's not a spell!\n\r", ch );
return;
}
if ( SPELL_FLAG(skill_table[sn], SF_NOSCRIBE) )
{
send_to_char( "You cannot scribe that spell.\n\r", ch );
return;
}
mana = IS_NPC(ch) ? 0 : UMAX(skill_table[sn]->min_mana,
100 / ( 2 + ch->level - skill_table[sn]->skill_level[ch->class] ) );
mana *=5;
if ( !IS_NPC(ch) && ch->mana < mana )
{
send_to_char( "You don't have enough mana.\n\r", ch );
return;
}
if ( ( scroll = get_eq_char( ch, WEAR_HOLD ) ) == NULL )
{
send_to_char( "You must be holding a blank scroll to scribe it.\n\r", ch );
return;
}
if( scroll->pIndexData->vnum != OBJ_VNUM_SCROLL_SCRIBING )
{
send_to_char( "You must be holding a blank scroll to scribe it.\n\r", ch );
return;
}
if ( ( scroll->value[1] != -1 ) && ( scroll->value[2] != -1)
&& ( scroll->value[3] != -1)
&& ( scroll->pIndexData->vnum == OBJ_VNUM_SCROLL_SCRIBING ) )
{
send_to_char( "That scroll has already contains as much magic as it can hold.\n\r", ch);
return;
}
if ( !process_spell_components( ch, sn ) )
{
learn_from_failure( ch, gsn_scribe );
ch->mana -= (mana / 2);
return;
}
if ( !IS_NPC(ch) && number_percent( ) > ch->pcdata->learned[gsn_scribe] )
{
set_char_color ( AT_MAGIC, ch );
send_to_char("The magic surges outof control and destroys the scroll!.\n\r", ch);
learn_from_failure( ch, gsn_scribe );
ch->mana -= (mana / 2);
extract_obj(scroll);
return;
}
if ( scroll->value[1] == -1 )
{
scroll->value[1] = sn;
scroll->value[0] = ch->level;
sprintf(buf1, "magically scribed scroll" );
STRFREE(scroll->short_descr);
scroll->short_descr = STRALLOC( aoran(buf1) );
sprintf(buf2, "A magically scribed scroll lies in the dust." );
STRFREE(scroll->description);
scroll->description = STRALLOC(buf2);
sprintf(buf3, "scroll scribing %s", skill_table[sn]->name);
STRFREE(scroll->name);
scroll->name = STRALLOC(buf3);
act( AT_MAGIC, "$n magically scribes a scroll.", ch, NULL, NULL, TO_ROOM );
act( AT_MAGIC, "You magically scribe $p.", ch, NULL, NULL, TO_CHAR );
learn_from_success( ch, gsn_scribe );
ch->mana -= mana;
return;
}
if ( scroll->value[2] == -1 )
{
if ( number_percent( ) > 50 )
{
set_char_color ( AT_MAGIC, ch );
send_to_char("The magic surges out of control and destroys the scroll!.\n\r", ch);
learn_from_failure( ch, gsn_scribe );
ch->mana -= (mana / 2);
extract_obj(scroll);
return;
}
if (scroll->value[0] > ch->level )
{
scroll->value[0] = ch->level;
}
scroll->value[2] = sn;
set_char_color(AT_MAGIC, ch);
ch_printf( ch, "You imbue the scroll with %s.\n\r", skill_table[sn]->name);
learn_from_success(ch, gsn_scribe);
ch->mana -= mana;
return;
}
if ( scroll->value[3] == -1 )
{
if ( number_percent( ) > 30 )
{
set_char_color ( AT_MAGIC, ch );
send_to_char("The magic surges outof control and destroys the scroll!.\n\r", ch);
learn_from_failure( ch, gsn_scribe );
ch->mana -= (mana / 2);
extract_obj(scroll);
return;
}
if (scroll->value[0] > ch->level )
{
scroll->value[0] = ch->level;
}
scroll->value[3] = sn;
set_char_color(AT_MAGIC, ch);
ch_printf( ch, "You imbue the scroll with %s.\n\r", skill_table[sn]->name);
learn_from_success(ch, gsn_scribe);
ch->mana -= mana;
return;
}
}
-------------------------End Code------------------------------------------