Re: Multiple Hit Spells

From: Fizal (amustapa@yahoo.com)
Date: 05/04/00


At 08:39 AM 1/5/2000 Malaysia, Shawn Kimbley wrote:
>I've browsed through the archives and was unable to find anything related to
>this.  I'd like to try and add a spell with multiple hit capabilities.  Does
>anyone have and tips or experience in this matter?

Was helping someone with spells about half a year or so ago and wrote
something that like what you're looking for:

1. Define the spell in spells.h:
#define SPELL_WARP LIGHTNING            /* A special spell with internal looping */

2. Add the switch inside mag_damage() in magic.c:
+ /*
+  * Warp Lightning is a special spell. Due to this spell, the end of this
+  * function needs to be changed slightly. The effect of this spell is
+  * based on Lightning Bolt, but can't use mag_areas() as it's target is
+  * still a single person.
+  */
+ case SPELL_WARP_LIGHTNING:
+   int counter;
+
+   /* Note: if dam < 0 then the victim has dies. Stop the loop */
+   for (counter = 0; counter <= (level - 20) / 4 + 1 && dam >= 0; counter++)
+     dam = mag_damage(level, ch, victim, SPELL_LIGHTNING_BOLT, SAVING_SPELL);
+   inflict = FALSE;
+   break;
+

3. Change the mag_damage() slightly to accomodate this spells.

** At the beginning of the function
! int dam, inflict = TRUE;

....

** This is the end of the function.

+ if (inflict) {
!   /* divide damage by two if victim makes his saving throw */
!   if (mag_savingthrow(victim, savetype, 0))
!     dam /= 2;
!
!   /* and finally, inflict the damage */
!   return (damage(ch, victim, dam, spellnum));
+ } else
+   return (dam)

4. Then, add the definition for the spell under spello() in spell_parser.c.
Change the mana requirements as you see fit:

+ spello(SPELL_WARP_LIGHTNING, "warp lightning", 120, 80, 5, POS_FIGHTING,
+       TAR_CHAR_ROOM | TAR_FIGHT_VICT, TRUE, MAG_DAMAGE);

5. Set the spell to the appropriate class and level in init_spell_level() in
class.c

6. Specify the spell_wear_off_msg[] in constants.c, which is basically
nothing
actually. Lastly, write out the message that should be seen when casting
the spells. But since the spell is using Lightning Bolt, you don't have to
do anything.

*** Note: Please backup your work before adding this in. This is from my
old archive of possibilities. Doesn't necessarily mean that it has no bugs,
or really work for that matter. A quick glance said it should work. Then
again.... *shrug*

G'luck!

---

Afizal Mustapa
Petaling Jaya, Selangor, Malaysia.
(amustapa@hotmail.com)

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com


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



This archive was generated by hypermail 2b30 : 04/10/01 PDT