more PR #906 - steadfastness
If someone gets hit for a knockback effect but resists it due to wielding Giantslayer or carrying a loadstone, give feedback saying so, otherwise the lack of knockback is indistinguishable from an ordinary hit. The message is not likely to appear for non-hero target since that target needs to have special equipment. A hero wielding Giantslayer might see it enough for the player to become annoyed; if so, MSGTYPE=hide could be used to suppress it.
This commit is contained in:
20
src/uhitm.c
20
src/uhitm.c
@@ -4625,10 +4625,14 @@ m_is_steadfast(struct monst *mtmp)
|
||||
if (is_art(otmp, ART_GIANTSLAYER))
|
||||
return TRUE;
|
||||
|
||||
/* steadfast if carrying any loadstone (and not floating or flying) */
|
||||
/* steadfast if carrying any loadstone (and not floating or flying);
|
||||
when mounted and steed is target of knockback, check the rider
|
||||
for a loadstone too */
|
||||
for (otmp = is_u ? g.invent : mtmp->minvent; otmp; otmp = otmp->nobj)
|
||||
if (otmp->otyp == LOADSTONE)
|
||||
return TRUE;
|
||||
if (u.usteed && mtmp == u.usteed && carrying(LOADSTONE))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -4642,6 +4646,7 @@ mhitm_knockback(
|
||||
int *hitflags, /* modified if magr or mdef dies */
|
||||
boolean weapon_used) /* True: via weapon hit */
|
||||
{
|
||||
char magrbuf[BUFSZ], mdefbuf[BUFSZ];
|
||||
struct obj *otmp;
|
||||
boolean u_agr = (magr == &g.youmonst);
|
||||
boolean u_def = (mdef == &g.youmonst);
|
||||
@@ -4686,12 +4691,21 @@ mhitm_knockback(
|
||||
return FALSE;
|
||||
|
||||
/* steadfast defender cannot be pushed around */
|
||||
if (m_is_steadfast(mdef))
|
||||
if (m_is_steadfast(mdef)) {
|
||||
if (u_def || (u.usteed && mdef == u.usteed)) {
|
||||
mdefbuf[0] = '\0';
|
||||
if (u.usteed)
|
||||
Snprintf(mdefbuf, sizeof mdefbuf, "and %s ",
|
||||
y_monnam(u.usteed));
|
||||
You("%sdon't budge.", mdefbuf);
|
||||
} else if (canseemon(mdef)) {
|
||||
pline("%s doesn't budge.", Monnam(mdef));
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* give the message */
|
||||
if (u_def || canseemon(mdef)) {
|
||||
char magrbuf[BUFSZ], mdefbuf[BUFSZ];
|
||||
boolean dosteed = u_def && u.usteed;
|
||||
|
||||
Strcpy(magrbuf, u_agr ? "You" : Monnam(magr));
|
||||
|
||||
Reference in New Issue
Block a user