have monster wield a pick-axe if it wants to dig and it has one; return True if it spends this move wielding one, False otherwise */
| 1105 | /* have monster wield a pick-axe if it wants to dig and it has one; |
| 1106 | return True if it spends this move wielding one, False otherwise */ |
| 1107 | boolean |
| 1108 | m_digweapon_check( |
| 1109 | struct monst *mtmp, |
| 1110 | coordxy nix, coordxy niy) |
| 1111 | { |
| 1112 | boolean can_tunnel = FALSE; |
| 1113 | struct obj *mw_tmp = MON_WEP(mtmp); |
| 1114 | |
| 1115 | if (!Is_rogue_level(&u.uz)) |
| 1116 | can_tunnel = tunnels(mtmp->data); |
| 1117 | |
| 1118 | if (can_tunnel && needspick(mtmp->data) && !mwelded(mw_tmp) |
| 1119 | && (may_dig(nix, niy) || closed_door(nix, niy))) { |
| 1120 | /* may_dig() is either IS_STWALL or IS_TREE */ |
| 1121 | if (closed_door(nix, niy)) { |
| 1122 | if (!mw_tmp || !is_pick(mw_tmp) || !is_axe(mw_tmp)) |
| 1123 | mtmp->weapon_check = NEED_PICK_OR_AXE; |
| 1124 | } else if (IS_TREE(levl[nix][niy].typ)) { |
| 1125 | if (!mw_tmp || !is_axe(mw_tmp)) |
| 1126 | mtmp->weapon_check = NEED_AXE; |
| 1127 | } else if (IS_STWALL(levl[nix][niy].typ)) { |
| 1128 | if (!mw_tmp || !is_pick(mw_tmp)) |
| 1129 | mtmp->weapon_check = NEED_PICK_AXE; |
| 1130 | } |
| 1131 | if (mtmp->weapon_check >= NEED_PICK_AXE && mon_wield_item(mtmp)) |
| 1132 | return TRUE; |
| 1133 | } |
| 1134 | return FALSE; |
| 1135 | } |
| 1136 | |
| 1137 | /* does leprechaun want to avoid the hero? */ |
| 1138 | staticfn boolean |
no test coverage detected