MCPcopy Index your code
hub / github.com/NetHack/NetHack / find_mac

Function find_mac

src/worn.c:716–736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

714#undef altprop
715
716int
717find_mac(struct monst *mon)
718{
719 struct obj *obj;
720 int base = mon->data->ac;
721 long mwflags = mon->misc_worn_check;
722
723 for (obj = mon->minvent; obj; obj = obj->nobj) {
724 if (obj->owornmask & mwflags) {
725 if (obj->otyp == AMULET_OF_GUARDING)
726 base -= 2; /* fixed amount, not impacted by erosion */
727 else
728 base -= ARM_BONUS(obj);
729 /* since ARM_BONUS is positive, subtracting it increases AC */
730 }
731 }
732 /* same cap as for hero [find_ac(do_wear.c)] */
733 if (abs(base) > AC_MAX)
734 base = sgn(base) * AC_MAX;
735 return base;
736}
737
738/*
739 * weapons are handled separately;

Callers 12

experienceFunction · 0.85
find_roll_to_hitFunction · 0.85
drag_ballFunction · 0.85
mattackmFunction · 0.85
thitmonstFunction · 0.85
thitmFunction · 0.85
bhitmFunction · 0.85
dobuzzFunction · 0.85
mbhitmFunction · 0.85
ohitmonFunction · 0.85
mattackuFunction · 0.85
mstatuslineFunction · 0.85

Calls 1

sgnFunction · 0.85

Tested by

no test coverage detected