Wielding Giantslayer prevents knockback from monsters

This commit is contained in:
Pasi Kallinen
2022-07-20 14:44:15 +03:00
parent ced920df54
commit 8a52716936
2 changed files with 22 additions and 0 deletions
+1
View File
@@ -974,6 +974,7 @@ bigroom variant 2 may have ice floor in unlit areas
some large monsters can knock back smaller monsters with a hit some large monsters can knock back smaller monsters with a hit
change Demonbane to a mace, make it the first sac gift for priests, change Demonbane to a mace, make it the first sac gift for priests,
and give it an invoke ability to banish demons and give it an invoke ability to banish demons
wielding Giantslayer prevents knockback from larger monsters
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
+21
View File
@@ -22,6 +22,7 @@ static boolean m_slips_free(struct monst *, struct attack *);
static void start_engulf(struct monst *); static void start_engulf(struct monst *);
static void end_engulf(void); static void end_engulf(void);
static int gulpum(struct monst *, struct attack *); static int gulpum(struct monst *, struct attack *);
static boolean m_is_steadfast(struct monst *);
static boolean hmonas(struct monst *); static boolean hmonas(struct monst *);
static void nohandglow(struct monst *); static void nohandglow(struct monst *);
static boolean mhurtle_to_doom(struct monst *, int, struct permonst **); static boolean mhurtle_to_doom(struct monst *, int, struct permonst **);
@@ -4551,6 +4552,22 @@ missum(struct monst *mdef, struct attack *mattk, boolean wouldhavehit)
wakeup(mdef, TRUE); wakeup(mdef, TRUE);
} }
static boolean
m_is_steadfast(struct monst *mtmp)
{
boolean is_u = (mtmp == &g.youmonst);
struct obj *otmp = is_u ? uwep : MON_WEP(mtmp);
/* must be on the ground */
if ((is_u && (Flying || Levitation))
|| (!is_u && (is_flyer(mtmp->data) || is_floater(mtmp->data))))
return FALSE;
if (otmp && otmp->oartifact == ART_GIANTSLAYER)
return TRUE;
return FALSE;
}
/* monster hits another monster hard enough to knock it back? */ /* monster hits another monster hard enough to knock it back? */
boolean boolean
mhitm_knockback(struct monst *magr, mhitm_knockback(struct monst *magr,
@@ -4588,6 +4605,10 @@ mhitm_knockback(struct monst *magr,
if ((u_agr || u_def) && !(*hitflags & MM_HIT)) if ((u_agr || u_def) && !(*hitflags & MM_HIT))
return FALSE; return FALSE;
/* steadfast defender cannot be pushed around */
if (m_is_steadfast(mdef))
return FALSE;
/* give the message */ /* give the message */
if (u_def || canseemon(mdef)) { if (u_def || canseemon(mdef)) {
boolean dosteed = u_def && u.usteed; boolean dosteed = u_def && u.usteed;