Unify pet and monster digging item checks

This commit is contained in:
Pasi Kallinen
2016-05-19 18:46:25 +03:00
parent de716ec533
commit 0db1e1ca38
3 changed files with 39 additions and 33 deletions

View File

@@ -888,23 +888,9 @@ newdogpos:
}
if (!m_in_out_region(mtmp, nix, niy))
return 1;
if (((IS_ROCK(levl[nix][niy].typ) && may_dig(nix, niy))
|| closed_door(nix, niy))
&& mtmp->weapon_check != NO_WEAPON_WANTED
&& tunnels(mtmp->data) && needspick(mtmp->data)) {
if (closed_door(nix, niy)) {
if (!(mw_tmp = MON_WEP(mtmp)) || !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;
}
if (mtmp->weapon_check >= NEED_PICK_AXE && mon_wield_item(mtmp))
return 0;
}
if (m_digweapon_check(mtmp, nix,niy))
return 0;
/* insert a worm_move() if worms ever begin to eat things */
wasseen = canseemon(mtmp);
remove_monster(omx, omy);