Skip to content

Commit d09acf5

Browse files
committedMar 9, 2025
Fix: cold trap reduced mon max HP and not current after life-save
An assumption stated in the comment that updating mhp would not be necessary turned out to be false: when the monster was killed and life-saved, it returns false from thitm(). Since cold traps parallel fire traps, I used the same method of simply checking and updating mhp. This is a bit strange, because it means a monster that got killed by the trap and life-saved will still lose maximum HP, but it's at least consistent now.
1 parent 36509f0 commit d09acf5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
 

‎src/trap.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -1849,10 +1849,11 @@ trapeffect_cold_trap(
18491849
} else {
18501850
if (thitm(0, mtmp, (struct obj *) 0, dmg, FALSE))
18511851
trapkilled = TRUE;
1852-
else
1853-
/* we know mhp is at least `dmg' below mhpmax,
1854-
so no (mhp > mhpmax) check is needed here */
1852+
else {
18551853
mtmp->mhpmax -= rn2(dmg + 1);
1854+
if (mtmp->mhp > mtmp->mhpmax)
1855+
mtmp->mhp = mtmp->mhpmax;
1856+
}
18561857
}
18571858
if (rn2(3)) {
18581859
int xtradmg = destroy_items(mtmp, AD_COLD, dmg);

0 commit comments

Comments
 (0)