/*Double Cast Snippet by Hunter Zero of Nivaeh Genesis*/
/* July 2002*/
/*Purpose: to allow spellcasters to cast two spells, one right after the other, with little or no
			delay, and occainsionly tacking another spell on the end*/

/*All changes are in magic.c*/

/*Before do_cast*/
/*In the globabls section, under the target variable*/

char *spell_one;
char *spell_two;
char *target_grep;
bool dcast1 = FALSE;
bool dcast2 = FALSE;
int new_delay;
int old_delay;


/*Function: do_cast*/

replace :

		target_name = one_argument (argument, arg1);
        one_argument (target_name, arg2);

with:


	 if (dcast1 == TRUE)
                {
                act ("{Y$N {cdraws back to cast two spells!{x", ch, NULL, NULL, TO_ROOM);
                ch->mana = ch->mana - 50;
                one_argument(argument, arg1);
                one_argument(target_name, arg2);
                }
        else if (dcast2 == TRUE)
                {
                one_argument(argument, arg1);
                one_argument(target_name, arg2);
                }
        else
                {
                target_name = one_argument (argument, arg1);
                one_argument (target_name, arg2);
                }


/*End Function do_cast*/

/*interp.h*/
/*with the do_function delcarions*/

DECLARE_DO_FUN( do_double_cast );

/*interp.c*/
/*In the command table, near the cast command*/

{ "doublecast", do_double_cast, POS_STANDING,0, LOG_NORMAL, 1 }

/*End interp.c*/

/*Function : do_double_cast */

void do_double_cast(CHAR_DATA* ch, char* argument)
{
        char arg1[MAX_STRING_LENGTH];
        char arg2[MAX_STRING_LENGTH];
        int sn;
		char buf[MSL];

        /*Lets find our targets*/
        spell_two = one_argument (argument, arg1);
        target_name = one_argument (argument, arg1);
        one_argument( target_name, arg2);
        target_grep = one_argument( target_name, arg2);

        spell_one = arg1;
        spell_two = arg2;
        target_name = target_grep;

        /*First Spell*/

        dcast1 = TRUE;

        if ((sn = find_spell (ch, spell_one)) < 1 || skill_table[sn].spell_fun == spell_null
           || (!IS_NPC (ch) && (ch->level < skill_table[sn].skill_level[ch->class]
           || ch->pcdata->learned[sn] == 0)))
                {
                send_to_char ("You don't know any spells of that name.\n\r", ch);
                return;
                }

        new_delay = 0;
        old_delay = skill_table[sn].beats;
        skill_table[sn].beats = new_delay;

        do_cast( ch, spell_one);
        skill_table[sn].beats = old_delay;

        /*Switching the spell that went through*/
        dcast1 = FALSE;
        dcast2 = TRUE;

        /*Second Spell*/

        if ((sn = find_spell (ch, arg1)) < 1 || skill_table[sn].spell_fun == spell_null
        || (!IS_NPC (ch) && (ch->level < skill_table[sn].skill_level[ch->class]
        || ch->pcdata->learned[sn] == 0)))
                {
                send_to_char ("You don't know any spells of that name.\n\r", ch);
                return;
                }

        old_delay = skill_table[sn].beats;
	    skill_table[sn].beats = new_delay;

        do_cast( ch, spell_two);
        skill_table[sn].beats = old_delay;

        return;
}