Mirror Image spell. 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. This spell works Great in my MUD, if you have any improvments please email me - itay_c@hotmail.com NOTICE: 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 then try to change it to your comfort. I would appreciate including me in credits or at least email me if you decide to use it. In short have fun, hope you find it useful, but use at your own risk! Itay Chumash. STEP 1 ------------------------------------------------------------------- in the file: class.c -------------------- where all the other spells are set: /* Mirror Image Spell */ spell_level(SPELL_MIRROR_IMAGE, CLASS_MAGIC_USER, 20); 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 */ STEP 5 ------------------------------------------------------------------- in the file: structs.h: ----------------------- where all the other affects are defined: in the #define (1< ? is the next available number!! ------------------------------------------------------------------- #define AFF_MIRROR_IMAGE (1 << 22) /* Mirror Image */ Now, in constants.c, in the end of: const char *affected_bits[] = { add just bedore the "\n"}; the line: "MIRROR-IMAGE", STEP 6 ------------------------------------------------------------------- in the file: act.informative.c: ------------------------------- in 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)/15)) != 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); } } } -------------------------------------------------------------------