fix issue #1362 - carrying Mitre of Holiness

Issue reported by elunna:  the definition of the Mitre of Holiness
specifies that carrying it should confer fire resistance but that
didn't work.

The Mitre's definition (added in 3.1.0) has always included that,
but such a capability had never been implemented.  Wearing it didn't
confer fire resistance either--its definition doesn't bother to
specify a 'defend' attribute since the 'carry' one should cover that.

This adds carrying capability for damage types fire, cold, sleep,
disintegration, electrity, poison, acid, and petrification.  Fire is
still specified by the Mitre; none of the others are currently used.

Fixes #1362
This commit is contained in:
PatR
2025-02-03 11:42:36 -08:00
parent 785f78c39b
commit a311f4b467
4 changed files with 77 additions and 20 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 extern.h $NHDT-Date: 1723580890 2024/08/13 20:28:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1435 $ */
/* NetHack 3.7 extern.h $NHDT-Date: 1738638877 2025/02/03 19:14:37 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1476 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1803,6 +1803,7 @@ extern boolean attacktype(struct permonst *, int) NONNULLARG1;
extern boolean noattacks(struct permonst *) NONNULLARG1;
extern boolean poly_when_stoned(struct permonst *) NONNULLARG1;
extern boolean defended(struct monst *, int) NONNULLARG1;
extern boolean Resists_Elem(struct monst *, int) NONNULLARG1;
extern boolean resists_drli(struct monst *) NONNULLARG1;
extern boolean resists_magm(struct monst *) NONNULLARG1;
extern boolean resists_blnd(struct monst *) NONNULLARG1;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 monst.h $NHDT-Date: 1678560511 2023/03/11 18:48:31 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.54 $ */
/* NetHack 3.7 monst.h $NHDT-Date: 1738640524 2025/02/03 19:42:04 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.67 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2016. */
/* NetHack may be freely redistributed. See license for details. */
@@ -268,22 +268,15 @@ struct monst {
#endif
#define mon_resistancebits(mon) \
((mon)->data->mresists | (mon)->mextrinsics | (mon)->mintrinsics)
#define resists_fire(mon) \
((mon_resistancebits(mon) & MR_FIRE) != 0)
#define resists_cold(mon) \
((mon_resistancebits(mon) & MR_COLD) != 0)
#define resists_sleep(mon) \
((mon_resistancebits(mon) & MR_SLEEP) != 0)
#define resists_disint(mon) \
((mon_resistancebits(mon) & MR_DISINT) != 0)
#define resists_elec(mon) \
((mon_resistancebits(mon) & MR_ELEC) != 0)
#define resists_poison(mon) \
((mon_resistancebits(mon) & MR_POISON) != 0)
#define resists_acid(mon) \
((mon_resistancebits(mon) & MR_ACID) != 0)
#define resists_ston(mon) \
((mon_resistancebits(mon) & MR_STONE) != 0)
#define resists_fire(mon) Resists_Elem(mon, MR_FIRE)
#define resists_cold(mon) Resists_Elem(mon, MR_COLD)
#define resists_sleep(mon) Resists_Elem(mon, MR_SLEEP)
#define resists_disint(mon) Resists_Elem(mon, MR_DISINT)
#define resists_elec(mon) Resists_Elem(mon, MR_ELEC)
#define resists_poison(mon) Resists_Elem(mon, MR_POISON)
#define resists_acid(mon) Resists_Elem(mon, MR_ACID)
#define resists_ston(mon) Resists_Elem(mon, MR_STONE)
#define is_lminion(mon) \
(is_minion((mon)->data) && mon_aligntyp(mon) == A_LAWFUL)