another vampire shape-shifting bit
authorPatR <rankin@nethack.org>
Sun, 24 Jan 2016 03:15:38 +0000 (19:15 -0800)
committerPatR <rankin@nethack.org>
Sun, 24 Jan 2016 03:15:38 +0000 (19:15 -0800)
Chameleon impersonating a vampire and vampire subject to protection
from shape changers weren't the only ways to have a vampire monster
which isn't a vampshifter.  One-shot polymorph could produce that too.

src/mon.c

index 8080fd044529e8fa96a518133c11a7c5554a139d..2dce54e1b573c3696eaa47d369fdcc3012f87d3f 100644 (file)
--- a/src/mon.c
+++ b/src/mon.c
@@ -3205,6 +3205,9 @@ boolean msg;      /* "The oldmon turns into a newmon!" */
     } else if (mvitals[monsndx(mdat)].mvflags & G_GENOD)
         return 0; /* passed in mdat is genocided */
 
+    if (mdat == mtmp->data)
+        return 0; /* still the same monster */
+
     mgender_from_permonst(mtmp, mdat);
 
     if (In_endgame(&u.uz) && is_mplayer(olddata) && has_mname(mtmp)) {
@@ -3220,9 +3223,6 @@ boolean msg;      /* "The oldmon turns into a newmon!" */
             *p = '\0';
     }
 
-    if (mdat == mtmp->data)
-        return 0; /* still the same monster */
-
     if (mtmp->wormno) { /* throw tail away */
         wormgone(mtmp);
         place_monster(mtmp, mtmp->mx, mtmp->my);
@@ -3337,6 +3337,12 @@ boolean msg;      /* "The oldmon turns into a newmon!" */
             MNAME(mtmp) = save_mname;
     }
 
+    /* when polymorph trap/wand/potion produces a vampire, turn in into
+       a full-fledged vampshifter unless shape-changing is blocked */
+    if (mtmp->cham == NON_PM && mdat->mlet == S_VAMPIRE
+        && !Protection_from_shape_changers)
+        mtmp->cham = pm_to_cham(monsndx(mdat));
+
     possibly_unwield(mtmp, polyspot); /* might lose use of weapon */
     mon_break_armor(mtmp, polyspot);
     if (!(mtmp->misc_worn_check & W_ARMG))