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

Function disintegrate_cursed_armor

src/read.c:1293–1321  ·  view source on GitHub ↗

destroy a random cursed armor worn by hero */

Source from the content-addressed store, hash-verified

1291
1292/* destroy a random cursed armor worn by hero */
1293staticfn boolean
1294disintegrate_cursed_armor(void)
1295{
1296 struct obj *armors[10];
1297 int idx = 0;
1298
1299 armors[0] = NULL;
1300 if (uarm && uarm->cursed)
1301 armors[idx++] = uarm;
1302 if (uarmc && uarmc->cursed)
1303 armors[idx++] = uarmc;
1304 if (uarmh && uarmh->cursed)
1305 armors[idx++] = uarmh;
1306 if (uarms && uarms->cursed)
1307 armors[idx++] = uarms;
1308 if (uarmg && uarmg->cursed)
1309 armors[idx++] = uarmg;
1310 if (uarmf && uarmf->cursed)
1311 armors[idx++] = uarmf;
1312 if (uarmu && uarmu->cursed)
1313 armors[idx++] = uarmu;
1314 if (!idx)
1315 return FALSE;
1316
1317 if (disintegrate_arm(armors[rn2(idx)]))
1318 return TRUE;
1319
1320 return FALSE;
1321}
1322
1323staticfn void
1324seffect_destroy_armor(struct obj **sobjp)

Callers 1

seffect_destroy_armorFunction · 0.85

Calls 2

disintegrate_armFunction · 0.85
rn2Function · 0.85

Tested by

no test coverage detected