Re: Spell Components

From: Edward Glamkowski (EGlamkowski@MATHEMATICA-MPR.COM)
Date: 08/26/97


I had tinkered with mag_materials at one point and came up
with the following solution:

        Create a new function which will check for the
material components, which is just one big switch statement
of all spells that need material components, with each case
being the relevent call to mag_materials().
        Then, in do_cast(), right before it calls the function
that actually executes the spell (call_magic()?  I forget
the name, but the call to it is right at the end of
do_cast()), call this new function.  If it succeeds, the
spell is cast, otherwise nada.

something like:
int has_components(int spellnum, struct char_data *ch) {
        int x;
        struct obj_data obj1, obj2, obj3; /* You will need to
                set these - I don't remember exactly how I did
                it off the top of my head ;)  */
        switch(spellnum) {
                case SPELL_ARMOR:
                        x = mag_materials(ch, 1, 2, 3, TRUE);
                        break;
                etc.
                default:
                /* Spell needs no components - return success */
                        x = 1;
                        break;
        }
        return x;
}

Then in do_cast you would add at the end,
        if (has_components(spellnum, ch) {
                cast_spell(); /* Or whatever the func name is */
        } else {
                /* Some sort of message */
        }


Edward Glamkowski, Programmer           Mathematica Policy Research
EGlamkowski@mathematic-MPR.COM          Princeton, NJ
                http://www.mathematica-mpr.com/

        In the chapel at Biggin Hill there is a golden book in a glass case.
Every day for the past twenty-five years a page has been turned.  On
each page one can read the names and ranks of those who took off on
that day  and never returned.  Sometimes the page is filled to the last
line.
        They are all Dowding's boys.

        The Battle of Britain  by Marcel Jullian


>----------
>From:  George[SMTP:greerga@DRAGON.HAM.MUOHIO.EDU]
>Sent:  Monday, August 25, 1997 10:59 PM
>To:    CIRCLE@post.queensu.ca
>Subject:       Re:  Spell Components
>
>On Mon, 25 Aug 1997, Uffe Svanstrom wrote:
>
>>>if (mag_materials(ch, 1, 3000, 3022, TRUE, TRUE))
>>>  <cast spell>
>>
>>That Easy ???
>
>I don't know, never needed it.  Go try it and tell us if it works.
>
>--
>greerga@muohio.edu me@null.net | Genius may have its limitations, but
>stupidity
>http://www.muohio.edu/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST