"<mon> hits [again]"
Add "again" to the hit message when an attack sequence has
consecutive attacks of same type and they hit. A {bite, claw, claw}
sequence won't give that for first claw attack regardless of whether
the bite hits but will give it for the second claw attack when both
of the claw attacks hit.
The message sequence
|The fire ant bites! The fire ant bites! You're on fire!
or |The fire ant bites! The fire ant bites! You avoid harm.
when the first bite was for physical damage and the second was
for fire damage seemed a little confusing.
This changes that to be
|The fire ant bites! The fire ant bites again! You're on fire!
or |The fire ant bites! The fire ant bites again! You avoid harm.
It still isn't crystal clear that both bites are from a single
attack and that the second bite is for different type of damage
but I think it's an improvement.
This commit is contained in:
@@ -1020,6 +1020,10 @@ struct instance_globals_h {
|
||||
/* dog.c */
|
||||
char horsename[PL_PSIZ];
|
||||
|
||||
/* mhitu.c */
|
||||
unsigned hitmsg_mid;
|
||||
struct attack *hitmsg_prev;
|
||||
|
||||
boolean havestate;
|
||||
unsigned long magic; /* validate that structure layout is preserved */
|
||||
};
|
||||
|
||||
@@ -414,6 +414,9 @@ const struct instance_globals_h g_init_h = {
|
||||
* higher if polymorphed into something that's even faster */
|
||||
/* dog.c */
|
||||
DUMMY, /* horsename */
|
||||
/* mhitu.c */
|
||||
0U, /* hitmsg_mid */
|
||||
NULL, /* hitmsg_prev */
|
||||
/* save.c */
|
||||
TRUE, /* havestate*/
|
||||
IVMAGIC /* h_magic to validate that structure layout has been preserved */
|
||||
|
||||
43
src/mhitu.c
43
src/mhitu.c
@@ -23,17 +23,16 @@ static int passiveum(struct permonst *, struct monst *, struct attack *);
|
||||
|
||||
#define ld() ((yyyymmdd((time_t) 0) - (getyear() * 10000L)) == 0xe5)
|
||||
|
||||
DISABLE_WARNING_FORMAT_NONLITERAL
|
||||
|
||||
/* monster hits hero (most callers have been moved to uthim.c) */
|
||||
void
|
||||
hitmsg(struct monst *mtmp, struct attack *mattk)
|
||||
{
|
||||
int compat;
|
||||
const char *pfmt = 0;
|
||||
const char *verb = 0, *again, *punct = "!";
|
||||
char *Monst_name = Monnam(mtmp);
|
||||
|
||||
/* Note: if opposite gender, "seductively" */
|
||||
/* If same gender, "engagingly" for nymph, normal msg for others */
|
||||
/* Note: if opposite gender, "seductively";
|
||||
if same gender, "engagingly" for nymph, normal msg for others. */
|
||||
if ((compat = could_seduce(mtmp, &gy.youmonst, mattk)) != 0
|
||||
&& !mtmp->mcan && !mtmp->mspec_used) {
|
||||
pline("%s %s you %s.", Monst_name,
|
||||
@@ -42,43 +41,51 @@ hitmsg(struct monst *mtmp, struct attack *mattk)
|
||||
} else {
|
||||
switch (mattk->aatyp) {
|
||||
case AT_BITE:
|
||||
pfmt = "%s bites!";
|
||||
verb = "bites";
|
||||
break;
|
||||
case AT_KICK:
|
||||
pline("%s kicks%c", Monst_name,
|
||||
thick_skinned(gy.youmonst.data) ? '.' : '!');
|
||||
if (thick_skinned(gy.youmonst.data))
|
||||
punct = ".";
|
||||
verb = "kicks";
|
||||
break;
|
||||
case AT_STNG:
|
||||
pfmt = "%s stings!";
|
||||
verb = "stings";
|
||||
break;
|
||||
case AT_BUTT:
|
||||
pfmt = "%s butts!";
|
||||
verb = "butts";
|
||||
break;
|
||||
case AT_TUCH:
|
||||
pfmt = "%s touches you!";
|
||||
verb = "touches you";
|
||||
break;
|
||||
case AT_TENT:
|
||||
pfmt = "%s tentacles suck you!";
|
||||
verb = "tentacles suck your brain";
|
||||
Monst_name = s_suffix(Monst_name);
|
||||
break;
|
||||
case AT_EXPL:
|
||||
case AT_BOOM:
|
||||
pfmt = "%s explodes!";
|
||||
verb = "explodes";
|
||||
break;
|
||||
default:
|
||||
pfmt = "%s hits!";
|
||||
verb = "hits";
|
||||
}
|
||||
if (pfmt)
|
||||
pline(pfmt, Monst_name);
|
||||
/* if a monster hits more than once with similar attack, say so */
|
||||
again = (mtmp->m_id == gh.hitmsg_mid
|
||||
&& gh.hitmsg_prev != NULL
|
||||
&& mattk == gh.hitmsg_prev + 1
|
||||
&& mattk->aatyp == gh.hitmsg_prev->aatyp) ? " again" : "";
|
||||
pline("%s %s%s%s", Monst_name, verb, again, punct);
|
||||
}
|
||||
gh.hitmsg_mid = mtmp->m_id;
|
||||
gh.hitmsg_prev = mattk;
|
||||
}
|
||||
|
||||
RESTORE_WARNING_FORMAT_NONLITERAL
|
||||
|
||||
/* monster missed you */
|
||||
static void
|
||||
missmu(struct monst *mtmp, boolean nearmiss, struct attack *mattk)
|
||||
{
|
||||
gh.hitmsg_mid = 0;
|
||||
gh.hitmsg_prev = NULL;
|
||||
|
||||
if (!canspotmon(mtmp))
|
||||
map_invisible(mtmp->mx, mtmp->my);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user