check whether equipment protects against knockback */
| 5215 | |
| 5216 | /* check whether equipment protects against knockback */ |
| 5217 | boolean |
| 5218 | m_is_steadfast(struct monst *mtmp) |
| 5219 | { |
| 5220 | boolean is_u = (mtmp == &gy.youmonst); |
| 5221 | struct obj *otmp = is_u ? uwep : MON_WEP(mtmp); |
| 5222 | |
| 5223 | /* must be on the ground (or in water) */ |
| 5224 | if ((is_u ? (Flying || Levitation) |
| 5225 | : (is_flyer(mtmp->data) || is_floater(mtmp->data))) |
| 5226 | || Is_airlevel(&u.uz) /* air or cloud */ |
| 5227 | || (Is_waterlevel(&u.uz) && !is_pool(u.ux, u.uy))) /* air bubble */ |
| 5228 | return FALSE; |
| 5229 | |
| 5230 | if (is_art(otmp, ART_GIANTSLAYER)) |
| 5231 | return TRUE; |
| 5232 | |
| 5233 | /* steadfast if carrying any loadstone (and not floating or flying); |
| 5234 | 'is_u' test not needed here; m_carrying() is 'youmonst' aware */ |
| 5235 | if (m_carrying(mtmp, LOADSTONE)) |
| 5236 | return TRUE; |
| 5237 | /* when mounted and steed is target of knockback, check the rider for |
| 5238 | a loadstone too (Giantslayer's protection doesn't extend to steed) */ |
| 5239 | if (u.usteed && mtmp == u.usteed && carrying(LOADSTONE)) |
| 5240 | return TRUE; |
| 5241 | |
| 5242 | return FALSE; |
| 5243 | } |
| 5244 | |
| 5245 | /* monster hits another monster hard enough to knock it back? */ |
| 5246 | boolean |
no test coverage detected