Sunsword #invoke, directed at self

Give a resistance animation if you #invoke Sunsword while it's
wielded and direct its blinding ray at yourself.  Flashing a camera
at a monster who is wielding it will also produce the animation.
This commit is contained in:
PatR
2024-04-19 10:50:46 -07:00
parent aaea81c6ac
commit 9d71c8e1f4
6 changed files with 60 additions and 33 deletions

View File

@@ -6097,17 +6097,17 @@ flash_hits_mon(
struct obj *otmp) /* source of flash */
{
struct rm *lev;
coordxy mx = mtmp->mx, my = mtmp->my;
int tmp, amt, useeit, res = 0;
if (gn.notonhead)
return 0;
lev = &levl[mtmp->mx][mtmp->my];
lev = &levl[mx][my];
useeit = canseemon(mtmp);
if (M_AP_TYPE(mtmp) != M_AP_NOTHING) {
char whatbuf[BUFSZ];
coordxy x = mtmp->mx, y = mtmp->my;
int oldglyph = glyph_at(x, y);
int oldglyph = glyph_at(mx, my);
/* 'altmon' probably doesn't matter here because 'whatbuf' will
only be shown if the glyph changes and wakeup() doesn't call
@@ -6118,13 +6118,14 @@ flash_hits_mon(
* finish_meating() to end quickmimic */
/* if glyph has changed then hero saw something happen */
if (glyph_at(x, y) != oldglyph)
if (glyph_at(mx, my) != oldglyph) {
pline("That %s is really %s%c", whatbuf,
/* y_monnam()+a_monnam() */
x_monnam(mtmp, mtmp->mtame ? ARTICLE_YOUR : ARTICLE_A,
(char *) 0, 0, FALSE),
mtmp->mtame ? '.' : '!');
res = 1; /* mtmp is affected whether hero sees it or not */
res = 1;
}
}
if (mtmp->msleeping && haseyes(mtmp->data)) {
@@ -6135,15 +6136,15 @@ flash_hits_mon(
}
} else if (mtmp->data->mlet != S_LIGHT) {
if (!resists_blnd(mtmp)) {
tmp = dist2(otmp->ox, otmp->oy, mtmp->mx, mtmp->my);
tmp = dist2(otmp->ox, otmp->oy, mx, my);
if (useeit) {
pline("%s is blinded by the flash!", Monnam(mtmp));
res = 1;
}
if (mtmp->data == &mons[PM_GREMLIN]) {
/* Rule #1: Keep them out of the light. */
amt = otmp->otyp == WAN_LIGHT ? d(1 + otmp->spe, 4)
: rn2(min(mtmp->mhp, 4));
amt = (otmp->otyp == WAN_LIGHT) ? d(1 + otmp->spe, 4)
: rnd(min(mtmp->mhp, 4));
light_hits_gremlin(mtmp, amt);
}
if (!DEADMONSTER(mtmp)) {
@@ -6154,12 +6155,16 @@ flash_hits_mon(
mtmp->mcansee = 0;
mtmp->mblinded = (tmp < 3) ? 0 : rnd(1 + 50 / tmp);
}
} else if (flags.verbose && useeit) {
if (lev->lit)
pline("The flash of light shines on %s.", mon_nam(mtmp));
else
pline("%s is illuminated.", Monnam(mtmp));
res = 2; /* 'message has been given' temporary value */
} else if (useeit) {
if (resists_blnd_by_arti(mtmp))
shieldeff(mx, my);
if (flags.verbose) {
if (lev->lit)
pline("The flash of light shines on %s.", mon_nam(mtmp));
else
pline("%s is illuminated.", Monnam(mtmp));
res = 2; /* 'message has been given' temporary value */
}
}
}
if (res) {