| 2278 | } |
| 2279 | |
| 2280 | void |
| 2281 | mhitm_ad_rust( |
| 2282 | struct monst *magr, struct attack *mattk, |
| 2283 | struct monst *mdef, struct mhitm_data *mhm) |
| 2284 | { |
| 2285 | struct permonst *pd = mdef->data; |
| 2286 | |
| 2287 | if (magr == &gy.youmonst) { |
| 2288 | /* uhitm */ |
| 2289 | if (completelyrusts(pd)) { /* iron golem */ |
| 2290 | /* note: the life-saved case is hypothetical because |
| 2291 | life-saving doesn't work for golems */ |
| 2292 | pline("%s %s to pieces!", Monnam(mdef), |
| 2293 | !mlifesaver(mdef) ? "falls" : "starts to fall"); |
| 2294 | xkilled(mdef, XKILL_NOMSG); |
| 2295 | mhm->hitflags |= M_ATTK_DEF_DIED; |
| 2296 | } |
| 2297 | erode_armor(mdef, ERODE_RUST); |
| 2298 | mhm->damage = 0; /* damageum(), int tmp */ |
| 2299 | } else if (mdef == &gy.youmonst) { |
| 2300 | /* mhitu */ |
| 2301 | hitmsg(magr, mattk); |
| 2302 | if (magr->mcan) { |
| 2303 | return; |
| 2304 | } |
| 2305 | if (completelyrusts(pd)) { |
| 2306 | You("rust!"); |
| 2307 | /* KMH -- this is okay with unchanging */ |
| 2308 | rehumanize(); |
| 2309 | return; |
| 2310 | } |
| 2311 | erode_armor(&gy.youmonst, ERODE_RUST); |
| 2312 | } else { |
| 2313 | /* mhitm */ |
| 2314 | if (magr->mcan) |
| 2315 | return; |
| 2316 | if (completelyrusts(pd)) { /* PM_IRON_GOLEM */ |
| 2317 | if (gv.vis && canseemon(mdef)) |
| 2318 | pline_mon(mdef, "%s %s to pieces!", Monnam(mdef), |
| 2319 | !mlifesaver(mdef) ? "falls" : "starts to fall"); |
| 2320 | monkilled(mdef, (char *) 0, AD_RUST); |
| 2321 | if (!DEADMONSTER(mdef)) { |
| 2322 | mhm->hitflags = M_ATTK_MISS; |
| 2323 | mhm->done = TRUE; |
| 2324 | return; |
| 2325 | } |
| 2326 | mhm->hitflags = (M_ATTK_DEF_DIED | (grow_up(magr, mdef) ? 0 |
| 2327 | : M_ATTK_AGR_DIED)); |
| 2328 | mhm->done = TRUE; |
| 2329 | return; |
| 2330 | } |
| 2331 | erode_armor(mdef, ERODE_RUST); |
| 2332 | mdef->mstrategy &= ~STRAT_WAITFORU; |
| 2333 | mhm->damage = 0; /* mdamagem(), int tmp */ |
| 2334 | } |
| 2335 | } |
| 2336 | |
| 2337 | void |
no test coverage detected