Skip to content

Commit

Permalink
Credit the player with monster trap deaths on player's turn
Browse files Browse the repository at this point in the history
If thitm killed a monster under any circumstances, the player was not
credited, regardless of the player setting the trap or whether the
player forced the monster onto that trap, e.g. with a staggering blow.
This doesn't do anything about the player-set-trap case (in part because
it seems unfair to pacifists that any stray pits they might leave around
could randomly kill a wandering monster and break their conduct), but it
makes it so that all trap deaths on the player's turn count as player
kills.

This is largely in preparation for an upcoming feature in which the
player can very clearly directly kill a monster with trap damage and
needed to be credited, but it was good to fix cases like jousting and
martial arts anyway.
  • Loading branch information
copperwater committed Oct 7, 2020
1 parent 04954d0 commit 4d8c7ec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doc/xnh-changelog-6.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ changes:
- Hallucination prevents petrification (because you are already stoned).
- Mordor orcs and Uruk-hai can generate with orcish spears.
- Any monster that generates with a spear can generate with a stack of them.
- If a monster dies to damage from a trap on the player's turn, the player is
considered responsible.

### Interface changes

Expand Down
10 changes: 9 additions & 1 deletion src/trap.c
Original file line number Diff line number Diff line change
Expand Up @@ -5969,7 +5969,15 @@ boolean nocorpse;
if (DEADMONSTER(mon)) {
int xx = mon->mx, yy = mon->my;

monkilled(mon, "", nocorpse ? -AD_RBRE : AD_PHYS);
/* If a monster dies in a trap on the player's turn (e.g. forced
* onto one by jousting or staggering blow), the player is probably
* responsible. */
if (g.context.mon_moving) {
monkilled(mon, "", nocorpse ? -AD_RBRE : AD_PHYS);
}
else {
xkilled(mon, nocorpse ? XKILL_NOCORPSE : 0);
}
if (DEADMONSTER(mon)) {
newsym(xx, yy);
trapkilled = TRUE;
Expand Down

0 comments on commit 4d8c7ec

Please sign in to comment.