feedback when seeing hider-under hide under

If an monster hides under and object or under water while in view,
say so.

Also, the sanity check for a hidden eel wasn't consistent with the
hiding criteria for it.  An eel can't hide on the Plane of Water even
when it's in the water rather than in an air bubble.
This commit is contained in:
PatR
2023-05-27 08:52:45 -07:00
parent b6a5be8d77
commit 5cd7f1823c
2 changed files with 19 additions and 3 deletions
+1
View File
@@ -1193,6 +1193,7 @@ skip sanity_check handling when current command is ^P, otherwise it might
applying a cream pie (always) or lump of royal jelly (sometimes) would use up applying a cream pie (always) or lump of royal jelly (sometimes) would use up
the object and then access its memory after that had been freed the object and then access its memory after that had been freed
keep track of hero's pending movement points across save and restore keep track of hero's pending movement points across save and restore
give feedback if hero sees a monster become hidden under an object or water
Fixes to 3.7.0-x General Problems Exposed Via git Repository Fixes to 3.7.0-x General Problems Exposed Via git Repository
+18 -3
View File
@@ -152,15 +152,19 @@ sanity_check_single_mon(
if (m_at(mx, my) == mtmp && hides_under(mptr) && !OBJ_AT(mx, my)) if (m_at(mx, my) == mtmp && hides_under(mptr) && !OBJ_AT(mx, my))
impossible("mon hiding under nonexistent obj (%s)", msg); impossible("mon hiding under nonexistent obj (%s)", msg);
if (mptr->mlet == S_EEL if (mptr->mlet == S_EEL
&& !is_pool(mx, my) && !Is_waterlevel(&u.uz)) && !(is_pool(mx, my) && !Is_waterlevel(&u.uz)))
impossible("eel hiding out of water (%s)", msg); impossible("eel hiding %s (%s)",
!Is_waterlevel(&u.uz) ? "out of water"
: "on Plane of Water", msg);
if (ceiling_hider(mptr) if (ceiling_hider(mptr)
/* normally !accessible would be overridable with passes_walls, /* normally !accessible would be overridable with passes_walls,
but not for hiding on the ceiling */ but not for hiding on the ceiling */
&& (!has_ceiling(&u.uz) || && (!has_ceiling(&u.uz) ||
!(levl[mx][my].typ == POOL !(levl[mx][my].typ == POOL
|| levl[mx][my].typ == MOAT || levl[mx][my].typ == MOAT
|| levl[mx][my].typ == WATER
|| levl[mx][my].typ == LAVAPOOL || levl[mx][my].typ == LAVAPOOL
|| levl[mx][my].typ == LAVAWALL
|| accessible(mx, my)))) || accessible(mx, my))))
impossible("ceiling hider hiding %s (%s)", impossible("ceiling hider hiding %s (%s)",
!has_ceiling(&u.uz) ? "without ceiling" !has_ceiling(&u.uz) ? "without ceiling"
@@ -4189,6 +4193,8 @@ boolean
hideunder(struct monst *mtmp) hideunder(struct monst *mtmp)
{ {
struct trap *t; struct trap *t;
const char *seenmon = (char *) 0, *seenobj = (char *) 0;
int seeit = canseemon(mtmp);
boolean oldundetctd, undetected = FALSE, is_u = (mtmp == &gy.youmonst); boolean oldundetctd, undetected = FALSE, is_u = (mtmp == &gy.youmonst);
coordxy x = is_u ? u.ux : mtmp->mx, y = is_u ? u.uy : mtmp->my; coordxy x = is_u ? u.ux : mtmp->mx, y = is_u ? u.uy : mtmp->my;
@@ -4200,16 +4206,20 @@ hideunder(struct monst *mtmp)
; /* undetected==FALSE; can't hide while stuck in a non-pit trap */ ; /* undetected==FALSE; can't hide while stuck in a non-pit trap */
} else if (mtmp->data->mlet == S_EEL) { } else if (mtmp->data->mlet == S_EEL) {
undetected = (is_pool(x, y) && !Is_waterlevel(&u.uz)); undetected = (is_pool(x, y) && !Is_waterlevel(&u.uz));
if (seeit)
seenobj = "the water";
} else if (hides_under(mtmp->data) && OBJ_AT(x, y)) { } else if (hides_under(mtmp->data) && OBJ_AT(x, y)) {
struct obj *otmp = gl.level.objects[x][y]; struct obj *otmp = gl.level.objects[x][y];
if (seeit)
seenobj = ansimpleoname(otmp);
/* most monsters won't hide under cockatrice corpse but they /* most monsters won't hide under cockatrice corpse but they
can hide under a pile containing more than just such corpses */ can hide under a pile containing more than just such corpses */
while (otmp && otmp->otyp == CORPSE while (otmp && otmp->otyp == CORPSE
&& touch_petrifies(&mons[otmp->corpsenm])) && touch_petrifies(&mons[otmp->corpsenm]))
otmp = otmp->nexthere; otmp = otmp->nexthere;
if (otmp != 0 || ((mtmp == &gy.youmonst) ? Stone_resistance if (otmp != 0 || ((mtmp == &gy.youmonst) ? Stone_resistance
: resists_ston(mtmp))) : resists_ston(mtmp)))
undetected = TRUE; undetected = TRUE;
} }
@@ -4217,8 +4227,13 @@ hideunder(struct monst *mtmp)
oldundetctd = u.uundetected != 0; oldundetctd = u.uundetected != 0;
u.uundetected = undetected ? 1 : 0; u.uundetected = undetected ? 1 : 0;
} else { } else {
if (seeit)
seenmon = y_monnam(mtmp);
oldundetctd = mtmp->mundetected != 0; oldundetctd = mtmp->mundetected != 0;
mtmp->mundetected = undetected ? 1 : 0; mtmp->mundetected = undetected ? 1 : 0;
if (undetected && seenmon && seenobj)
You_see("%s %s under %s", seenmon,
locomotion(mtmp->data, "hide"), seenobj);
} }
if (undetected != oldundetctd) if (undetected != oldundetctd)
newsym(x, y); newsym(x, y);