implement #H4340 - indirect kills vs pacifism

Implement the suggestion that a monster killing itself with acid
to avoid turning to stone or with fire to avoid turning into green
slime not break pacifist conduct even if the player caused the
"turning into" situation that triggered the accidental suicide.

Along the way I discovered a serious bug:  zhitm() applies damage
to target monster but leaves it to caller to finish killing off
that monster when damage is fatal, but muse_unslime() called it
without checking whether the monster should die.  For fire breath
that shouldn't matter since all fire breathers are immune to fire
damage, but when support for wands of fire and fire horns was
added later it just cloned the fire breath code and neglected to
check for fatal damage.  The result was that a monster with 0 HP
would be left on the map, then impossible "dmonsfree: 1 removed
doesn't match 0 pending" would be given when taking it off fmon
list, but a stale monster symbol (presumably level.monsters[][]
pointer too) was left on the map which eventually led to monsndx
panic or arbitrary crash.
This commit is contained in:
PatR
2016-05-14 16:57:56 -07:00
parent 81471c27ca
commit 0a15d425a8
3 changed files with 54 additions and 9 deletions

View File

@@ -234,6 +234,8 @@ effects of cursed potion of levitation were skipped if already levitating
when engulfed, having swallower be killed by angry deity trying to zap hero
no longer violates pacifist conduct (other penalties--reduced luck or
alignment--still apply if target is something you shouldn't kill)
likewise when a monster kills inself trying to prevent turning to stone or
into slime that's been caused by the player, pacifism is not affected
metabolism adjustments: hero poly'd into metallivore form still needs to eat;
being fainted or unconscious from other than sleep now consumes
nutrition at lower rate, like being asleep already did;
@@ -249,6 +251,10 @@ farlook when underwater now reports "land" for adjacent non-{water,lava,ice}
and "unreconnoitered" for non-adjacent anything, instead of "dark part
of a room" for the former and either dark-room or "unexplored" for the
latter depending upon whether the spot had previously been scouted
monster who accidentally killed itself by zapping wand of fire or fire horn
at self to prevent turning into slime was not properly killed off;
it wouldn't benefit from an amulet of life saving and would trigger
impossible "dmonsfree: N removed doesn't match M pending"
Fixes to Post-3.6.0 Problems that Were Exposed Via git Respository