location viability on Plane of Water

While testing, I noticed that I could completely fill the Water level
with air elementals.

Hero can't fly or levitate or water walk into/onto water locations
on Water level without drowning/crawling out the water, and monsters
shouldn't have been able to but could, then they were hit by drowning
since minliquid used different criteria than movement.  But goodpos(),
used for teleport destination and new monster creation among other
things, consided water locations acceptable on that level for
non-aquadic creatures with Fly/Lev/Wwalk ability.

It explains why so many dragons and other 'nasty' monsters have been
ending up on the vanquished monsters list when hero uses level
teleport to go directly there from level 1.  They've either been
getting created in water and then they drown when it's their turn to
move or moving into it to approach the hero and drowning (not sure
whether that case is immediate or on next move).  There's no message
since hero doesn't see it, and air elementals didn't drown since thy
don't breathe.
This commit is contained in:
PatR
2019-06-05 04:16:34 -07:00
parent 43ae30443d
commit b982e6c526
4 changed files with 36 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.38 $ $NHDT-Date: 1559685281 2019/06/04 21:54:41 $
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.41 $ $NHDT-Date: 1559733390 2019/06/05 11:16:30 $
This fixes36.3 file is here to capture information about updates in the 3.6.x
lineage following the release of 3.6.2 in May 2019. Please note, however,
@@ -53,6 +53,10 @@ blessed scroll of remove curse read while confused might be shown to operate
fix memory leak if corpse auto-revival attempt failed ("you feel less hassled")
allow a parent function to issue an an unplacebc() call that restricts
subsequent placebc() calls to that parent only
flying monsters could enter water on the Plane of Water but then they'd drown
unless they could also swim or else didn't need to breathe
when finding a place to put a monster on the Plane of Water, don't pick a
water location for flyers or floaters (levitate) or clingers (ceiling)
Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 makemon.c $NHDT-Date: 1556150377 2019/04/24 23:59:37 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.134 $ */
/* NetHack 3.6 makemon.c $NHDT-Date: 1559733390 2019/06/05 11:16:30 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.137 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1120,6 +1120,7 @@ int mmflags;
struct monst fakemon;
cc.x = cc.y = 0; /* lint suppression */
fakemon = zeromonst;
fakemon.data = ptr; /* set up for goodpos */
if (!makemon_rnd_goodpos(ptr ? &fakemon : (struct monst *)0,
gpflags, &cc))

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mon.c $NHDT-Date: 1559596286 2019/06/03 21:11:26 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.291 $ */
/* NetHack 3.6 mon.c $NHDT-Date: 1559733390 2019/06/05 11:16:30 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.292 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -493,7 +493,7 @@ register struct monst *mtmp;
{
boolean inpool, inlava, infountain;
/* [what about ceiling clingers?] */
/* [ceiling clingers are handled below] */
inpool = (is_pool(mtmp->mx, mtmp->my)
&& (!(is_flyer(mtmp->data) || is_floater(mtmp->data))
/* there's no "above the surface" on the plane of water */
@@ -1326,10 +1326,16 @@ long flag;
nowtyp = levl[x][y].typ;
nodiag = NODIAG(mdat - mons);
wantpool = mdat->mlet == S_EEL;
poolok = (is_flyer(mdat) || is_clinger(mdat)
wantpool = (mdat->mlet == S_EEL);
poolok = ((!Is_waterlevel(&u.uz)
&& (is_flyer(mdat) || is_floater(mdat) || is_clinger(mdat)))
|| (is_swimmer(mdat) && !wantpool));
lavaok = (is_flyer(mdat) || is_clinger(mdat) || likes_lava(mdat));
/* note: floating eye is the only is_floater() so this could be
simplified, but then adding another floater would be error prone */
lavaok = (is_flyer(mdat) || is_floater(mdat) || is_clinger(mdat)
|| likes_lava(mdat));
if (mdat == &mons[PM_FLOATING_EYE]) /* prefers to avoid heat */
lavaok = FALSE;
thrudoor = ((flag & (ALLOW_WALL | BUSTDOOR)) != 0L);
poisongas_ok = ((nonliving(mdat) || is_vampshifter(mon)
|| breathless(mdat)) || resists_poison(mon));
@@ -2686,7 +2692,8 @@ struct monst *mon;
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)) {
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;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 teleport.c $NHDT-Date: 1559227830 2019/05/30 14:50:30 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.87 $ */
/* NetHack 3.6 teleport.c $NHDT-Date: 1559733391 2019/06/05 11:16:31 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.88 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -62,16 +62,26 @@ unsigned gpflags;
mdat = mtmp->data;
if (is_pool(x, y) && !ignorewater) {
/* [what about Breathless?] */
if (mtmp == &youmonst)
return (Levitation || Flying || Wwalking || Swimming
|| Amphibious);
return (Swimming || Amphibious
|| (!Is_waterlevel(&u.uz)
/* water on the Plane of Water has no surface
so there's no way to be on or above that */
&& (Levitation || Flying || Wwalking)));
else
return (is_floater(mdat) || is_flyer(mdat) || is_swimmer(mdat)
|| is_clinger(mdat));
return (is_swimmer(mdat)
|| (!Is_waterlevel(&u.uz)
&& (is_floater(mdat) || is_flyer(mdat)
|| is_clinger(mdat))));
} else if (mdat->mlet == S_EEL && rn2(13) && !ignorewater) {
return FALSE;
} else if (is_lava(x, y)) {
if (mtmp == &youmonst)
/* 3.6.3: floating eye can levitate over lava but it avoids
that due the effect of the heat causing it to dry out */
if (mdat == &mons[PM_FLOATING_EYE])
return FALSE;
else if (mtmp == &youmonst)
return (Levitation || Flying
|| (Fire_resistance && Wwalking && uarmf
&& uarmf->oerodeproof)