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.
This commit is contained in:
Pasi Kallinen
2018-08-28 17:41:18 +03:00
parent 95b9205168
commit 599edde94d
2 changed files with 9 additions and 8 deletions

View File

@@ -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

View File

@@ -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;