sunsword vs gremlin

The original report complained that gremlins seemed impervious to
Sunsword's light yet a flash from a camera caused them to cry out in pain
despite "The long sword named Sunsword begins to shine brilliantly!"

This commit does two things:
1. A dmg bonus is applied against gremlins using a lit Sunsword.
2. Gremlins will generally avoid the light emitted by Sunsword.
There's a few minor flavor bits thrown in also.

It is understood that this effectively makes Sunsword provide
"gremlin-proofing", but the gremlin myth and Sunsword's characteristic
feature pretty much demand it.

bug 42
This commit is contained in:
nhmall
2018-09-22 14:08:28 -04:00
parent 6a86cafa90
commit bbb81700f5
7 changed files with 65 additions and 4 deletions

View File

@@ -255,6 +255,14 @@ struct monst *mon;
}
}
#define flees_light(mon) ((mon)->data == &mons[PM_GREMLIN] && \
(uwep && artifact_light(uwep) && uwep->lamplit))
/* we could include this in the above macro, but probably overkill/overhead */
/* (!((which_armor((mon), W_ARMC) != 0) && ((which_armor((mon), W_ARMH) != 0))) && */
/* monster begins fleeing for the specified time, 0 means untimed flee
* if first, only adds fleetime if monster isn't already fleeing
* if fleemsg, prints a message about new flight, otherwise, caller should */
@@ -289,9 +297,15 @@ boolean fleemsg;
/* unfortunately we can't distinguish between temporary
sleep and temporary paralysis, so both conditions
receive the same alternate message */
if (!mtmp->mcanmove || !mtmp->data->mmove)
if (!mtmp->mcanmove || !mtmp->data->mmove) {
pline("%s seems to flinch.", Adjmonnam(mtmp, "immobile"));
else
} else if (flees_light(mtmp)) {
if (rn2(10) || Deaf)
pline("%s flees from the painful light of %s.",
Monnam(mtmp), bare_artifactname(uwep));
else
verbalize("Bright light!");
} else
pline("%s turns to flee.", Monnam(mtmp));
}
mtmp->mflee = 1;
@@ -306,7 +320,7 @@ register struct monst *mtmp;
int *inrange, *nearby, *scared;
{
int seescaryx, seescaryy;
boolean sawscary = FALSE;
boolean sawscary = FALSE, bravegremlin = (rn2(5) == 0);
*inrange = (dist2(mtmp->mx, mtmp->my, mtmp->mux, mtmp->muy)
<= (BOLT_LIM * BOLT_LIM));
@@ -329,6 +343,7 @@ int *inrange, *nearby, *scared;
sawscary = onscary(seescaryx, seescaryy, mtmp);
if (*nearby && (sawscary
|| (flees_light(mtmp) && !bravegremlin)
|| (!mtmp->mpeaceful && in_your_sanctuary(mtmp, 0, 0)))) {
*scared = 1;
monflee(mtmp, rnd(rn2(7) ? 10 : 100), TRUE, TRUE);
@@ -336,6 +351,8 @@ int *inrange, *nearby, *scared;
*scared = 0;
}
#undef flees_light
/* perform a special one-time action for a monster; returns -1 if nothing
special happened, 0 if monster uses up its turn, 1 if monster is killed */
STATIC_OVL int