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);
                /* Spell needs no components - return success */
                        x = 1;
        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

        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
        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
>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.
> | Genius may have its limitations, but
> | is not thus handicapped. -- Elbert Hubbard

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

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