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

Function mon_break_armor

src/worn.c:1176–1335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1174}
1175
1176void
1177mon_break_armor(struct monst *mon, boolean polyspot)
1178{
1179 struct obj *otmp;
1180 struct permonst *mdat = mon->data;
1181 boolean vis = cansee(mon->mx, mon->my),
1182 handless_or_tiny = (nohands(mdat) || verysmall(mdat)),
1183 noride = FALSE;
1184 const char *pronoun = mhim(mon), *ppronoun = mhis(mon);
1185
1186 if (breakarm(mdat)) {
1187 if ((otmp = which_armor(mon, W_ARM)) != 0) {
1188 if ((Is_dragon_scales(otmp) && mdat == Dragon_scales_to_pm(otmp))
1189 || (Is_dragon_mail(otmp) && mdat == Dragon_mail_to_pm(otmp))) {
1190 ; /* no message here;
1191 "the dragon merges with his scaly armor" is odd
1192 and the monster's previous form is already gone */
1193 } else {
1194 Soundeffect(se_cracking_sound, 100);
1195 if (vis)
1196 pline_mon(mon, "%s breaks out of %s armor!",
1197 Monnam(mon), ppronoun);
1198 else
1199 You_hear("a cracking sound.");
1200 }
1201 m_useup(mon, otmp);
1202 }
1203 if ((otmp = which_armor(mon, W_ARMC)) != 0
1204 /* mummy wrapping adapts to small and very big sizes */
1205 && (otmp->otyp != MUMMY_WRAPPING || !WrappingAllowed(mdat))) {
1206 if (otmp->oartifact) {
1207 if (vis)
1208 pline_mon(mon, "%s %s falls off!", s_suffix(Monnam(mon)),
1209 cloak_simple_name(otmp));
1210 m_lose_armor(mon, otmp, polyspot);
1211 } else {
1212 Soundeffect(se_ripping_sound, 100);
1213 if (vis)
1214 pline_mon(mon, "%s %s tears apart!", s_suffix(Monnam(mon)),
1215 cloak_simple_name(otmp));
1216 else
1217 You_hear("a ripping sound.");
1218 m_useup(mon, otmp);
1219 }
1220 }
1221 if ((otmp = which_armor(mon, W_ARMU)) != 0) {
1222 if (vis)
1223 pline_mon(mon, "%s shirt rips to shreds!",
1224 s_suffix(Monnam(mon)));
1225 else
1226 You_hear("a ripping sound.");
1227 m_useup(mon, otmp);
1228 }
1229 } else if (sliparm(mdat)) {
1230 /* sliparm checks whirly, noncorporeal, and small or under */
1231 boolean passes_thru_clothes = !(mdat->msize <= MZ_SMALL);
1232
1233 if ((otmp = which_armor(mon, W_ARM)) != 0) {

Callers 2

new_wereFunction · 0.85
newchamFunction · 0.85

Calls 15

breakarmFunction · 0.85
which_armorFunction · 0.85
pline_monFunction · 0.85
MonnamFunction · 0.85
You_hearFunction · 0.85
m_useupFunction · 0.85
s_suffixFunction · 0.85
cloak_simple_nameFunction · 0.85
m_lose_armorFunction · 0.85
sliparmFunction · 0.85
surfaceFunction · 0.85
can_saddleFunction · 0.85

Tested by

no test coverage detected