]> granicus.if.org Git - nethack/commitdiff
Blessed potion of polymorph asks user for monster to poly into
authorPasi Kallinen <paxed@alt.org>
Thu, 14 Jul 2022 11:04:24 +0000 (14:04 +0300)
committerPasi Kallinen <paxed@alt.org>
Thu, 14 Jul 2022 11:04:27 +0000 (14:04 +0300)
... unless there's some other form that would override the choice,
such as a worn dragon armor, lycanthropy, or vampirism.

The polymorph will be in effect for 10-24 turns.

12 files changed:
doc/fixes3-7-0.txt
include/hack.h
src/allmain.c
src/cmd.c
src/eat.c
src/fountain.c
src/mhitm.c
src/polyself.c
src/potion.c
src/read.c
src/trap.c
src/zap.c

index a4a6afd828b18c1ab3afb42b89fb13661af05d5c..8f465807e27754018bd9fd45f7b775322368171b 100644 (file)
@@ -957,6 +957,7 @@ if #wizmakemap was used to generate a replacement level while any shopkeeper,
        temple priest, or vault guard from the level was off of it at the
        time, the monster's eshk, epri, or egd data became invalid and would
        cause trouble if the monster returned to its 'home' level
+blessed potion of polymorph will prompt user for monster to poly into
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index 7ed89d8bc6cc01ae708e7ebced860a6b7b95a527..6b14d5e86e09a5d14be9b9decb056a547e09ffd3 100644 (file)
@@ -81,6 +81,15 @@ enum dismount_types {
     DISMOUNT_BYCHOICE = 6
 };
 
+/* polyself flags */
+enum polyself_flags {
+    POLY_NOFLAGS    = 0x00,
+    POLY_CONTROLLED = 0x01,
+    POLY_MONSTER    = 0x02,
+    POLY_REVERT     = 0x04,
+    POLY_LOW_CTRL   = 0x08
+};
+
 /* sellobj_state() states */
 #define SELL_NORMAL (0)
 #define SELL_DELIBERATE (1)
index a10faacacdecf2c816b9ad7162f537de02c5c80d..97af0626a522d635a7e5688640394448d642c444 100644 (file)
@@ -292,7 +292,7 @@ moveloop_core(void)
                         if (g.multi >= 0) {
                             stop_occupation();
                             if (mvl_change == 1)
-                                polyself(0);
+                                polyself(POLY_NOFLAGS);
                             else
                                 you_were();
                             mvl_change = 0;
index 2ce5e5b617bc27c8312c9c52a979caadf9752f75..b7858d4f781fc66aa9da63e520839966e4c69f85 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1490,7 +1490,7 @@ wiz_panic(void)
 static int
 wiz_polyself(void)
 {
-    polyself(1);
+    polyself(POLY_CONTROLLED);
     return ECMD_OK;
 }
 
index 5005ca7b930ea5bd3d41f4ba0608a34ca82a1ffe..5dfa8c597b0b968a7fcac19c465e6c5a96c4bbd6 100644 (file)
--- a/src/eat.c
+++ b/src/eat.c
@@ -1194,7 +1194,7 @@ cpostfx(int pm)
             You("%s.", (pm == PM_GENETIC_ENGINEER)
                           ? "undergo a freakish metamorphosis"
                           : "feel a change coming over you");
-            polyself(0);
+            polyself(POLY_NOFLAGS);
         }
         break;
     case PM_DISPLACER_BEAST:
index d7b62008ac4b8420a15b19d5d132be851b949a06..13203b3309fe4c32d8931c1737f18547f2f42024 100644 (file)
@@ -632,7 +632,7 @@ drinksink(void)
         pline("This %s contains toxic wastes!", hliquid("water"));
         if (!Unchanging) {
             You("undergo a freakish metamorphosis!");
-            polyself(0);
+            polyself(POLY_NOFLAGS);
         }
         break;
     /* more odd messages --JJB */
