From 599edde94d13a462430d94f8f6b7122826a314c2 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 28 Aug 2018 17:41:18 +0300 Subject: [PATCH] Fix monsters not wielding digging implements My change to unify the pet and monster digging weapon choosing made monsters not actually wield the chosen weapon, even though they could still dig as if they did. Pets behaved properly. Also add an explicit check for IS_STWALL so they won't keep switching away from their current weapon until needed. --- doc/fixes36.2 | 1 + src/monmove.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 92bbd1770..0d95c8fde 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -99,6 +99,7 @@ prevent wish prompt input from remembering the previous wish parchment and vellum are made from animal skin so change material composition and color for spellbooks with those descriptions from paper to leather; eating those books now breaks vegetarian conduct +fix monsters not wielding digging implements Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/monmove.c b/src/monmove.c index cdef76f89..99efdbbbf 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -716,25 +716,25 @@ struct monst *mtmp; xchar nix,niy; { boolean can_tunnel = 0; - struct obj *mw_tmp; + struct obj *mw_tmp = MON_WEP(mtmp); if (!Is_rogue_level(&u.uz)) can_tunnel = tunnels(mtmp->data); - if (can_tunnel && needspick(mtmp->data) - && mtmp->weapon_check != NO_WEAPON_WANTED - && ((IS_ROCK(levl[nix][niy].typ) && may_dig(nix, niy)) - || closed_door(nix, niy))) { + if (can_tunnel && needspick(mtmp->data) && !mwelded(mw_tmp) + && (may_dig(nix, niy) || closed_door(nix, niy))) { + /* may_dig() is either IS_STWALL or IS_TREE */ if (closed_door(nix, niy)) { - if (!(mw_tmp = MON_WEP(mtmp)) + if (!mw_tmp || !is_pick(mw_tmp) || !is_axe(mw_tmp)) mtmp->weapon_check = NEED_PICK_OR_AXE; } else if (IS_TREE(levl[nix][niy].typ)) { if (!(mw_tmp = MON_WEP(mtmp)) || !is_axe(mw_tmp)) mtmp->weapon_check = NEED_AXE; - } else if (!(mw_tmp = MON_WEP(mtmp)) || !is_pick(mw_tmp)) { - mtmp->weapon_check = NEED_PICK_AXE; + } else if (IS_STWALL(levl[nix][niy].typ)) { + if (!(mw_tmp = MON_WEP(mtmp)) || !is_pick(mw_tmp)) + mtmp->weapon_check = NEED_PICK_AXE; } if (mtmp->weapon_check >= NEED_PICK_AXE && mon_wield_item(mtmp)) return TRUE;