]> granicus.if.org Git - nethack/commitdiff
PR #906 - loadstone confers 'steadfastness'
authorPatR <rankin@nethack.org>
Sun, 23 Oct 2022 06:57:05 +0000 (23:57 -0700)
committerPatR <rankin@nethack.org>
Sun, 23 Oct 2022 06:57:05 +0000 (23:57 -0700)
Pull request by Theyflower:  carrying a loadstone prevents big
monsters from hitting their target for knockback effect, same as
wielding Giantslayer.

The PR code needed fixing (unintended switch from 'otmp' to 'obj')
so I didn't use the commeit.  The PR code also required that the
loadstone be blessed which sounds nethackish but would mean that
nobody would ever notice.  Allow carrying any loadstone to prevent
being knocked back.  It will still be a rare accident or uncommon
tactical decision.  (It doesn't happen if the target is flying or
levitating because those checks deliberately come first.)

supersedes #906
closes #906

doc/fixes3-7-0.txt
src/uhitm.c

index 7b0f5de4ef763938fb0449440785cfb57b422927..33995e45381049fc65e15ceef06cd6fcb81f0e8f 100644 (file)
@@ -974,7 +974,8 @@ bigroom variant 2 may have ice floor in unlit areas
 some large monsters can knock back smaller monsters with a hit
 change Demonbane to a mace, make it the first sac gift for priests,
        and give it an invoke ability to banish demons
-wielding Giantslayer prevents knockback from larger monsters
+wielding Giantslayer prevents knockback from larger monsters; likewise for
+       carried loadstone(s)
 scared hostile monster which cannot move away will attack
 prevent a fog cloud that has engulfed the hero from moving under closed doors
 allow cutting a known spider web with wielded weapon by force-fighting the web
index c2fbd396ddb02bbb26b020b3b08a680630046f68..25041fd392a695c99d9dc949690ee8a49995e614 100644 (file)
@@ -4616,6 +4616,12 @@ m_is_steadfast(struct monst *mtmp)
 
     if (is_art(otmp, ART_GIANTSLAYER))
         return TRUE;
+
+    /* steadfast if carrying any loadstone (and not floating or flying) */
+    for (otmp = is_u ? g.invent : mtmp->minvent; otmp; otmp = otmp->nobj)
+        if (otmp->otyp == LOADSTONE)
+            return TRUE;
+
     return FALSE;
 }