From: Pasi Kallinen Date: Tue, 1 Dec 2020 17:17:26 +0000 (+0200) Subject: Make return values use defines X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b797baba7a96d45d4eb3b26712830ebaead72cd4;p=nethack Make return values use defines --- diff --git a/include/extern.h b/include/extern.h index fb348d6da..b8b73c1ff 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2801,7 +2801,7 @@ E boolean FDECL(do_stone_u, (struct monst *)); E void FDECL(do_stone_mon, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); E int FDECL(damageum, (struct monst *, struct attack *, int)); E void FDECL(missum, (struct monst *, struct attack *, BOOLEAN_P)); -E int FDECL(passive, (struct monst *, struct obj *, BOOLEAN_P, int, +E int FDECL(passive, (struct monst *, struct obj *, BOOLEAN_P, BOOLEAN_P, UCHAR_P, BOOLEAN_P)); E void FDECL(passive_obj, (struct monst *, struct obj *, struct attack *)); E void FDECL(stumble_onto_mimic, (struct monst *)); diff --git a/include/monattk.h b/include/monattk.h index b78ec6fe6..98975e5db 100644 --- a/include/monattk.h +++ b/include/monattk.h @@ -104,5 +104,6 @@ struct mhitm_data { #define MM_HIT 0x1 /* aggressor hit defender */ #define MM_DEF_DIED 0x2 /* defender died */ #define MM_AGR_DIED 0x4 /* aggressor died */ +#define MM_AGR_DONE 0x8 /* aggressor is done with their turn */ #endif /* MONATTK_H */ diff --git a/src/mhitm.c b/src/mhitm.c index 7c0b2c913..5c3b5a43a 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -267,6 +267,7 @@ boolean quietly; * / / / * x x x * + * 0x8 MM_AGR_DONE * 0x4 MM_AGR_DIED * 0x2 MM_DEF_DIED * 0x1 MM_HIT @@ -367,7 +368,7 @@ register struct monst *magr, *mdef; case AT_WEAP: /* "hand to hand" attacks */ if (distmin(magr->mx, magr->my, mdef->mx, mdef->my) > 1) { /* D: Do a ranged attack here! */ - strike = thrwmm(magr, mdef); + strike = (thrwmm(magr, mdef) == MM_MISS) ? 0 : 1; if (strike) /* don't really know if we hit or not; pretend we did */ res[i] |= MM_HIT; @@ -380,7 +381,7 @@ register struct monst *magr, *mdef; if (magr->weapon_check == NEED_WEAPON || !MON_WEP(magr)) { magr->weapon_check = NEED_HTH_WEAPON; if (mon_wield_item(magr) != 0) - return 0; + return MM_MISS; } possibly_unwield(magr, FALSE); if ((mwep = MON_WEP(magr)) != 0) { @@ -489,7 +490,7 @@ register struct monst *magr, *mdef; case AT_BREA: if (!monnear(magr, mdef->mx, mdef->my)) { - strike = breamm(magr, mattk, mdef); + strike = (breamm(magr, mattk, mdef) == MM_MISS) ? 0 : 1; /* We don't really know if we hit or not; pretend we did. */ if (strike) @@ -505,7 +506,7 @@ register struct monst *magr, *mdef; case AT_SPIT: if (!monnear(magr, mdef->mx, mdef->my)) { - strike = spitmm(magr, mattk, mdef); + strike = (spitmm(magr, mattk, mdef) == MM_MISS) ? 0 : 1; /* We don't really know if we hit or not; pretend we did. */ if (strike) @@ -1107,9 +1108,9 @@ struct obj *otemp; * handled above. Returns same values as mattackm. */ static int -passivemm(magr, mdef, mhit, mdead, mwep) +passivemm(magr, mdef, mhitb, mdead, mwep) register struct monst *magr, *mdef; -boolean mhit; +boolean mhitb; int mdead; struct obj *mwep; { @@ -1117,6 +1118,7 @@ struct obj *mwep; register struct permonst *madat = magr->data; char buf[BUFSZ]; int i, tmp; + int mhit = mhitb ? MM_HIT : MM_MISS; for (i = 0;; i++) { if (i >= NATTK) @@ -1134,7 +1136,7 @@ struct obj *mwep; /* These affect the enemy even if defender killed */ switch (mddat->mattk[i].adtyp) { case AD_ACID: - if (mhit && !rn2(2)) { + if (mhitb && !rn2(2)) { Strcpy(buf, Monnam(magr)); if (canseemon(magr)) pline("%s is splashed by %s %s!", buf, @@ -1152,7 +1154,7 @@ struct obj *mwep; acid_damage(MON_WEP(magr)); goto assess_dmg; case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */ - if (mhit && !mdef->mcan && mwep) { + if (mhitb && !mdef->mcan && mwep) { (void) drain_item(mwep, FALSE); /* No message */ } diff --git a/src/mhitu.c b/src/mhitu.c index 84cab3e91..6bbbb7d25 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -285,7 +285,7 @@ struct attack *alt_attk_buf; /* prevent a monster with two consecutive disease or hunger attacks from hitting with both of them on the same turn; if the first has already hit, switch to a stun attack for the second */ - if (indx > 0 && prev_result[indx - 1] > 0 + if (indx > 0 && prev_result[indx - 1] > MM_MISS && (attk->adtyp == AD_DISE || attk->adtyp == AD_PEST || attk->adtyp == AD_FAMN) && attk->adtyp == mptr->mattk[indx - 1].adtyp) { @@ -622,7 +622,7 @@ register struct monst *mtmp; g.skipdrin = FALSE; /* [see mattackm(mhitm.c)] */ for (i = 0; i < NATTK; i++) { - sum[i] = 0; + sum[i] = MM_MISS; if (i > 0 && foundyou /* previous attack might have moved hero */ && (mtmp->mux != u.ux || mtmp->muy != u.uy)) continue; /* fill in sum[] with 'miss' but skip other actions */ @@ -763,15 +763,15 @@ register struct monst *mtmp; if (g.context.botl) bot(); /* give player a chance of waking up before dying -kaa */ - if (sum[i] == 1) { /* successful attack */ + if (sum[i] == MM_HIT) { /* successful attack */ if (u.usleep && u.usleep < g.monstermoves && !rn2(10)) { g.multi = -1; g.nomovemsg = "The combat suddenly awakens you."; } } - if (sum[i] == 2) + if ((sum[i] & MM_AGR_DIED)) return 1; /* attacker dead */ - if (sum[i] == 3) + if ((sum[i] & MM_AGR_DONE)) break; /* attacker teleported, no more attacks */ /* sum[i] == 0: unsuccessful attack */ } @@ -956,10 +956,8 @@ struct monst *mon; /* * hitmu: monster hits you - * returns 2 if monster dies (e.g. "yellow light"), 1 otherwise - * 3 if the monster lives but teleported/paralyzed, so it can't keep - * attacking you - */ + * returns MM_ flags +*/ static int hitmu(mtmp, mattk) register struct monst *mtmp; @@ -1083,7 +1081,7 @@ register struct attack *mattk; if (mhm.damage) res = passiveum(olduasmon, mtmp, mattk); else - res = 1; + res = MM_HIT; stop_occupation(); return res; } @@ -1123,9 +1121,9 @@ struct attack *mattk; int omx = mtmp->mx, omy = mtmp->my; if (!engulf_target(mtmp, &g.youmonst)) - return 0; + return MM_MISS; if ((t && is_pit(t->ttyp)) && sobj_at(BOULDER, u.ux, u.uy)) - return 0; + return MM_MISS; if (Punished) unplacebc(); /* ball&chain go away */ @@ -1176,7 +1174,7 @@ struct attack *mattk; if (Punished) placebc(); set_ustuck((struct monst *) 0); - return (!DEADMONSTER(mtmp)) ? 0 : 2; + return (!DEADMONSTER(mtmp)) ? MM_MISS : MM_AGR_DIED; } display_nhwindow(WIN_MESSAGE, FALSE); @@ -1207,7 +1205,7 @@ struct attack *mattk; } if (mtmp != u.ustuck) - return 0; + return MM_MISS; if (Punished) { /* ball&chain are in limbo while swallowed; update their internal location to be at swallower's spot */ @@ -1362,7 +1360,7 @@ struct attack *mattk; pline("Obviously %s doesn't like your taste.", mon_nam(mtmp)); expels(mtmp, mtmp->data, FALSE); } - return 1; + return MM_HIT; } /* monster explodes in your face */ @@ -1375,7 +1373,7 @@ boolean ufound; boolean physical_damage = TRUE, kill_agr = TRUE; if (mtmp->mcan) - return 0; + return MM_MISS; if (!ufound) { pline("%s explodes at a spot in %s!", @@ -1467,7 +1465,7 @@ boolean ufound; if (kill_agr) mondead(mtmp); wake_nearto(mtmp->mx, mtmp->my, 7 * 7); - return (!DEADMONSTER(mtmp)) ? 0 : 2; + return (!DEADMONSTER(mtmp)) ? MM_MISS : MM_AGR_DIED; } /* monster gazes at you */ @@ -1535,7 +1533,7 @@ struct attack *mattk; if (!DEADMONSTER(mtmp)) break; - return 2; + return MM_AGR_DIED; } if (canseemon(mtmp) && couldsee(mtmp->mx, mtmp->my) && !Stone_resistance) { @@ -1685,7 +1683,7 @@ struct attack *mattk; : (!rn2(2) ? "a bit " : "somewhat "), reactions[react]); } - return 0; + return MM_MISS; } /* mtmp hits you for n points damage */ @@ -2141,7 +2139,7 @@ struct attack *mattk; */ for (i = 0; !oldu_mattk; i++) { if (i >= NATTK) - return 1; + return MM_HIT; if (olduasmon->mattk[i].aatyp == AT_NONE || olduasmon->mattk[i].aatyp == AT_BOOM) oldu_mattk = &olduasmon->mattk[i]; @@ -2194,10 +2192,10 @@ struct attack *mattk; g.stoned = 1; xkilled(mtmp, XKILL_NOMSG); if (!DEADMONSTER(mtmp)) - return 1; - return 2; + return MM_HIT; + return MM_AGR_DIED; } - return 1; + return MM_HIT; } case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */ if (mon_currwep) { @@ -2206,12 +2204,12 @@ struct attack *mattk; (void) drain_item(mon_currwep, TRUE); /* No message */ } - return 1; + return MM_HIT; default: break; } if (!Upolyd) - return 1; + return MM_HIT; /* These affect the enemy only if you are still a monster */ if (rn2(3)) @@ -2241,15 +2239,15 @@ struct attack *mattk; return 1; pline("%s is frozen by your gaze!", Monnam(mtmp)); paralyze_monst(mtmp, tmp); - return 3; + return MM_AGR_DONE; } } } else { /* gelatinous cube */ pline("%s is frozen by you.", Monnam(mtmp)); paralyze_monst(mtmp, tmp); - return 3; + return MM_AGR_DONE; } - return 1; + return MM_HIT; case AD_COLD: /* Brown mold or blue jelly */ if (resists_cold(mtmp)) { shieldeff(mtmp->mx, mtmp->my); @@ -2305,10 +2303,10 @@ struct attack *mattk; pline("%s dies!", Monnam(mtmp)); xkilled(mtmp, XKILL_NOMSG); if (!DEADMONSTER(mtmp)) - return 1; - return 2; + return MM_HIT; + return MM_AGR_DIED; } - return 1; + return MM_HIT; } struct monst * diff --git a/src/mthrowu.c b/src/mthrowu.c index 66ef9d949..55cc3c92a 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -704,13 +704,13 @@ struct monst *mtmp, *mtarg; mtmp->weapon_check = NEED_RANGED_WEAPON; /* mon_wield_item resets weapon_check as appropriate */ if (mon_wield_item(mtmp) != 0) - return 0; + return MM_MISS; } /* Pick a weapon */ otmp = select_rwep(mtmp); if (!otmp) - return 0; + return MM_MISS; ispole = is_pole(otmp); x = mtmp->mx; @@ -725,17 +725,17 @@ struct monst *mtmp, *mtarg; if (ammo_and_launcher(otmp, mwep) && dist2(mtmp->mx, mtmp->my, mtarg->mx, mtarg->my) > PET_MISSILE_RANGE2) - return 0; /* Out of range */ + return MM_MISS; /* Out of range */ /* Set target monster */ g.mtarget = mtarg; g.marcher = mtmp; monshoot(mtmp, otmp, mwep); /* multishot shooting or throwing */ g.marcher = g.mtarget = (struct monst *) 0; nomul(0); - return 1; + return MM_HIT; } } - return 0; + return MM_MISS; } /* monster spits substance at monster */ @@ -750,7 +750,7 @@ struct attack *mattk; if (!Deaf) pline("A dry rattle comes from %s throat.", s_suffix(mon_nam(mtmp))); - return 0; + return MM_MISS; } if (m_lined_up(mtarg, mtmp)) { switch (mattk->adtyp) { @@ -784,10 +784,10 @@ struct attack *mattk; dog->hungrytime -= 5; } - return 1; + return MM_HIT; } } - return 0; + return MM_MISS; } /* monster breathes at monster (ranged) */ @@ -807,7 +807,7 @@ struct attack *mattk; else You_hear("a cough."); } - return 0; + return MM_MISS; } if (!mtmp->mspec_used && rn2(3)) { if ((typ >= AD_MAGM) && (typ <= AD_ACID)) { @@ -836,9 +836,9 @@ struct attack *mattk; } } else impossible("Breath weapon %d used", typ-1); } else - return 0; + return MM_MISS; } - return 1; + return MM_HIT; } diff --git a/src/uhitm.c b/src/uhitm.c index 6adf232ed..998408e18 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -4046,7 +4046,7 @@ struct mhitm_data *mhm; : "makes some remarks about how difficult theft is lately"); if (!tele_restrict(magr)) (void) rloc(magr, TRUE); - mhm->hitflags = MM_HIT | MM_DEF_DIED; /* return 3??? */ + mhm->hitflags = MM_AGR_DONE; /* return 3??? */ mhm->done = TRUE; return; } else if (magr->mcan) { @@ -4058,7 +4058,7 @@ struct mhitm_data *mhm; if (rn2(3)) { if (!tele_restrict(magr)) (void) rloc(magr, TRUE); - mhm->hitflags = MM_HIT | MM_DEF_DIED; /* return 3??? */ + mhm->hitflags = MM_AGR_DONE; /* return 3??? */ mhm->done = TRUE; return; } @@ -4067,7 +4067,7 @@ struct mhitm_data *mhm; buf[0] = '\0'; switch (steal(magr, buf)) { case -1: - mhm->hitflags = MM_DEF_DIED; /* return 2??? */ + mhm->hitflags = MM_AGR_DIED; /* return 2??? */ mhm->done = TRUE; return; case 0: @@ -4081,7 +4081,7 @@ struct mhitm_data *mhm; locomotion(magr->data, "run"), buf); } monflee(magr, 0, FALSE, FALSE); - mhm->hitflags = MM_HIT | MM_DEF_DIED; /* return 3??? */ + mhm->hitflags = MM_AGR_DONE; /* return 3??? */ mhm->done = TRUE; return; } @@ -4166,7 +4166,7 @@ struct mhitm_data *mhm; if (SYSOPT_SEDUCE) { if (could_seduce(magr, mdef, mattk) == 1 && !magr->mcan) if (doseduce(magr)) { - mhm->hitflags = MM_HIT | MM_DEF_DIED; /* return 3??? */ + mhm->hitflags = MM_AGR_DONE; mhm->done = TRUE; return; } @@ -4183,42 +4183,6 @@ struct mhitm_data *mhm; } } - -/* Template for monster hits monster for AD_FOO. - - replace "break" with return - - replace "return" with mhm->done = TRUE -*/ -void -mhitm_ad_FOO(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; -{ - struct permonst *pd = mdef->data; - - if (magr == &g.youmonst) { - /* uhitm */ - int armpro = magic_negation(mdef); - /* since hero can't be cancelled, only defender's armor applies */ - boolean negated = !(rn2(10) >= 3 * armpro); - - /* TODO */ - } else if (mdef == &g.youmonst) { - /* mhitu */ - int armpro = magic_negation(mdef); - boolean uncancelled = !magr->mcan && (rn2(10) >= 3 * armpro); - - /* TODO */ - } else { - /* mhitm */ - int armpro = magic_negation(mdef); - boolean cancelled = magr->mcan || !(rn2(10) >= 3 * armpro); - - /* TODO */ - } -} - void mhitm_adtyping(magr, mattk, mdef, mhm) struct monst *magr; @@ -4297,7 +4261,7 @@ int specialdmg; /* blessed and/or silver bonus against various things */ && u.umonnum != PM_SUCCUBUS && u.umonnum != PM_INCUBUS && u.umonnum != PM_BALROG) { demonpet(); - return 0; + return MM_MISS; } mhitm_adtyping(&g.youmonst, mattk, mdef, &mhm); @@ -4317,9 +4281,9 @@ int specialdmg; /* blessed and/or silver bonus against various things */ xkilled(mdef, XKILL_NOMSG); } else if (mhm.damage) killed(mdef); - return 2; + return MM_DEF_DIED; } - return 1; + return MM_HIT; } static int @@ -4359,7 +4323,7 @@ register struct attack *mattk; mdef->mhp -= tmp; if (DEADMONSTER(mdef)) { killed(mdef); - return 2; + return MM_DEF_DIED; } } else { shieldeff(mdef->mx, mdef->my); @@ -4372,7 +4336,7 @@ register struct attack *mattk; default: break; } - return 1; + return MM_HIT; } static void @@ -4423,7 +4387,7 @@ register struct attack *mattk; */ if (!engulf_target(&g.youmonst, mdef)) - return 0; + return MM_MISS; if (u.uhunger < 1500 && !u.uswallow) { for (otmp = mdef->minvent; otmp; otmp = otmp->nobj) @@ -4438,7 +4402,7 @@ register struct attack *mattk; pline("It turns into %s.", a_monnam(mdef)); else map_invisible(mdef->mx, mdef->my); - return 1; + return MM_HIT; } /* engulfing a cockatrice or digesting a Rider or Medusa */ @@ -4471,7 +4435,7 @@ register struct attack *mattk; pd->mname); g.killer.format = NO_KILLER_PREFIX; done(DIED); - return 0; /* lifesaved */ + return MM_MISS; /* lifesaved */ } if (Slow_digestion) { @@ -4527,7 +4491,7 @@ register struct attack *mattk; exercise(A_CON, TRUE); } end_engulf(); - return 2; + return MM_DEF_DIED; case AD_PHYS: if (g.youmonst.data == &mons[PM_FOG_CLOUD]) { pline("%s is laden with your moisture.", Monnam(mdef)); @@ -4603,7 +4567,7 @@ register struct attack *mattk; if (DEADMONSTER(mdef)) { killed(mdef); if (DEADMONSTER(mdef)) /* not lifesaved */ - return 2; + return MM_DEF_DIED; } You("%s %s!", is_animal(g.youmonst.data) ? "regurgitate" : "expel", mon_nam(mdef)); @@ -4613,7 +4577,7 @@ register struct attack *mattk; } } } - return 0; + return MM_MISS; } void @@ -4643,14 +4607,14 @@ register struct monst *mon; struct attack *mattk, alt_attk; struct obj *weapon, **originalweapon; boolean altwep = FALSE, weapon_used = FALSE, odd_claw = TRUE; - int i, tmp, armorpenalty, sum[NATTK], nsum = 0, dhit = 0, attknum = 0; + int i, tmp, armorpenalty, sum[NATTK], nsum = MM_MISS, dhit = 0, attknum = 0; int dieroll, multi_claw = 0; /* with just one touch/claw/weapon attack, both rings matter; with more than one, alternate right and left when checking whether silver ring causes successful hit */ for (i = 0; i < NATTK; i++) { - sum[i] = 0; + sum[i] = MM_MISS; mattk = getmattk(&g.youmonst, mon, i, sum, &alt_attk); if (mattk->aatyp == AT_WEAP || mattk->aatyp == AT_CLAW || mattk->aatyp == AT_TUCH) @@ -4661,7 +4625,7 @@ register struct monst *mon; g.skipdrin = FALSE; /* [see mattackm(mhitm.c)] */ for (i = 0; i < NATTK; i++) { - /* sum[i] = 0; -- now done above */ + /* sum[i] = MM_MISS; -- now done above */ mattk = getmattk(&g.youmonst, mon, i, sum, &alt_attk); if (g.skipdrin && mattk->aatyp == AT_TENT && mattk->adtyp == AD_DRIN) continue; @@ -4675,7 +4639,7 @@ register struct monst *mon; get to make another weapon attack (note: monsters who use weapons do not have this restriction, but they also never have the opportunity to use two weapons) */ - if (weapon_used && sum[i - 1] && uwep && bimanual(uwep)) + if (weapon_used && (sum[i - 1] > MM_MISS) && uwep && bimanual(uwep)) continue; /* Certain monsters don't use weapons when encountered as enemies, * but players who polymorph into them have hands or claws and @@ -4724,10 +4688,10 @@ register struct monst *mon; if (!known_hitum(mon, weapon, &dhit, tmp, armorpenalty, mattk, dieroll)) { /* enemy dead, before any special abilities used */ - sum[i] = 2; + sum[i] = MM_DEF_DIED; break; } else - sum[i] = dhit; + sum[i] = dhit ? MM_HIT : MM_MISS; /* originalweapon points to an equipment slot which might now be empty if the weapon was destroyed during the hit; passive(,weapon,...) won't call passive_obj() in that case */ @@ -4924,7 +4888,7 @@ register struct monst *mon; if (silverhit && flags.verbose) silver_sears(&g.youmonst, mon, silverhit); sum[i] = damageum(mon, mattk, specialdmg); - } else if (i >= 2 && sum[i - 1] && sum[i - 2]) { + } else if (i >= 2 && (sum[i - 1] > MM_MISS) && (sum[i - 2] > MM_MISS)) { /* in case we're hugging a new target while already holding something else; yields feedback " is no longer in your clutches" */ @@ -4954,7 +4918,7 @@ register struct monst *mon; Your("attempt to surround %s is harmless.", mon_nam(mon)); else { sum[i] = gulpum(mon, mattk); - if (sum[i] == 2 && (mon->data->mlet == S_ZOMBIE + if (sum[i] == MM_DEF_DIED && (mon->data->mlet == S_ZOMBIE || mon->data->mlet == S_MUMMY) && rn2(5) && !Sick_resistance) { You_feel("%ssick.", (Sick) ? "very " : ""); @@ -4994,12 +4958,12 @@ register struct monst *mon; u.mh = -1; /* dead in the current form */ rehumanize(); } - if (sum[i] == 2) { + if (sum[i] == MM_DEF_DIED) { /* defender dead */ (void) passive(mon, weapon, 1, 0, mattk->aatyp, FALSE); - nsum = 0; /* return value below used to be 'nsum > 0' */ + nsum = MM_MISS; /* return value below used to be 'nsum > 0' */ } else { - (void) passive(mon, weapon, sum[i], 1, mattk->aatyp, FALSE); + (void) passive(mon, weapon, (sum[i] != MM_MISS), 1, mattk->aatyp, FALSE); nsum |= sum[i]; } @@ -5029,16 +4993,18 @@ register struct monst *mon; /* Special (passive) attacks on you by monsters done here. */ int -passive(mon, weapon, mhit, malive, aatyp, wep_was_destroyed) +passive(mon, weapon, mhitb, maliveb, aatyp, wep_was_destroyed) struct monst *mon; struct obj *weapon; /* uwep or uswapwep or uarmg or uarmf or Null */ -boolean mhit; -int malive; +boolean mhitb; +boolean maliveb; uchar aatyp; boolean wep_was_destroyed; { register struct permonst *ptr = mon->data; register int i, tmp; + int mhit = mhitb ? MM_HIT : MM_MISS; + int malive = maliveb ? MM_HIT : MM_MISS; for (i = 0;; i++) { if (i >= NATTK) @@ -5058,7 +5024,7 @@ boolean wep_was_destroyed; */ switch (ptr->mattk[i].adtyp) { case AD_FIRE: - if (mhit && !mon->mcan && weapon) { + if (mhitb && !mon->mcan && weapon) { if (aatyp == AT_KICK) { if (uarmf && !rn2(6)) (void) erode_obj(uarmf, xname(uarmf), ERODE_BURN, @@ -5069,7 +5035,7 @@ boolean wep_was_destroyed; } break; case AD_ACID: - if (mhit && rn2(2)) { + if (mhitb && rn2(2)) { if (Blind || !flags.verbose) You("are splashed!"); else @@ -5081,7 +5047,7 @@ boolean wep_was_destroyed; if (!rn2(30)) erode_armor(&g.youmonst, ERODE_CORRODE); } - if (mhit && weapon) { + if (mhitb && weapon) { if (aatyp == AT_KICK) { if (uarmf && !rn2(6)) (void) erode_obj(uarmf, xname(uarmf), ERODE_CORRODE, @@ -5093,7 +5059,7 @@ boolean wep_was_destroyed; exercise(A_STR, FALSE); break; case AD_STON: - if (mhit) { /* successful attack */ + if (mhitb) { /* successful attack */ long protector = attk_protection((int) aatyp); /* hero using monsters' AT_MAGC attack is hitting hand to @@ -5111,13 +5077,13 @@ boolean wep_was_destroyed; && !(poly_when_stoned(g.youmonst.data) && polymon(PM_STONE_GOLEM))) { done_in_by(mon, STONING); /* "You turn to stone..." */ - return 2; + return MM_DEF_DIED; } } } break; case AD_RUST: - if (mhit && !mon->mcan && weapon) { + if (mhitb && !mon->mcan && weapon) { if (aatyp == AT_KICK) { if (uarmf) (void) erode_obj(uarmf, xname(uarmf), ERODE_RUST, @@ -5128,7 +5094,7 @@ boolean wep_was_destroyed; } break; case AD_CORR: - if (mhit && !mon->mcan && weapon) { + if (mhitb && !mon->mcan && weapon) { if (aatyp == AT_KICK) { if (uarmf) (void) erode_obj(uarmf, xname(uarmf), ERODE_CORRODE, @@ -5149,7 +5115,7 @@ boolean wep_was_destroyed; } break; case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */ - if (mhit) { + if (mhitb) { if (aatyp == AT_KICK) { if (!weapon) break;