Re: [CODE] spells

From: Alvoria MUD (mudguy@conan.ids.net)
Date: 01/03/97


On Fri, 3 Jan 1997, Ghost Shaidan wrote:
> I am attempting to write a spell that will heal you a few points every
> combat round.  I have added quite a few spells and skills, and thought i
  ^^^^^^^^^^^^
Just a note... all the others who replied thus far missed that... But
in observation... this could be a really powerful spell. One MUD hour
is about... 2 mins... PULSE_VIOLENCE is 2 seconds... so putting a check
here can result in the gain of 60 * (amount healed). Very very powerful...
practically the same as SPELL_HEAL if you heal back 2 hp.

> knew my way around, but this spell (HEALING_MYST) doesnt have any affects,
> I just want it to be there (I tried to ahve it set an AFF_FLAG it still
> didnt work) and have a duration, so that a check in fight.c (still playing
> with exactly where, but Ill fix this first) will see that they are
> affected_by_spell(ch, SEPLL_HEALING_MYST) and heal them some.. here is my
> case statement from magic.c
> (code snipped, nothing to change...)
Okie, well, the best place imho to put it in is perform_violence() which
is at the end of fight.c. Here is the last few lines of that function.

    hit(ch, FIGHTING(ch), TYPE_UNDEFINED);
    if (MOB_FLAGGED(ch, MOB_SPEC) && mob_index[GET_MOB_RNUM(ch)].func != NULL)
      (mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, "");
  }
}

Now, the place you probably would want to put a check for SPELL_HEALING_MYST
is right after the hit() call... you could do something like...


    hit(ch, FIGHTING(ch), TYPE_UNDEFINED);

    if(affected_by_spell(ch, SPELL_HEALING_MYST)&&
       AWAKE(ch)) /* This is a sanity check in case you ever add something
                     in hit() that could cause a victim to hit you back or
                     something */
      {
        if(GET_HIT(ch)<GET_MAX_HIT(ch))
          {
            act("Your healing mist heals you!", FALSE, ch, 0, 0, TO_CHAR);
              /* other act() statements if wanted here */
            GET_HIT(ch)+=1; /* This value u'd change to alter how much to
                               heal back */
            GET_HIT(ch)=MIN(GET_HIT(ch),GET_MAX_HIT(ch));
          }
      }

    if (MOB_FLAGGED(ch, MOB_SPEC) && mob_index[GET_MOB_RNUM(ch)].func != NULL)
      (mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, "");
  }
}

> I have it defined in spells.h, wear off message in constants.c, and a
> sanct like message in act.information.c (using affected_by_spell instead
> of IS_AFFECTED this time through wihtout the bitvector)
> after this week, i am sure it is something very simple that i am missing,
> any help would be apprciated.
Well, you mentioned that you were looking for where in fight.c to put
a check... that's all that you were missing, actually.

Alvoria MUD -- ""
  Address   -- telnet://conan.ids.net:4000/
  Homepage  -- http://users.ids.net/~mudguy/
  Host Site -- http://www.ids.net/


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



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