From 273662c58c796d4e915ce27b9d912f357e61d85e Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 17 Jun 2019 10:09:16 -0700 Subject: [PATCH] monster overflow on Plane of Air Make Air behave the same as Earth, Fire, and Water if monsters are forced off the level for some reason. --- src/mon.c | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/src/mon.c b/src/mon.c index 1c7fe5424..2a8a7f350 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mon.c $NHDT-Date: 1560597210 2019/06/15 11:13:30 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.293 $ */ +/* NetHack 3.6 mon.c $NHDT-Date: 1560791350 2019/06/17 17:09:10 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.294 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2687,31 +2687,20 @@ struct monst *mon; mtmp->mstate |= MON_OBLITERATE; mongone(mtmp); - /* some places in the code might still reference mtmp->mx, mtmp->my */ + /* places in the code might still reference mtmp->mx, mtmp->my */ /* mtmp->mx = mtmp->my = 0; */ rloc_to(mon, mx, my); /* note: mon, not mtmp */ - } else { - /* last resort - migrate mon to the next plane */ - if (Is_waterlevel(&u.uz) || Is_firelevel(&u.uz) - || Is_earthlevel(&u.uz)) { - /* try sending mon on to the next plane */ - xchar target_lev = 0, xyloc = 0; - struct trap *trap = ftrap; - while (trap) { - if (trap->ttyp == MAGIC_PORTAL) - break; - trap = trap->ntrap; - } - if (trap) { - target_lev = ledger_no(&trap->dst); - xyloc = MIGR_RANDOM; - } - if (target_lev) { - mon->mstate |= MON_ENDGAME_MIGR; - migrate_mon(mon, target_lev, xyloc); - } - } + /* last resort - migrate mon to the next plane */ + } else if (!Is_astralevel(&u.uz)) { + d_level dest; + xchar target_lev; + + dest = u.uz; + dest.dlevel--; + target_lev = ledger_no(&dest); + mon->mstate |= MON_ENDGAME_MIGR; + migrate_mon(mon, target_lev, MIGR_RANDOM); } } }