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

Function which_armor

src/worn.c:1005–1036  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1003#undef RACE_EXCEPTION
1004
1005struct obj *
1006which_armor(struct monst *mon, long flag)
1007{
1008 if (mon == &gy.youmonst) {
1009 switch (flag) {
1010 case W_ARM:
1011 return uarm;
1012 case W_ARMC:
1013 return uarmc;
1014 case W_ARMH:
1015 return uarmh;
1016 case W_ARMS:
1017 return uarms;
1018 case W_ARMG:
1019 return uarmg;
1020 case W_ARMF:
1021 return uarmf;
1022 case W_ARMU:
1023 return uarmu;
1024 default:
1025 impossible("bad flag in which_armor");
1026 return 0;
1027 }
1028 } else {
1029 struct obj *obj;
1030
1031 for (obj = mon->minvent; obj; obj = obj->nobj)
1032 if (obj->owornmask & flag)
1033 return obj;
1034 return (struct obj *) 0;
1035 }
1036}
1037
1038/* remove an item of armor and then drop it */
1039staticfn void

Callers 15

defendedFunction · 0.85
can_be_strangledFunction · 0.85
rndcurseFunction · 0.85
potionhitFunction · 0.85
some_armorFunction · 0.85
erode_armorFunction · 0.85
m_slips_freeFunction · 0.85
mhitm_ad_drinFunction · 0.85
mhitm_ad_physFunction · 0.85
mhitm_ad_seduFunction · 0.85
mhitm_knockbackFunction · 0.85
use_saddleFunction · 0.85

Calls 1

impossibleFunction · 0.70

Tested by

no test coverage detected