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:22 +02:00
parent b2b9b685c5
commit fd23463941
5 changed files with 18 additions and 8 deletions
+1
View File
@@ -1782,6 +1782,7 @@ extern void mimic_hit_msg(struct monst *, short);
extern void adj_erinys(unsigned); extern void adj_erinys(unsigned);
extern void see_monster_closeup(struct monst *) NONNULLARG1; extern void see_monster_closeup(struct monst *) NONNULLARG1;
extern void see_nearby_monsters(void); extern void see_nearby_monsters(void);
extern void shieldeff_mon(struct monst *) NONNULLARG1;
/* ### mondata.c ### */ /* ### mondata.c ### */
+1 -1
View File
@@ -1137,7 +1137,7 @@ mon_poly(struct monst *magr, struct monst *mdef, int dmg)
if (resists_magm(mdef)) { if (resists_magm(mdef)) {
/* Magic resistance */ /* Magic resistance */
if (gv.vis) if (gv.vis)
shieldeff(mdef->mx, mdef->my); shieldeff_mon(mdef);
} else if (resist(mdef, WAND_CLASS, 0, TELL)) { } else if (resist(mdef, WAND_CLASS, 0, TELL)) {
/* general resistance to magic... */ /* general resistance to magic... */
; ;
+11
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*/ /*mon.c*/
+1 -1
View File
@@ -2444,7 +2444,7 @@ trapeffect_poly_trap(
boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed); boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
if (resists_magm(mtmp)) { if (resists_magm(mtmp)) {
shieldeff(mtmp->mx, mtmp->my); shieldeff_mon(mtmp);
} else if (!resist(mtmp, WAND_CLASS, 0, NOTELL)) { } else if (!resist(mtmp, WAND_CLASS, 0, NOTELL)) {
(void) newcham(mtmp, (struct permonst *) 0, NC_SHOW_MSG); (void) newcham(mtmp, (struct permonst *) 0, NC_SHOW_MSG);
if (in_sight) if (in_sight)
+4 -6
View File
@@ -265,7 +265,7 @@ bhitm(struct monst *mtmp, struct obj *otmp)
} else if (resists_magm(mtmp)) { } else if (resists_magm(mtmp)) {
/* magic resistance protects from polymorph traps, so make /* magic resistance protects from polymorph traps, so make
it guard against involuntary polymorph attacks too... */ it guard against involuntary polymorph attacks too... */
shieldeff(mtmp->mx, mtmp->my); shieldeff_mon(mtmp);
} else if (!resist(mtmp, otmp->oclass, 0, NOTELL)) { } else if (!resist(mtmp, otmp->oclass, 0, NOTELL)) {
boolean polyspot = (otyp != POT_POLYMORPH), boolean polyspot = (otyp != POT_POLYMORPH),
give_msg = (!Hallucination give_msg = (!Hallucination
@@ -510,7 +510,7 @@ bhitm(struct monst *mtmp, struct obj *otmp)
if (otyp == SPE_DRAIN_LIFE) if (otyp == SPE_DRAIN_LIFE)
dmg = spell_damage_bonus(dmg); dmg = spell_damage_bonus(dmg);
if (resists_drli(mtmp)) { if (resists_drli(mtmp)) {
shieldeff(mtmp->mx, mtmp->my); shieldeff_mon(mtmp);
} else if (!resist(mtmp, otmp->oclass, dmg, NOTELL) } else if (!resist(mtmp, otmp->oclass, dmg, NOTELL)
&& !DEADMONSTER(mtmp)) { && !DEADMONSTER(mtmp)) {
mtmp->mhp -= dmg; 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; resisted = rn2(100 + alev - dlev) < mtmp->data->mr;
if (resisted) { if (resisted) {
if (tell) { if (tell)
shieldeff(mtmp->mx, mtmp->my); shieldeff_mon(mtmp);
pline("%s resists!", Monnam(mtmp));
}
damage = (damage + 1) / 2; damage = (damage + 1) / 2;
} }