]> granicus.if.org Git - nethack/commitdiff
stoning resistance revisited
authorPatR <rankin@nethack.org>
Sat, 26 Mar 2022 18:23:06 +0000 (11:23 -0700)
committerPatR <rankin@nethack.org>
Sat, 26 Mar 2022 18:23:06 +0000 (11:23 -0700)
It turns out that there were a bunch more monsters with the corpse-
conveys-stoning-resistance flag than just green mold.  Instead of
stripping it off, give them (including green mold) a chance to confer
timed resistance against stoning and also against acid.

All of these can convey either of those two resistances.  Like other
intrinsics obtained via eating, at most one can be obtained from any
given corpse.
  green mold, acid blob, spotted jelly, ochre jelly, black naga,
  yellow dragon, Chromatic Dragon
These can confer temporary stoning resistance but not acid resistance:
  lizard, chickatrice, cockatrice, gargoyle, winged gargoyle,
  xorn, Medusa
There aren't any that confer just acid resistance without a chance for
stoning resistance.

The effect lasts for 3d6 turns, or is extended by 3d6 more if randomly
chosen and applied when already in effect.

Having temporary acid resistance time out during another meal when
eating a corpse that ends up conferring acid resistance seems strange.
The protection against acid is granted at the start of the meal and
continues to the end (in regards to eating, not external attacks) even
when the intrinisic is lost in between.  I'm not sure whether that
needs some form of fixing, and if so, what that fixing should be.

doc/fixes3-7-0.txt
include/monsters.h
src/eat.c
src/timeout.c

index 907822a18fa325671cf78bcd6c361510176cd020..23b5e9c2478be16f1fc819041eb64147a843e89c 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.844 $ $NHDT-Date: 1647911478 2022/03/22 01:11:18 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.849 $ $NHDT-Date: 1648318980 2022/03/26 18:23:00 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -848,8 +848,7 @@ hide-under monsters who can be turned to stone aren't able to hide under a
        that the other items aren't all more cockatrice corpses
 don't stop travel when going past a closed door (eg. when traveling along
        a room wall)
-monster definition for green mold falsely indicated that eating a green mold
-       corpse could convey stoning resistance
+some monster corpses can now convey temporary acid or stoning resistance
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index 4c45b5f574b6e5b50e97d5ffe7b23ea648ba1b55..5a9c4ae85a80267b506a1fc2d7403f2ae4cb9083 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 monsters.h      $NHDT-Date: 1616891049 2021/03/28 00:24:09 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.85 $ */
+/* NetHack 3.7 monsters.h      $NHDT-Date: 1648318980 2022/03/26 18:23:00 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.97 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Michael Allison, 2006. */
 /* NetHack may be freely redistributed.  See license for details. */
         A(ATTK(AT_NONE, AD_ACID, 1, 8), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK,
           NO_ATTK),
         SIZ(30, 10, MS_SILENT, MZ_TINY),
-        MR_SLEEP | MR_POISON | MR_ACID | MR_STONE, MR_STONE,
+        MR_SLEEP | MR_POISON | MR_ACID | MR_STONE, MR_ACID | MR_STONE,
         M1_BREATHLESS | M1_AMORPHOUS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD
             | M1_MINDLESS | M1_ACID,
         M2_WANDER | M2_NEUTER, 0, 2, CLR_GREEN, ACID_BLOB),
             | M1_MINDLESS | M1_NOTAKE,
         M2_HOSTILE | M2_NEUTER, 0, 5, CLR_BLUE, BLUE_JELLY),
     MON("spotted jelly", S_JELLY, LVL(5, 0, 8, 10, 0), (G_GENO | 1),
-        A(ATTK(AT_NONE, AD_ACID, 0, 6), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK,
-          NO_ATTK),
-        SIZ(50, 20, MS_SILENT, MZ_MEDIUM), MR_ACID | MR_STONE, 0,
+        A(ATTK(AT_NONE, AD_ACID, 0, 6),
+          NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
+        SIZ(50, 20, MS_SILENT, MZ_MEDIUM),
+        MR_ACID | MR_STONE, MR_ACID | MR_STONE,
         M1_BREATHLESS | M1_AMORPHOUS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD
             | M1_MINDLESS | M1_ACID | M1_NOTAKE,
         M2_HOSTILE | M2_NEUTER, 0, 6, CLR_GREEN, SPOTTED_JELLY),
     MON("ochre jelly", S_JELLY, LVL(6, 3, 8, 20, 0), (G_GENO | 2),
-        A(ATTK(AT_ENGL, AD_ACID, 3, 6), ATTK(AT_NONE, AD_ACID, 3, 6), NO_ATTK,
-          NO_ATTK, NO_ATTK, NO_ATTK),
-        SIZ(50, 20, MS_SILENT, MZ_MEDIUM), MR_ACID | MR_STONE, 0,
+        A(ATTK(AT_ENGL, AD_ACID, 3, 6), ATTK(AT_NONE, AD_ACID, 3, 6),
+          NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
+        SIZ(50, 20, MS_SILENT, MZ_MEDIUM),
+        MR_ACID | MR_STONE, MR_ACID | MR_STONE,
         M1_BREATHLESS | M1_AMORPHOUS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD
             | M1_MINDLESS | M1_ACID | M1_NOTAKE,
         M2_HOSTILE | M2_NEUTER, 0, 8, CLR_BROWN, OCHRE_JELLY),
                                      NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
         SIZ(0, 0, MS_SILENT, MZ_SMALL),
         MR_FIRE | MR_COLD | MR_ELEC | MR_DISINT | MR_SLEEP | MR_POISON
-            | MR_ACID | MR_STONE,
-        0, M1_FLY | M1_BREATHLESS | M1_AMORPHOUS | M1_NOEYES | M1_NOLIMBS
+            | MR_ACID | MR_STONE, 0,
+        M1_FLY | M1_BREATHLESS | M1_AMORPHOUS | M1_NOEYES | M1_NOLIMBS
                | M1_NOHEAD | M1_MINDLESS | M1_UNSOLID | M1_NOTAKE,
         M2_HOSTILE | M2_NEUTER, M3_INFRAVISIBLE, 5, CLR_YELLOW, YELLOW_LIGHT),
     MON("black light", S_LIGHT, LVL(5, 15, 0, 0, 0),
                                      NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
         SIZ(0, 0, MS_SILENT, MZ_SMALL),
         MR_FIRE | MR_COLD | MR_ELEC | MR_DISINT | MR_SLEEP | MR_POISON
-            | MR_ACID | MR_STONE,
-        0,
+            | MR_ACID | MR_STONE, 0,
         M1_FLY | M1_BREATHLESS | M1_AMORPHOUS | M1_NOEYES | M1_NOLIMBS
             | M1_NOHEAD | M1_MINDLESS | M1_UNSOLID | M1_SEE_INVIS | M1_NOTAKE,
         M2_HOSTILE | M2_NEUTER, 0, 7, CLR_BLACK, BLACK_LIGHT),
         M2_HOSTILE | M2_STRONG | M2_GREEDY | M2_JEWELS, 0, 13, CLR_GREEN,
         BABY_GREEN_DRAGON),
     MON("baby yellow dragon", S_DRAGON, LVL(12, 9, 2, 10, 0), G_GENO,
-        A(ATTK(AT_BITE, AD_PHYS, 2, 6), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK,
-          NO_ATTK),
+        A(ATTK(AT_BITE, AD_PHYS, 2, 6),
+          NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
         SIZ(1500, 500, MS_ROAR, MZ_HUGE), MR_ACID | MR_STONE, 0,
         M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_CARNIVORE | M1_ACID,
         M2_HOSTILE | M2_STRONG | M2_GREEDY | M2_JEWELS, 0, 13, CLR_YELLOW,
         0, 20, CLR_GREEN, GREEN_DRAGON),
     MON("yellow dragon", S_DRAGON, LVL(15, 9, -1, 20, 7), (G_GENO | 1),
         A(ATTK(AT_BREA, AD_ACID, 4, 6), ATTK(AT_BITE, AD_PHYS, 3, 8),
-          ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), NO_ATTK,
-          NO_ATTK),
-        SIZ(WT_DRAGON, 1500, MS_ROAR, MZ_GIGANTIC), MR_ACID | MR_STONE,
-        MR_STONE, M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_SEE_INVIS
-                      | M1_OVIPAROUS | M1_CARNIVORE | M1_ACID,
+          ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4),
+          NO_ATTK, NO_ATTK),
+        SIZ(WT_DRAGON, 1500, MS_ROAR, MZ_GIGANTIC),
+        MR_ACID | MR_STONE, MR_ACID | MR_STONE,
+        M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_SEE_INVIS
+            | M1_OVIPAROUS | M1_CARNIVORE | M1_ACID,
         M2_HOSTILE | M2_STRONG | M2_NASTY | M2_GREEDY | M2_JEWELS | M2_MAGIC,
         0, 20, CLR_YELLOW, YELLOW_DRAGON),
     /*
     MON("green mold", S_FUNGUS, LVL(1, 0, 9, 0, 0), (G_GENO | 1),
         A(ATTK(AT_NONE, AD_ACID, 0, 4),
           NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
-        SIZ(50, 30, MS_SILENT, MZ_SMALL), MR_ACID | MR_STONE, 0,
+        SIZ(50, 30, MS_SILENT, MZ_SMALL),
+        MR_ACID | MR_STONE, MR_ACID | MR_STONE,
         M1_BREATHLESS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS
             | M1_ACID | M1_NOTAKE,
         M2_HOSTILE | M2_NEUTER, 0, 2, CLR_GREEN, GREEN_MOLD),
      * Nagas
      */
     MON("red naga hatchling", S_NAGA, LVL(3, 10, 6, 0, 0), G_GENO,
-        A(ATTK(AT_BITE, AD_PHYS, 1, 4), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK,
-          NO_ATTK),
-        SIZ(500, 100, MS_MUMBLE, MZ_LARGE), MR_FIRE | MR_POISON,
-        MR_FIRE | MR_POISON,
+        A(ATTK(AT_BITE, AD_PHYS, 1, 4),
+          NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
+        SIZ(500, 100, MS_MUMBLE, MZ_LARGE), MR_FIRE | MR_POISON, MR_POISON,
         M1_NOLIMBS | M1_SLITHY | M1_THICK_HIDE | M1_NOTAKE | M1_OMNIVORE,
         M2_STRONG, M3_INFRAVISIBLE, 4, CLR_RED, RED_NAGA_HATCHLING),
     MON("black naga hatchling", S_NAGA, LVL(3, 10, 6, 0, 0), G_GENO,
-        A(ATTK(AT_BITE, AD_PHYS, 1, 4), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK,
-          NO_ATTK),
-        SIZ(500, 100, MS_MUMBLE, MZ_LARGE), MR_POISON | MR_ACID | MR_STONE,
-        MR_POISON | MR_STONE, M1_NOLIMBS | M1_SLITHY | M1_THICK_HIDE | M1_ACID
-                                  | M1_NOTAKE | M1_CARNIVORE,
+        A(ATTK(AT_BITE, AD_PHYS, 1, 4),
+          NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
+        SIZ(500, 100, MS_MUMBLE, MZ_LARGE),
+        MR_POISON | MR_ACID | MR_STONE, MR_POISON,
+        M1_NOLIMBS | M1_SLITHY | M1_THICK_HIDE | M1_ACID | M1_NOTAKE
+            | M1_CARNIVORE,
         M2_STRONG, 0, 4, CLR_BLACK, BLACK_NAGA_HATCHLING),
     MON("golden naga hatchling", S_NAGA, LVL(3, 10, 6, 0, 0), G_GENO,
         A(ATTK(AT_BITE, AD_PHYS, 1, 4), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK,
                                  | M1_OVIPAROUS | M1_NOTAKE | M1_OMNIVORE,
         M2_STRONG, M3_INFRAVISIBLE, 8, CLR_RED, RED_NAGA),
     MON("black naga", S_NAGA, LVL(8, 14, 2, 10, 4), (G_GENO | 1),
-        A(ATTK(AT_BITE, AD_PHYS, 2, 6), ATTK(AT_SPIT, AD_ACID, 0, 0), NO_ATTK,
-          NO_ATTK, NO_ATTK, NO_ATTK),
-        SIZ(2600, 400, MS_MUMBLE, MZ_HUGE), MR_POISON | MR_ACID | MR_STONE,
-        MR_POISON | MR_STONE,
+        A(ATTK(AT_BITE, AD_PHYS, 2, 6), ATTK(AT_SPIT, AD_ACID, 0, 0),
+          NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
+        SIZ(2600, 400, MS_MUMBLE, MZ_HUGE),
+        MR_POISON | MR_ACID | MR_STONE, MR_POISON | MR_ACID | MR_STONE,
         M1_NOLIMBS | M1_SLITHY | M1_THICK_HIDE | M1_OVIPAROUS | M1_ACID
             | M1_NOTAKE | M1_CARNIVORE,
         M2_STRONG, 0, 10, CLR_BLACK, BLACK_NAGA),
      * must be in the same order as the pudding globs in objects.c
      */
     MON("gray ooze", S_PUDDING, LVL(3, 1, 8, 0, 0), (G_GENO | G_NOCORPSE | 2),
-        A(ATTK(AT_BITE, AD_RUST, 2, 8), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK,
-          NO_ATTK),
+        A(ATTK(AT_BITE, AD_RUST, 2, 8),
+          NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
         SIZ(500, 250, MS_SILENT, MZ_MEDIUM),
         MR_FIRE | MR_COLD | MR_POISON | MR_ACID | MR_STONE,
         MR_FIRE | MR_COLD | MR_POISON,
             | M1_MINDLESS | M1_OMNIVORE | M1_ACID,
         M2_HOSTILE | M2_NEUTER, 0, 4, CLR_GRAY, GRAY_OOZE),
     MON("brown pudding", S_PUDDING, LVL(5, 3, 8, 0, 0),
-        (G_GENO | G_NOCORPSE | 1), A(ATTK(AT_BITE, AD_DCAY, 0, 0), NO_ATTK,
-                                     NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
+        (G_GENO | G_NOCORPSE | 1),
+        A(ATTK(AT_BITE, AD_DCAY, 0, 0),
+          NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
         SIZ(500, 250, MS_SILENT, MZ_MEDIUM),
         MR_COLD | MR_ELEC | MR_POISON | MR_ACID | MR_STONE,
         MR_COLD | MR_ELEC | MR_POISON,
         A(ATTK(AT_TUCH, AD_SLIM, 1, 4), ATTK(AT_NONE, AD_SLIM, 0, 0), NO_ATTK,
           NO_ATTK, NO_ATTK, NO_ATTK),
         SIZ(400, 150, MS_SILENT, MZ_LARGE),
-        MR_COLD | MR_ELEC | MR_POISON | MR_ACID | MR_STONE, 0,
+        MR_COLD | MR_ELEC | MR_POISON | MR_ACID | MR_STONE, MR_ACID | MR_STONE,
         M1_BREATHLESS | M1_AMORPHOUS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD
             | M1_MINDLESS | M1_OMNIVORE | M1_ACID | M1_POIS,
         M2_HOSTILE | M2_NEUTER, 0, 8, CLR_GREEN, GREEN_SLIME),
     MON("black pudding", S_PUDDING, LVL(10, 6, 6, 0, 0),
         (G_GENO | G_NOCORPSE | 1),
-        A(ATTK(AT_BITE, AD_CORR, 3, 8), ATTK(AT_NONE, AD_CORR, 0, 0), NO_ATTK,
-          NO_ATTK, NO_ATTK, NO_ATTK),
+        A(ATTK(AT_BITE, AD_CORR, 3, 8), ATTK(AT_NONE, AD_CORR, 0, 0),
+          NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
         SIZ(900, 250, MS_SILENT, MZ_LARGE),
         MR_COLD | MR_ELEC | MR_POISON | MR_ACID | MR_STONE,
         MR_COLD | MR_ELEC | MR_POISON,
         M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID, M2_HOSTILE | M2_NEUTER, 0,
         6, CLR_BROWN, ROPE_GOLEM),
     MON("gold golem", S_GOLEM, LVL(5, 9, 6, 0, 0), (G_NOCORPSE | 1),
-        A(ATTK(AT_CLAW, AD_PHYS, 2, 3), ATTK(AT_CLAW, AD_PHYS, 2, 3), NO_ATTK,
-          NO_ATTK, NO_ATTK, NO_ATTK),
+        A(ATTK(AT_CLAW, AD_PHYS, 2, 3), ATTK(AT_CLAW, AD_PHYS, 2, 3),
+          NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
         SIZ(450, 0, MS_SILENT, MZ_LARGE), MR_SLEEP | MR_POISON | MR_ACID, 0,
         M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_THICK_HIDE,
         M2_HOSTILE | M2_NEUTER, 0, 6, HI_GOLD, GOLD_GOLEM),
     MON("leather golem", S_GOLEM, LVL(6, 6, 6, 0, 0), (G_NOCORPSE | 1),
-        A(ATTK(AT_CLAW, AD_PHYS, 1, 6), ATTK(AT_CLAW, AD_PHYS, 1, 6), NO_ATTK,
-          NO_ATTK, NO_ATTK, NO_ATTK),
+        A(ATTK(AT_CLAW, AD_PHYS, 1, 6), ATTK(AT_CLAW, AD_PHYS, 1, 6),
+          NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
         SIZ(800, 0, MS_SILENT, MZ_LARGE), MR_SLEEP | MR_POISON, 0,
         M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID, M2_HOSTILE | M2_NEUTER, 0,
         7, HI_LEATHER, LEATHER_GOLEM),
     MON("wood golem", S_GOLEM, LVL(7, 3, 4, 0, 0), (G_NOCORPSE | 1),
-        A(ATTK(AT_CLAW, AD_PHYS, 3, 4), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK,
-          NO_ATTK),
+        A(ATTK(AT_CLAW, AD_PHYS, 3, 4),
+          NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
         SIZ(900, 0, MS_SILENT, MZ_LARGE), MR_COLD | MR_SLEEP | MR_POISON, 0,
         M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_THICK_HIDE,
         M2_HOSTILE | M2_NEUTER, 0, 8, HI_WOOD, WOOD_GOLEM),
         A(ATTK(AT_WEAP, AD_PHYS, 2, 4), ATTK(AT_CLAW, AD_PHYS, 1, 8),
           ATTK(AT_GAZE, AD_STON, 0, 0), ATTK(AT_BITE, AD_DRST, 1, 6), NO_ATTK,
           NO_ATTK),
-        SIZ(WT_HUMAN, 400, MS_HISS, MZ_LARGE), MR_POISON | MR_STONE,
-        MR_POISON | MR_STONE, M1_FLY | M1_SWIM | M1_AMPHIBIOUS | M1_HUMANOID
-                                  | M1_POIS | M1_OMNIVORE,
+        SIZ(WT_HUMAN, 400, MS_HISS, MZ_LARGE),
+        MR_POISON | MR_STONE, MR_POISON | MR_STONE,
+        M1_FLY | M1_SWIM | M1_AMPHIBIOUS | M1_HUMANOID | M1_POIS | M1_OMNIVORE,
         M2_NOPOLY | M2_HOSTILE | M2_STRONG | M2_PNAME | M2_FEMALE,
         M3_WAITFORU | M3_INFRAVISIBLE, 25, CLR_BRIGHT_GREEN, MEDUSA),
     MON("Wizard of Yendor", S_HUMAN, LVL(30, 12, -8, 100, A_NONE),
         MR_FIRE | MR_COLD | MR_SLEEP | MR_DISINT | MR_ELEC | MR_POISON
             | MR_ACID | MR_STONE,
         MR_FIRE | MR_COLD | MR_SLEEP | MR_DISINT | MR_ELEC | MR_POISON
-            | MR_STONE,
+            | MR_ACID | MR_STONE,
         M1_THICK_HIDE | M1_NOHANDS | M1_CARNIVORE | M1_SEE_INVIS | M1_POIS,
         M2_NOPOLY | M2_HOSTILE | M2_FEMALE | M2_STALK | M2_STRONG | M2_NASTY
             | M2_GREEDY | M2_JEWELS | M2_MAGIC,
index 6ac5462ba8585a5000265f34ae6cf8f84aae464c..b738d802898ffd0e6c94136c11da04298a73d3d4 100644 (file)
--- a/src/eat.c
+++ b/src/eat.c
@@ -1,4 +1,4 @@
-/* NetHack 3.7 eat.c   $NHDT-Date: 1647133629 2022/03/13 01:07:09 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.262 $ */
+/* NetHack 3.7 eat.c   $NHDT-Date: 1648318981 2022/03/26 18:23:01 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.269 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2012. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -19,6 +19,7 @@ static void do_reset_eat(void);
 static void done_eating(boolean);
 static void cprefx(int);
 static int intrinsic_possible(int, struct permonst *);
+static boolean temp_givit(int, struct permonst *);
 static void givit(int, struct permonst *);
 static void eye_of_newt_buzz(void);
 static void cpostfx(int);
@@ -326,7 +327,7 @@ touchfood(struct obj *otmp)
             (void) splitobj(otmp, otmp->quan - 1L);
         else
             otmp = splitobj(otmp, 1L);
-        debugpline0("split object,");
+        debugpline0("split food,");
     }
 
     if (!otmp->oeaten) {
@@ -761,7 +762,7 @@ fix_petrification(void)
 
 /* intrinsic_possible() returns TRUE iff a monster can give an intrinsic. */
 static int
-intrinsic_possible(int type, register struct permonst *ptr)
+intrinsic_possible(int type, struct permonst *ptr)
 {
     int res = 0;
 
@@ -799,6 +800,14 @@ intrinsic_possible(int type, register struct permonst *ptr)
         res = (ptr->mconveys & MR_POISON) != 0;
         ifdebugresist("can get poison resistance");
         break;
+    case ACID_RES:
+        res = (ptr->mconveys & MR_ACID) != 0;
+        ifdebugresist("can get acid resistance temporarily");
+        break;
+    case STONE_RES:
+        res = (ptr->mconveys & MR_STONE) != 0;
+        ifdebugresist("can get stoning resistance temporarily");
+        break;
     case TELEPORT:
         res = can_teleport(ptr);
         ifdebugresist("can get teleport");
@@ -854,6 +863,14 @@ should_givit(int type, struct permonst *ptr)
     return (ptr->mlevel > rn2(chance));
 }
 
+static boolean
+temp_givit(int type, struct permonst *ptr)
+{
+    int chance = (type == STONE_RES) ? 6 : (type == ACID_RES) ? 3 : 0;
+
+    return chance ? (ptr->mlevel > rn2(chance)) : FALSE;
+}
+
 /* givit() tries to give you an intrinsic based on the monster's level
  * and what type of intrinsic it is trying to give you.
  */
@@ -862,7 +879,7 @@ givit(int type, register struct permonst *ptr)
 {
     debugpline1("Attempting to give intrinsic %d", type);
 
-    if (!should_givit(type, ptr))
+    if (!should_givit(type, ptr) && !temp_givit(type, ptr))
         return;
 
     switch (type) {
@@ -937,14 +954,26 @@ givit(int type, register struct permonst *ptr)
                 see_monsters();
         }
         break;
+    case ACID_RES:
+        debugpline0("Giving timed acid resistance");
+        if (!Acid_resistance)
+            You_feel("%s.", Hallucination ? "secure from flashbacks"
+                            : "less concerned about being harmed by acid");
+        incr_itimeout(&HAcid_resistance, d(3, 6));
+        break;
+    case STONE_RES:
+        debugpline0("Giving timed stoning resistance");
+        if (!Stone_resistance)
+            You_feel("%s.", Hallucination ? "unusually limber"
+                            : "less concerned about becoming pertrified");
+        incr_itimeout(&HStone_resistance, d(3, 6));
+        break;
     default:
         debugpline0("Tried to give an impossible intrinsic");
         break;
     }
 }
 
-DISABLE_WARNING_FORMAT_NONLITERAL
-
 static void
 eye_of_newt_buzz(void)
 {
@@ -968,6 +997,8 @@ eye_of_newt_buzz(void)
     }
 }
 
+DISABLE_WARNING_FORMAT_NONLITERAL
+
 /* called after completely consuming a corpse */
 static void
 cpostfx(int pm)
@@ -1078,6 +1109,7 @@ cpostfx(int pm)
             make_stunned(2L, FALSE);
         if ((HConfusion & TIMEOUT) > 2)
             make_confused(2L, FALSE);
+        check_intrinsics = TRUE; /* might convery temporary stoning resist */
         break;
     case PM_CHAMELEON:
     case PM_DOPPELGANGER:
index 9258bb075bbb67c74283eb4c65f72faee0813392..561208a79647e9499c2393cf83d60e8b876b901b 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 timeout.c       $NHDT-Date: 1606243387 2020/11/24 18:43:07 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.122 $ */
+/* NetHack 3.7 timeout.c       $NHDT-Date: 1648318982 2022/03/26 18:23:02 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.137 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2018. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -47,6 +47,9 @@ const struct propname {
     { DETECT_MONSTERS, "monster detection" },
     { SEE_INVIS, "see invisible" },
     { INVIS, "invisible" },
+    /* temporary acid resistance and stone resistance can come from eating */
+    { ACID_RES, "acid resistance" },
+    { STONE_RES, "stoning resistance" },
     /* timed displacement is possible via eating a displacer beast corpse */
     { DISPLACED, "displaced" },
     /* timed pass-walls is a potential prayer result if surrounded by stone
@@ -55,7 +58,8 @@ const struct propname {
     /*
      * Properties beyond here don't have timed values during normal play,
      * so there's not much point in trying to order them sensibly.
-     * They're either on or off based on equipment, role, actions, &c.
+     * They're either on or off based on equipment, role, actions, &c,
+     * but in wizard mode #wizintrinsic can give then as timed effects.
      */
     { FIRE_RES, "fire resistance" },
     { COLD_RES, "cold resistance" },
@@ -63,8 +67,6 @@ const struct propname {
     { DISINT_RES, "disintegration resistance" },
     { SHOCK_RES, "shock resistance" },
     { POISON_RES, "poison resistance" },
-    { ACID_RES, "acid resistance" },
-    { STONE_RES, "stoning resistance" },
     { DRAIN_RES, "drain resistance" },
     { SICK_RES, "sickness resistance" },
     { ANTIMAGIC, "magic resistance" },
@@ -723,12 +725,14 @@ nh_timeout(void)
                 }
                 break;
             case LEVITATION:
-                /* timed Flying is via #wizintrinsic only; still, we want to
-                   avoid float_down() reporting "you have stopped levitating
-                   and are now flying" if both are timing out together;
-                   relies on knowing that Lev timeout is handled before Fly */
+                /* timed Levitation is ordinary, timed Flying is via
+                   #wizintrinsic only; still, we want to avoid float_down()
+                   reporting "you have stopped levitating and are now flying"
+                   when both are timing out together; if that is about to
+                   happen, end Flying early to skip feedback about it;
+                   assumes Levitation is handled before Flying */
                 if ((HFlying & TIMEOUT) == 1L)
-                    --HFlying; /* bypass pending 'case FLYING' */
+                    set_itimeout(&HFlying, 0L); /* bypass 'case FLYING' */
                 (void) float_down(I_SPECIAL | TIMEOUT, 0L);
                 break;
             case FLYING:
@@ -739,6 +743,14 @@ nh_timeout(void)
                     spoteffects(TRUE);
                 }
                 break;
+            case ACID_RES:
+                if (!Acid_resistance && !Unaware)
+                    You("no longer feel safe from acid.");
+                break;
+            case STONE_RES:
+                if (!Stone_resistance && !Unaware)
+                    You("no longer feel secure from petrification.");
+                break;
             case DISPLACED:
                 if (!Displaced) /* give a message */
                     toggle_displacement((struct obj *) 0, 0L, FALSE);