]> granicus.if.org Git - nethack/commitdiff
fix 2nd part of #H4188 - monst fleeing up on lvl 1
authorPatR <rankin@nethack.org>
Wed, 27 Jan 2016 03:25:21 +0000 (19:25 -0800)
committerPatR <rankin@nethack.org>
Wed, 27 Jan 2016 03:25:21 +0000 (19:25 -0800)
The code to handle monsters fleeing up the upstairs on level 1 was
expecting those stairs to be normal upstairs but they are actually
sstairs like the ones down into the mines.  So monsters fled to the
Plane of Earth instead of escaping the dungeon as intended.

doc/fixes36.1
src/muse.c

index cc51218e23b6d611c9553235b6ea61093866b440..f8912ff97b3df57ed8a392f9d313d221260a16f0 100644 (file)
@@ -127,6 +127,8 @@ suppress "you climb up the stairs" message if verbose option is off
 physical damage from mind flayer attack was being inflicted twice
 adjust pending movement points when polymorphing into a slower creature
 damage inflicted by burning glob of green slime gave wrong messages
+monsters fleeing up the upstairs on level 1 were supposed to escape the
+       dungeon but ended up arriving on Plane of Earth
 
 
 Platform- and/or Interface-Specific Fixes
index f6e097657d1b79ae4458ee9673350d65f2b48d19..f5bec8c391fa2c8668e2217a04921d28d679862c 100644 (file)
@@ -389,9 +389,7 @@ struct monst *mtmp;
             if (!is_floater(mtmp->data))
                 m.has_defense = MUSE_DOWNSTAIRS;
         } else if (x == xupstair && y == yupstair) {
-            /* don't let monster leave the dungeon with the Amulet */
-            if (ledger_no(&u.uz) != 1)
-                m.has_defense = MUSE_UPSTAIRS;
+            m.has_defense = MUSE_UPSTAIRS;
         } else if (sstairs.sx && x == sstairs.sx && y == sstairs.sy) {
             if (sstairs.up || !is_floater(mtmp->data))
                 m.has_defense = MUSE_SSTAIRS;
@@ -848,21 +846,9 @@ struct monst *mtmp;
                          (coord *) 0);
         return 2;
     case MUSE_UPSTAIRS:
-        /* Monsters without amulets escape the dungeon and are
-         * gone for good when they leave up the up stairs.
-         * Monsters with amulets would reach the endlevel,
-         * which we cannot allow since that would leave the
-         * player stranded.
-         */
-        if (ledger_no(&u.uz) == 1) {
-            if (mon_has_special(mtmp))
-                return 0;
-            if (vismon)
-                pline("%s escapes the dungeon!", Monnam(mtmp));
-            mongone(mtmp);
-            return 2;
-        }
         m_flee(mtmp);
+        if (ledger_no(&u.uz) == 1)
+            goto escape; /* impossible; level 1 upstairs are SSTAIRS */
         if (Inhell && mon_has_amulet(mtmp) && !rn2(4)
             && (dunlev(&u.uz) < dunlevs_in_dungeon(&u.uz) - 3)) {
             if (vismon)
@@ -905,6 +891,22 @@ struct monst *mtmp;
         return 2;
     case MUSE_SSTAIRS:
         m_flee(mtmp);
+        if (ledger_no(&u.uz) == 1) {
+        escape:
+            /* Monsters without the Amulet escape the dungeon and
+             * are gone for good when they leave up the up stairs.
+             * A monster with the Amulet would leave it behind
+             * (mongone -> mdrop_special_objs) but we force any
+             * monster who manages to acquire it or the invocation
+             * tools to stick around instead of letting it escape.
+             */
+            if (mon_has_special(mtmp))
+                return 0;
+            if (vismon)
+                pline("%s escapes the dungeon!", Monnam(mtmp));
+            mongone(mtmp);
+            return 2;
+        }
         if (vismon)
             pline("%s escapes %sstairs!", Monnam(mtmp),
                   sstairs.up ? "up" : "down");