Sparkle shield effect and accessibility

When sparkle is turned off, there are some places where
a monster resisting the effect did not give any message.

This fixes some of those.
This commit is contained in:
Pasi Kallinen
2024-12-14 14:34:19 +02:00
parent b2b9b685c5
commit fd23463941
5 changed files with 18 additions and 8 deletions

View File

@@ -1782,6 +1782,7 @@ extern void mimic_hit_msg(struct monst *, short);
extern void adj_erinys(unsigned);
extern void see_monster_closeup(struct monst *) NONNULLARG1;
extern void see_nearby_monsters(void);
extern void shieldeff_mon(struct monst *) NONNULLARG1;
/* ### mondata.c ### */

View File

@@ -1137,7 +1137,7 @@ mon_poly(struct monst *magr, struct monst *mdef, int dmg)
if (resists_magm(mdef)) {
/* Magic resistance */
if (gv.vis)
shieldeff(mdef->mx, mdef->my);
shieldeff_mon(mdef);
} else if (resist(mdef, WAND_CLASS, 0, TELL)) {
/* general resistance to magic... */
;

View File

@@ -5838,4 +5838,15 @@ see_nearby_monsters(void)
}
}
/* monster resists something.
make a shield effect at monster's location and give a message */
void
shieldeff_mon(struct monst *mtmp)
{
shieldeff(mtmp->mx, mtmp->my);
/* does not depend on seeing the monster; the shield effect is visible */
if (cansee(mtmp->mx, mtmp->my))
pline_xy(mtmp->mx, mtmp->my, "%s resists!", Monnam(mtmp));
}
/*mon.c*/

View File

@@ -2444,7 +2444,7 @@ trapeffect_poly_trap(
boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
if (resists_magm(mtmp)) {
shieldeff(mtmp->mx, mtmp->my);
shieldeff_mon(mtmp);
} else if (!resist(mtmp, WAND_CLASS, 0, NOTELL)) {
(void) newcham(mtmp, (struct permonst *) 0, NC_SHOW_MSG);
if (in_sight)

View File

@@ -265,7 +265,7 @@ bhitm(struct monst *mtmp, struct obj *otmp)
} else if (resists_magm(mtmp)) {
/* magic resistance protects from polymorph traps, so make
it guard against involuntary polymorph attacks too... */
shieldeff(mtmp->mx, mtmp->my);
shieldeff_mon(mtmp);
} else if (!resist(mtmp, otmp->oclass, 0, NOTELL)) {
boolean polyspot = (otyp != POT_POLYMORPH),
give_msg = (!Hallucination
@@ -510,7 +510,7 @@ bhitm(struct monst *mtmp, struct obj *otmp)
if (otyp == SPE_DRAIN_LIFE)
dmg = spell_damage_bonus(dmg);
if (resists_drli(mtmp)) {
shieldeff(mtmp->mx, mtmp->my);
shieldeff_mon(mtmp);
} else if (!resist(mtmp, otmp->oclass, dmg, NOTELL)
&& !DEADMONSTER(mtmp)) {
mtmp->mhp -= dmg;
@@ -6068,10 +6068,8 @@ resist(struct monst *mtmp, char oclass, int damage, int tell)
resisted = rn2(100 + alev - dlev) < mtmp->data->mr;
if (resisted) {
if (tell) {
shieldeff(mtmp->mx, mtmp->my);
pline("%s resists!", Monnam(mtmp));
}
if (tell)
shieldeff_mon(mtmp);
damage = (damage + 1) / 2;
}