From: PatR Date: Wed, 27 Jan 2016 03:25:21 +0000 (-0800) Subject: fix 2nd part of #H4188 - monst fleeing up on lvl 1 X-Git-Tag: NetHack-3.6.1_RC01~979 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=90c4898c9af80a63182bd2732b659ac5cb66276d;p=nethack fix 2nd part of #H4188 - monst fleeing up on lvl 1 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. --- diff --git a/doc/fixes36.1 b/doc/fixes36.1 index cc51218e2..f8912ff97 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -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 diff --git a/src/muse.c b/src/muse.c index f6e097657..f5bec8c39 100644 --- a/src/muse.c +++ b/src/muse.c @@ -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");