issue #1449 - fake explorer corpses on land mines

Issue reported by AndrioCelos:  the corpse of an early-level fake
explorer supposedly killed by a trap would leave land mines intact.

Change land mines with a fake explorer's corpse into discovered pits.

Fixes #1449
This commit is contained in:
PatR
2025-09-25 11:39:08 -07:00
parent edd11009e9
commit b857899afc

View File

@@ -1812,8 +1812,7 @@ staticfn void
mktrap_victim(struct trap *ttmp)
{
/* Object generated by the trap; initially NULL, stays NULL if
we fail to generate an object or if the trap doesn't
generate objects. */
the trap doesn't generate objects. */
struct obj *otmp = NULL;
int victim_mnum; /* race of the victim */
unsigned lvl = level_difficulty();
@@ -1867,14 +1866,18 @@ mktrap_victim(struct trap *ttmp)
break;
}
otmp = mkobj(poss_class, FALSE);
/* these items are always cursed, both for flavour (owned
by a dead adventurer, bones-pile-style) and for balance
(less useful to use, and encourage pets to avoid the trap) */
if (otmp) {
otmp->blessed = 0;
otmp->cursed = 1;
otmp->owt = weight(otmp);
otmp = mkobj(poss_class, FALSE);
curse(otmp);
/* for mktrap_victim(), PIT is actually an exploded LANDMINE */
if (ttmp->ttyp == PIT && breaktest(otmp)) {
/* landmine: if fragile object has been created, destroy it;
don't worry about non-empty containers--they aren't
breakable--nor about breakable contents of such */
dealloc_obj(otmp);
} else {
place_object(otmp, x, y);
}
@@ -2054,7 +2057,7 @@ mktrap(
m.x = m.y = 0;
/* no traps in pools */
if (tm && is_pool(tm->x, tm->y))
if (tm && is_pool_or_lava(tm->x, tm->y))
return;
if (num > NO_TRAP && num < TRAPNUM) {
@@ -2126,7 +2129,8 @@ mktrap(
immediately lethal). Finally, pits are excluded because it's
weird to see an item in a pit and yet not be able to identify
that the pit is there. */
if (kind != NO_TRAP && !(mktrapflags & MKTRAP_NOVICTIM)
if (gi.in_mklev
&& kind != NO_TRAP && !(mktrapflags & MKTRAP_NOVICTIM)
&& lvl <= (unsigned) rnd(4)
&& kind != SQKY_BOARD && kind != RUST_TRAP
/* rolling boulder trap might not have a boulder if there was no
@@ -2135,8 +2139,15 @@ mktrap(
&& !(kind == ROLLING_BOULDER_TRAP
&& t->launch.x == t->tx && t->launch.y == t->ty)
&& !is_pit(kind) && (kind < HOLE || kind == MAGIC_TRAP)) {
if (kind == LANDMINE) {
/* if victim was killed by a land mine, we won't scatter objects;
treat it as exploded, converting it into an unconcealed pit */
t->ttyp = PIT;
t->tseen = 1;
}
mktrap_victim(t);
}
return;
}
/* Create stairs up or down at x,y.