index b9b2b5ac22325531b462533bcab49f0e24bcf820..613e5ee0d9305e0a07cc9bc6ec7940db3b22cd8f 100644 (file)
@@ -992,7 +992,7 @@ mon_poly(struct monst *magr, struct monst *mdef, int dmg)
             /* system shock might take place in polyself() */
             if (u.ulycn == NON_PM) {
                 You("are subjected to a freakish metamorphosis.");
-                polyself(0);
+                polyself(POLY_NOFLAGS);
             } else if (u.umonnum != u.ulycn) {
                 You_feel("an unnatural urge coming on.");
                 you_were();
index 5fae612544603563677692ddaf8fe89b99e376ff..7c00d5993df09a6d6a1c8e0d492048289467eafa 100644 (file)
@@ -438,9 +438,10 @@ polyself(int psflags)
 {
     char buf[BUFSZ];
     int old_light, new_light, mntmp, class, tryct, gvariant = NEUTRAL;
-    boolean forcecontrol = (psflags == 1),
-            monsterpoly = (psflags == 2),
-            formrevert = (psflags == 3),
+    boolean forcecontrol = ((psflags & POLY_CONTROLLED) != 0),
+            low_control = ((psflags & POLY_LOW_CTRL) != 0),
+            monsterpoly = ((psflags & POLY_MONSTER) != 0),
+            formrevert = ((psflags & POLY_REVERT) != 0),
             draconian = (uarm && Is_dragon_armor(uarm)),
             iswere = (u.ulycn >= LOW_PM),
             isvamp = (is_vampire(g.youmonst.data)
@@ -469,6 +470,11 @@ polyself(int psflags)
         monsterpoly = TRUE;
         controllable_poly = FALSE;
     }
+
+    if (forcecontrol && low_control
+        && (draconian || monsterpoly || isvamp || iswere))
+        forcecontrol = FALSE;
+
     if (monsterpoly && isvamp)
         goto do_vampyr;
 
@@ -1681,7 +1687,7 @@ dopoly(void)
     struct permonst *savedat = g.youmonst.data;
 
     if (is_vampire(g.youmonst.data) || is_vampshifter(&g.youmonst)) {
-        polyself(2);
+        polyself(POLY_MONSTER);
         if (savedat != g.youmonst.data) {
             You("transform into %s.",
                 an(pmname(g.youmonst.data, Ugender)));
index 29769e86143409ad5283b0281bcf9a0fd1c3fab5..aad297451742530e545421ba7728c84f3b18608c 100644 (file)
@@ -1295,11 +1295,18 @@ peffect_acid(struct obj *otmp)
 }
 
 static void
-peffect_polymorph(struct obj *otmp UNUSED)
+peffect_polymorph(struct obj *otmp)
 {
     You_feel("a little %s.", Hallucination ? "normal" : "strange");
-    if (!Unchanging)
-        polyself(0);
+    if (!Unchanging) {
+        if (!otmp->blessed || (u.umonnum != u.umonster))
+            polyself(POLY_NOFLAGS);
+        else {
+            polyself(POLY_CONTROLLED|POLY_LOW_CTRL);
+            if (u.mtimedone && u.umonnum != u.umonster)
+                u.mtimedone = min(u.mtimedone, rn2(15) + 10);
+        }
+    }
 }
 
 int
@@ -1654,7 +1661,7 @@ potionhit(struct monst *mon, struct obj *obj, int how)
         case POT_POLYMORPH:
             You_feel("a little %s.", Hallucination ? "normal" : "strange");
             if (!Unchanging && !Antimagic)
-                polyself(0);
+                polyself(POLY_NOFLAGS);
             break;
         case POT_ACID:
             if (!Acid_resistance) {
index 0404faa2b1d6ede4e716393c18a53ea92ec9a222..f0bb880cc33138f265eaa93da8cf5ed70d8e2f8f 100644 (file)
@@ -2550,7 +2550,7 @@ do_class_genocide(void)
                     if (Upolyd && vampshifted(&g.youmonst)
                         /* current shifted form or base vampire form */
                         && (i == u.umonnum || i == g.youmonst.cham))
-                        polyself(3); /* vampshifter back to vampire */
+                        polyself(POLY_REVERT); /* vampshifter back to vampire */
                     if (Upolyd && i == u.umonnum) {
                         u.mh = -1;
                         if (Unchanging) {
@@ -2673,7 +2673,7 @@ do_genocide(int how)
             /* first revert if current shifted form or base vampire form */
             if (Upolyd && vampshifted(&g.youmonst)
                 && (mndx == u.umonnum || mndx == g.youmonst.cham))
-                polyself(3); /* vampshifter (bat, &c) back to vampire */
+                polyself(POLY_REVERT); /* vampshifter (bat, &c) back to vampire */
             /* Although "genus" is Latin for race, the hero benefits
              * from both race and role; thus genocide affects either.
              */
index ebff33dd76481f2ee0c576a5448b8ed993c22100..d9ec22cf0e39daee6c13412bbf80b7aca840dbea 100644 (file)
@@ -2162,7 +2162,7 @@ trapeffect_poly_trap(
             deltrap(trap);      /* delete trap before polymorph */
             newsym(u.ux, u.uy); /* get rid of trap symbol */
             You_feel("a change coming over you.");
-            polyself(0);
+            polyself(POLY_NOFLAGS);
         }
     } else {
         boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
index 70d275484bba4b6fb184b9b641551a2eada1ccc1..06db5a3c2627e1c1cfa93d363ceac2e415ce12ab 100644 (file)
--- a/src/zap.c
+++ b/src/zap.c
@@ -2572,7 +2572,7 @@ zapyourself(struct obj *obj, boolean ordinary)
     case SPE_POLYMORPH:
         if (!Unchanging) {
             learn_it = TRUE;
-            polyself(0);
+            polyself(POLY_NOFLAGS);
         }
         break;