Mirror Image Spell

From: Itay Chumash (itay_c@HOTMAIL.COM)
Date: 08/21/01


After looking everywhere for this spell and not finding an existing example
, i've decided to write one it only uses the affects flag and as such
it leaves no corpses and there is no need to put an unsigned byte in the struct char_data!
it also doesn't change any of the pfiles.

I take no responsibility for this spell, i made it just for fun, i suggest you backup
your code before using it just in case it doesn't work!

i used it on circlemud 3.0 bpl17, so if in newer versions you have spells defined
elsewhere it is not my problem.

in short have fun, hope you find it useful, but use at your own risk!

STEP 1
-------------------------------------------------------------------

in the file: class.c
--------------------

where all the other spells are set:

spell_level(SPELL_MIRROR_IMAGE, CLASS_MAGIC_USER, 20); /* Mirror Image Spell */


STEP 2
-------------------------------------------------------------------

in the file: magic.c
--------------------

inside the function: mag_affects, inside the first switch - "switch (spellnum) {"

please notice it's also possible to add an affect on APPLY_AC in this existing
structure, so other than mirror image the char will gain or lose AC.
-------------------------------------------------------------------

case SPELL_MIRROR_IMAGE:
    af[0].duration = 6;
    af[0].bitvector = AFF_MIRROR_IMAGE;

    accum_duration = TRUE;
    to_vict = "Many little images momentarily surround you.";
    to_room = "$n is surrounded by mirror images.";
    break;


STEP 3
-------------------------------------------------------------------

in the file: spell_parser.c:
----------------------------

where all the other spello are defined:
-------------------------------------------------------------------

      spello(SPELL_MIRROR_IMAGE, "mirror image", 110, 85, 5, POS_STANDING,
 TAR_CHAR_ROOM, FALSE, MAG_AFFECTS);


STEP 4
-------------------------------------------------------------------

in the file: spells.h:
----------------------

Put the next available number you have for this spell
-------------------------------------------------------------------

#define SPELL_MIRROR_IMAGE       54 /* Mirror Image Spell DO NOT CHANGE */


STEP 5
-------------------------------------------------------------------

in the file: structs.h:
-----------------------

where all the other affects are defined:

in the #define <AFFECT> (1<<?) --> ? is the next available number!!!!
-------------------------------------------------------------------

#define AFF_MIRROR_IMAGE      (1 << 22)    /* Mirror Image  */


STEP 6
-------------------------------------------------------------------

in the file: act.informative.c:
-------------------------------

in the ACMD(do_score) where all the other AFF_FLAGGED are being checked.
-------------------------------------------------------------------

if (AFF_FLAGGED(ch, AFF_MIRROR_IMAGE))
    strcat(buf, "You are mirror imaged.\r\n");


STEP 7
-------------------------------------------------------------------

in the file: fight.c
--------------------

in the function:

int damage(struct char_data * ch, struct char_data * victim, int dam, int attacktype)

just after sanctuary affect is checked:
-------------------------------------------------------------------

  /* Check if victim is mirror imaged */
  if (AFF_FLAGGED(victim, AFF_MIRROR_IMAGE))
  {
   if (dice(1, (GET_LEVEL(victim)/8)) != 1)
   {
           /* currently NPC cannot use the mirror image spell */
           if (!IS_NPC(ch))
      act("You miss $N, and hit a mirrored image.", TRUE,
                 ch, 0, victim, TO_CHAR);

           act("$n's attack misses you, and hits a mirror image.", TRUE,
               ch, 0, victim, TO_VICT);

           return(0);
   }
  }
-------------------------------------------------------------------

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST