]> granicus.if.org Git - nethack/commitdiff
Falling through a hole or trap door will cause damage
authorPasi Kallinen <paxed@alt.org>
Tue, 25 Jan 2022 12:17:43 +0000 (14:17 +0200)
committerPasi Kallinen <paxed@alt.org>
Tue, 25 Jan 2022 12:17:43 +0000 (14:17 +0200)
doc/fixes37.0
src/do.c

index 90724a91a44f1c10fec1e85ec9b312c58aac6150..8f7578052e8c1eb90aa4aa69b092b7bdf4fa85da 100644 (file)
@@ -761,6 +761,7 @@ when already at level 30 and gaining another level--which doesn't increase
        level further but does add more HP and Pw--throttle the increases
 don't stop running when next to a peaceful, unless it blocks the way
 mindless monsters shouldn't cringe stepping on squeaky boards
+falling down a hole or trapdoor will cause damage proportional to fall height
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index ba4a7cb7bc6b38725c31e8fbe005ab9fb911829c..593be00dc1b88beea8cb56b62c2063b69625f928 100644 (file)
--- a/src/do.c
+++ b/src/do.c
@@ -1302,6 +1302,8 @@ goto_level(
     struct monst *mtmp;
     char whynot[BUFSZ];
     char *annotation;
+    int dist = newlevel->dlevel - dunlev(&u.uz);
+    boolean do_fall_dmg = FALSE;
 
     if (dunlev(newlevel) > dunlevs_in_dungeon(newlevel))
         newlevel->dlevel = dunlevs_in_dungeon(newlevel);
@@ -1617,6 +1619,7 @@ goto_level(
             if (Punished)
                 ballfall();
             selftouch("Falling, you");
+            do_fall_dmg = TRUE;
         }
     }
 
@@ -1782,6 +1785,15 @@ goto_level(
 
     /* assume this will always return TRUE when changing level */
     (void) in_out_region(u.ux, u.uy);
+
+    /* fall damage? */
+    if (do_fall_dmg) {
+        int dmg = d(dist, 6);
+
+        dmg = Maybe_Half_Phys(dmg);
+        losehp(dmg, "falling down a mine shaft", KILLED_BY);
+    }
+
     (void) pickup(1);
 }