MCPcopy Create free account
hub / github.com/NetHack/NetHack / mhitm_ad_rust

Function mhitm_ad_rust

src/uhitm.c:2280–2335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2278}
2279
2280void
2281mhitm_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
2337void

Callers 1

mhitm_adtypingFunction · 0.85

Calls 12

MonnamFunction · 0.85
mlifesaverFunction · 0.85
xkilledFunction · 0.85
erode_armorFunction · 0.85
hitmsgFunction · 0.85
YouFunction · 0.85
rehumanizeFunction · 0.85
canseemonFunction · 0.85
pline_monFunction · 0.85
monkilledFunction · 0.85
grow_upFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected