Skip to content

Commit

Permalink
Assess iron material damage for spiked pits
Browse files Browse the repository at this point in the history
The spikes in spiked pits are described as iron, so apply the additional
iron damage when the hero or a monster is harmed by them.
  • Loading branch information
entrez authored and copperwater committed Mar 21, 2024
1 parent 014a61a commit 57ec473
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/sit.c
Expand Up @@ -301,9 +301,11 @@ dosit(void)
u.utrap++;
} else if (u.utraptype == TT_PIT) {
if (trap && trap->ttyp == SPIKED_PIT) {
int dmg = Half_physical_damage ? rn2(2) : 1;
if (mon_hates_material(&gy.youmonst, IRON))
dmg += Maybe_Half_Phys(rnd(sear_damage(IRON)));
You("sit down on a spike. Ouch!");
losehp(Half_physical_damage ? rn2(2) : 1,
"sitting on an iron spike", KILLED_BY);
losehp(dmg, "sitting on an iron spike", KILLED_BY);
exercise(A_STR, FALSE);
} else
You("sit down in the pit.");
Expand Down
12 changes: 9 additions & 3 deletions src/trap.c
Expand Up @@ -2056,8 +2056,11 @@ trapeffect_pit(
set_utrap((unsigned) rn1(6, 2), TT_PIT);
if (!steedintrap(trap, (struct obj *) 0)) {
if (ttype == SPIKED_PIT) {
int dmg = rnd(conj_pit ? 4 : adj_pit ? 6 : 10);
if (mon_hates_material(mtmp, IRON))
dmg += rnd(sear_damage(IRON));
oldumort = u.umortality;
losehp(Maybe_Half_Phys(rnd(conj_pit ? 4 : adj_pit ? 6 : 10)),
losehp(Maybe_Half_Phys(dmg),
/* note: these don't need locomotion() handling;
if fatal while poly'd and Unchanging, the
death reason will be overridden with
Expand Down Expand Up @@ -2099,7 +2102,7 @@ trapeffect_pit(
exercise(A_DEX, FALSE);
}
} else {
int tt = trap->ttyp;
int tt = trap->ttyp, dmg;
boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
boolean trapkilled = FALSE;
boolean forcetrap = ((trflags & FORCETRAP) != 0);
Expand Down Expand Up @@ -2134,8 +2137,11 @@ trapeffect_pit(
seetrap(trap);
}
mselftouch(mtmp, "Falling, ", FALSE);
dmg = rnd((tt == PIT) ? 6 : 10);
if (tt == SPIKED_PIT && mon_hates_material(mtmp, IRON))
dmg += rnd(sear_damage(IRON));
if (DEADMONSTER(mtmp) || thitm(0, mtmp, (struct obj *) 0,
rnd((tt == PIT) ? 6 : 10), FALSE))
dmg, FALSE))
trapkilled = TRUE;

return trapkilled ? Trap_Killed_Mon : mtmp->mtrapped
Expand Down

0 comments on commit 57ec473

Please sign in to comment.