blessed objects vs vulnerable creatures

Collect creatures that don't like being hit by blessed objects in one
place.  No change in behavior.
This commit is contained in:
PatR
2022-01-21 13:19:57 -08:00
parent 182abe6b60
commit aab21eba95
5 changed files with 37 additions and 25 deletions

View File

@@ -1534,8 +1534,10 @@ extern boolean resists_magm(struct monst *);
extern boolean resists_blnd(struct monst *);
extern boolean can_blnd(struct monst *, struct monst *, uchar, struct obj *);
extern boolean ranged_attk(struct permonst *);
extern boolean hates_silver(struct permonst *);
extern boolean mon_hates_silver(struct monst *);
extern boolean hates_silver(struct permonst *);
extern boolean mon_hates_blessings(struct monst *);
extern boolean hates_blessings(struct permonst *);
extern boolean mon_hates_light(struct monst *);
extern boolean passes_bars(struct permonst *);
extern boolean can_blow(struct monst *);

View File

@@ -1028,7 +1028,7 @@ hitmu(register struct monst *mtmp, register struct attack *mattk)
/* First determine the base damage done */
mhm.damage = d((int) mattk->damn, (int) mattk->damd);
if ((is_undead(mdat) || is_vampshifter(mtmp)) && midnight())
mhm.damage += d((int) mattk->damn, (int) mattk->damd); /* extra damage */
mhm.damage += d((int) mattk->damn, (int) mattk->damd); /* extra dmg */
mhitm_adtyping(mtmp, mattk, &g.youmonst, &mhm);
if (mhm.done)
@@ -1051,10 +1051,9 @@ hitmu(register struct monst *mtmp, register struct attack *mattk)
if (mhm.damage) {
if (Half_physical_damage
/* Mitre of Holiness */
/* Mitre of Holiness, even if not currently blessed */
|| (Role_if(PM_CLERIC) && uarmh && is_quest_artifact(uarmh)
&& (is_undead(mtmp->data) || is_demon(mtmp->data)
|| is_vampshifter(mtmp))))
&& mon_hates_blessings(mtmp)))
mhm.damage = (mhm.damage + 1) / 2;
if (mhm.permdmg) { /* Death's life force drain */

View File

@@ -327,30 +327,44 @@ ranged_attk(struct permonst* ptr)
/* True if specific monster is especially affected by silver weapons */
boolean
mon_hates_silver(struct monst* mon)
mon_hates_silver(struct monst *mon)
{
return (boolean) (is_vampshifter(mon) || hates_silver(mon->data));
}
/* True if monster-type is especially affected by silver weapons */
boolean
hates_silver(register struct permonst* ptr)
hates_silver(struct permonst *ptr)
{
return (boolean) (is_were(ptr) || ptr->mlet == S_VAMPIRE || is_demon(ptr)
|| ptr == &mons[PM_SHADE]
|| (ptr->mlet == S_IMP && ptr != &mons[PM_TENGU]));
}
/* True if specific monster is especially affected by blessed objects */
boolean
mon_hates_blessings(struct monst *mon)
{
return (boolean) (is_vampshifter(mon) || hates_blessings(mon->data));
}
/* True if monster-type is especially affected by blessed objects */
boolean
hates_blessings(struct permonst *ptr)
{
return (boolean) (is_undead(ptr) || is_demon(ptr));
}
/* True if specific monster is especially affected by light-emitting weapons */
boolean
mon_hates_light(struct monst* mon)
mon_hates_light(struct monst *mon)
{
return (boolean) (hates_light(mon->data));
return (boolean) hates_light(mon->data);
}
/* True iff the type of monster pass through iron bars */
boolean
passes_bars(struct permonst* mptr)
passes_bars(struct permonst *mptr)
{
return (boolean) (passes_walls(mptr) || amorphous(mptr) || unsolid(mptr)
|| is_whirly(mptr) || verysmall(mptr)

View File

@@ -678,7 +678,7 @@ peffect_water(struct obj *otmp)
return;
}
g.potion_unkn++;
if (is_undead(g.youmonst.data) || is_demon(g.youmonst.data)
if (mon_hates_blessings(&g.youmonst) /* undead or demon */
|| u.ualign.type == A_CHAOTIC) {
if (otmp->blessed) {
pline("This burns like %s!", hliquid("acid"));
@@ -1725,7 +1725,7 @@ potionhit(struct monst *mon, struct obj *obj, int how)
}
break;
case POT_WATER:
if (is_undead(mon->data) || is_demon(mon->data)
if (mon_hates_blessings(mon) /* undead or demon */
|| is_were(mon->data) || is_vampshifter(mon)) {
if (obj->blessed) {
pline("%s %s in pain!", Monnam(mon),

View File

@@ -159,8 +159,7 @@ hitval(struct obj *otmp, struct monst *mon)
/* Put weapon vs. monster type "to hit" bonuses in below: */
/* Blessed weapons used against undead or demons */
if (Is_weapon && otmp->blessed
&& (is_demon(ptr) || is_undead(ptr) || is_vampshifter(mon)))
if (Is_weapon && otmp->blessed && mon_hates_blessings(mon))
tmp += 2;
if (is_spear(otmp) && index(kebabable, ptr->mlet))
@@ -322,8 +321,7 @@ dmgval(struct obj *otmp, struct monst *mon)
|| otmp->oclass == CHAIN_CLASS) {
int bonus = 0;
if (otmp->blessed
&& (is_undead(ptr) || is_demon(ptr) || is_vampshifter(mon)))
if (otmp->blessed && mon_hates_blessings(mon))
bonus += rnd(4);
if (is_axe(otmp) && is_wooden(ptr))
bonus += rnd(4);
@@ -357,15 +355,15 @@ dmgval(struct obj *otmp, struct monst *mon)
/* check whether blessed and/or silver damage applies for *non-weapon* hit;
return value is the amount of the extra damage */
int
special_dmgval(struct monst *magr,
struct monst *mdef,
long armask, /* armor mask, multiple bits accepted for
W_ARMC|W_ARM|W_ARMU or
W_ARMG|W_RINGL|W_RINGR only */
long *silverhit_p) /* output flag mask for silver bonus */
special_dmgval(
struct monst *magr, /* attacker */
struct monst *mdef, /* defender */
long armask, /* armor mask, multiple bits accepted for
* W_ARMC|W_ARM|W_ARMU or
* W_ARMG|W_RINGL|W_RINGR only */
long *silverhit_p) /* output flag mask for silver bonus */
{
struct obj *obj;
struct permonst *ptr = mdef->data;
boolean left_ring = (armask & W_RINGL) ? TRUE : FALSE,
right_ring = (armask & W_RINGR) ? TRUE : FALSE;
long silverhit = 0L;
@@ -391,8 +389,7 @@ special_dmgval(struct monst *magr,
}
if (obj) {
if (obj->blessed
&& (is_undead(ptr) || is_demon(ptr) || is_vampshifter(mdef)))
if (obj->blessed && mon_hates_blessings(mdef))
bonus += rnd(4);
/* the only silver armor is shield of reflection (silver dragon
scales refer to color, not material) and the only way to hit