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:
+17
-3
@@ -4625,10 +4625,14 @@ m_is_steadfast(struct monst *mtmp)
|
|||||||
if (is_art(otmp, ART_GIANTSLAYER))
|
if (is_art(otmp, ART_GIANTSLAYER))
|
||||||
return TRUE;
|
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)
|
for (otmp = is_u ? g.invent : mtmp->minvent; otmp; otmp = otmp->nobj)
|
||||||
if (otmp->otyp == LOADSTONE)
|
if (otmp->otyp == LOADSTONE)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
if (u.usteed && mtmp == u.usteed && carrying(LOADSTONE))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -4642,6 +4646,7 @@ mhitm_knockback(
|
|||||||
int *hitflags, /* modified if magr or mdef dies */
|
int *hitflags, /* modified if magr or mdef dies */
|
||||||
boolean weapon_used) /* True: via weapon hit */
|
boolean weapon_used) /* True: via weapon hit */
|
||||||
{
|
{
|
||||||
|
char magrbuf[BUFSZ], mdefbuf[BUFSZ];
|
||||||
struct obj *otmp;
|
struct obj *otmp;
|
||||||
boolean u_agr = (magr == &g.youmonst);
|
boolean u_agr = (magr == &g.youmonst);
|
||||||
boolean u_def = (mdef == &g.youmonst);
|
boolean u_def = (mdef == &g.youmonst);
|
||||||
@@ -4686,12 +4691,21 @@ mhitm_knockback(
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* steadfast defender cannot be pushed around */
|
/* 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;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* give the message */
|
/* give the message */
|
||||||
if (u_def || canseemon(mdef)) {
|
if (u_def || canseemon(mdef)) {
|
||||||
char magrbuf[BUFSZ], mdefbuf[BUFSZ];
|
|
||||||
boolean dosteed = u_def && u.usteed;
|
boolean dosteed = u_def && u.usteed;
|
||||||
|
|
||||||
Strcpy(magrbuf, u_agr ? "You" : Monnam(magr));
|
Strcpy(magrbuf, u_agr ? "You" : Monnam(magr));
|
||||||
|
|||||||
Reference in New Issue
Block a user