Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes related to material hatred/searing #204

Merged
merged 2 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -1770,7 +1770,7 @@ extern const char *locomotion(const struct permonst *, const char *);
extern const char *stagger(const struct permonst *, const char *);
extern const char *on_fire(struct permonst *, struct attack *);
extern const char *msummon_environ(struct permonst *, const char **);
extern const struct permonst *raceptr(struct monst *);
extern struct permonst *raceptr(struct monst *);
extern boolean olfaction(struct permonst *);
extern int monmaterial(int);
extern int emits_light(struct permonst *);
Expand Down
6 changes: 3 additions & 3 deletions src/mondata.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ mstrength_ranged_attk(register struct permonst* ptr)
boolean
mon_hates_material(struct monst *mon, int material)
{
if (hates_material(mon->data, material))
if (hates_material(raceptr(mon), material))
return TRUE;

/* extra case: shapeshifted vampires still hate silver */
Expand Down Expand Up @@ -1367,8 +1367,8 @@ big_little_match(int montyp1, int montyp2)
* Returns correct pointer for non-polymorphed and polymorphed
* player. It does not return a pointer to player role character.
*/
const struct permonst *
raceptr(struct monst* mtmp)
struct permonst *
raceptr(struct monst *mtmp)
{
if (mtmp == &gy.youmonst && !Upolyd)
return &mons[gu.urace.mnum];
Expand Down
6 changes: 4 additions & 2 deletions src/sit.c
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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