fix resistance breakage
The Mitre of Holiness commit broke resistance handling. This seems to work correctly.
This commit is contained in:
@@ -268,14 +268,14 @@ struct monst {
|
|||||||
#endif
|
#endif
|
||||||
#define mon_resistancebits(mon) \
|
#define mon_resistancebits(mon) \
|
||||||
((mon)->data->mresists | (mon)->mextrinsics | (mon)->mintrinsics)
|
((mon)->data->mresists | (mon)->mextrinsics | (mon)->mintrinsics)
|
||||||
#define resists_fire(mon) Resists_Elem(mon, MR_FIRE)
|
#define resists_fire(mon) Resists_Elem(mon, FIRE_RES)
|
||||||
#define resists_cold(mon) Resists_Elem(mon, MR_COLD)
|
#define resists_cold(mon) Resists_Elem(mon, COLD_RES)
|
||||||
#define resists_sleep(mon) Resists_Elem(mon, MR_SLEEP)
|
#define resists_sleep(mon) Resists_Elem(mon, SLEEP_RES)
|
||||||
#define resists_disint(mon) Resists_Elem(mon, MR_DISINT)
|
#define resists_disint(mon) Resists_Elem(mon, DISINT_RES)
|
||||||
#define resists_elec(mon) Resists_Elem(mon, MR_ELEC)
|
#define resists_elec(mon) Resists_Elem(mon, SHOCK_RES)
|
||||||
#define resists_poison(mon) Resists_Elem(mon, MR_POISON)
|
#define resists_poison(mon) Resists_Elem(mon, POISON_RES)
|
||||||
#define resists_acid(mon) Resists_Elem(mon, MR_ACID)
|
#define resists_acid(mon) Resists_Elem(mon, ACID_RES)
|
||||||
#define resists_ston(mon) Resists_Elem(mon, MR_STONE)
|
#define resists_ston(mon) Resists_Elem(mon, STONE_RES)
|
||||||
|
|
||||||
#define is_lminion(mon) \
|
#define is_lminion(mon) \
|
||||||
(is_minion((mon)->data) && mon_aligntyp(mon) == A_LAWFUL)
|
(is_minion((mon)->data) && mon_aligntyp(mon) == A_LAWFUL)
|
||||||
|
|||||||
@@ -126,24 +126,24 @@ defended(struct monst *mon, int adtyp)
|
|||||||
/* returns True if monster resists particular elemental damage; mostly used
|
/* returns True if monster resists particular elemental damage; mostly used
|
||||||
in order to check effects of carried artifacts */
|
in order to check effects of carried artifacts */
|
||||||
boolean
|
boolean
|
||||||
Resists_Elem(struct monst *mon, int restyp)
|
Resists_Elem(struct monst *mon, int proptyp)
|
||||||
{
|
{
|
||||||
struct obj *o;
|
struct obj *o;
|
||||||
long slotmask;
|
long slotmask;
|
||||||
boolean is_you = (mon == &gy.youmonst);
|
boolean is_you = (mon == &gy.youmonst);
|
||||||
int u_resist, dmgtyp = 0, proptyp = 0;
|
int u_resist = 0, dmgtyp = 0, restyp = 0;
|
||||||
|
|
||||||
switch (restyp) {
|
switch (proptyp) {
|
||||||
case MR_FIRE:
|
case FIRE_RES:
|
||||||
case MR_COLD:
|
case COLD_RES:
|
||||||
case MR_SLEEP:
|
case SLEEP_RES:
|
||||||
case MR_DISINT:
|
case DISINT_RES:
|
||||||
case MR_ELEC:
|
case SHOCK_RES:
|
||||||
case MR_POISON:
|
case POISON_RES:
|
||||||
case MR_ACID:
|
case ACID_RES:
|
||||||
case MR_STONE:
|
case STONE_RES:
|
||||||
dmgtyp = restyp;
|
dmgtyp = restyp = proptyp + 1; /* valid for dmgtyp|restyp 2..9 */
|
||||||
proptyp = dmgtyp - 1; /* valid for dmgtyp|restyp 2..9 */
|
u_resist = u.uprops[proptyp].intrinsic || u.uprops[proptyp].extrinsic;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* accept these, but we expect callers to use their routines directly */
|
/* accept these, but we expect callers to use their routines directly */
|
||||||
@@ -155,10 +155,9 @@ Resists_Elem(struct monst *mon, int restyp)
|
|||||||
return resists_blnd(mon);
|
return resists_blnd(mon);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
impossible("Resists_Elem(%d), unexpected resistance type", restyp);
|
impossible("Resists_Elem(%d), unexpected property type", proptyp);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
u_resist = u.uprops[restyp].intrinsic || u.uprops[restyp].extrinsic;
|
|
||||||
|
|
||||||
if (is_you ? u_resist : ((mon_resistancebits(mon) & restyp) != 0))
|
if (is_you ? u_resist : ((mon_resistancebits(mon) & restyp) != 0))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|||||||
Reference in New Issue
Block a user