From 86cbf9366aa1058ac85018131f4f7b7065a11624 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 22 Oct 2022 23:57:05 -0700 Subject: [PATCH] PR #906 - loadstone confers 'steadfastness' 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 | 3 ++- src/uhitm.c | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 7b0f5de4e..33995e453 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -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 diff --git a/src/uhitm.c b/src/uhitm.c index c2fbd396d..25041fd39 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -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; }