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

Function mhitm_ad_poly

src/uhitm.c:3728–3774  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3726}
3727
3728void
3729mhitm_ad_poly(
3730 struct monst *magr, struct attack *mattk,
3731 struct monst *mdef, struct mhitm_data *mhm)
3732{
3733 boolean negated = (mhitm_mgc_atk_negated(magr, mdef, FALSE)
3734 || magr->mspec_used);
3735
3736 if (magr == &gy.youmonst) {
3737 /* uhitm */
3738 /* require weaponless attack in order to honor AD_POLY */
3739 if (!uwep && mhm->damage < mdef->mhp) {
3740 if (negated) {
3741 /* assume that you can tell by touch if blinded */
3742 pline("%s is not transformed.", Monnam(mdef));
3743 } else {
3744 mhm->damage = mon_poly(&gy.youmonst, mdef, mhm->damage);
3745 if (DEADMONSTER(mdef))
3746 mhm->hitflags |= M_ATTK_DEF_DIED;
3747 mhm->hitflags |= M_ATTK_HIT;
3748 mhm->done = TRUE;
3749 }
3750 }
3751 } else if (mdef == &gy.youmonst) {
3752 /* mhitu */
3753 hitmsg(magr, mattk);
3754 if (Maybe_Half_Phys(mhm->damage) < (Upolyd ? u.mh : u.uhp)) {
3755 if (negated) {
3756 if (magr->mcan)
3757 You("aren't transformed.");
3758 } else {
3759 mhm->damage = mon_poly(magr, &gy.youmonst, mhm->damage);
3760 mhm->hitflags |= M_ATTK_HIT;
3761 mhm->done = TRUE;
3762 }
3763 }
3764 } else {
3765 /* mhitm */
3766 if (mhm->damage < mdef->mhp && !negated) {
3767 mhm->damage = mon_poly(magr, mdef, mhm->damage);
3768 if (DEADMONSTER(mdef))
3769 mhm->hitflags |= M_ATTK_DEF_DIED;
3770 mhm->hitflags |= M_ATTK_HIT;
3771 mhm->done = TRUE;
3772 }
3773 }
3774}
3775
3776void
3777mhitm_ad_famn(

Callers 1

mhitm_adtypingFunction · 0.85

Calls 6

mhitm_mgc_atk_negatedFunction · 0.85
MonnamFunction · 0.85
mon_polyFunction · 0.85
hitmsgFunction · 0.85
YouFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected