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

Function obj_shudders

src/zap.c:1475–1497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1473}
1474
1475boolean
1476obj_shudders(struct obj *obj)
1477{
1478 int zap_odds;
1479
1480 if (svc.context.bypasses && obj->bypass)
1481 return FALSE;
1482
1483 if (obj->oclass == WAND_CLASS)
1484 zap_odds = 3; /* half-life = 2 zaps */
1485 else if (obj->cursed)
1486 zap_odds = 3; /* half-life = 2 zaps */
1487 else if (obj->blessed)
1488 zap_odds = 12; /* half-life = 8 zaps */
1489 else
1490 zap_odds = 8; /* half-life = 6 zaps */
1491
1492 /* adjust for "large" quantities of identical things */
1493 if (obj->quan > 4L)
1494 zap_odds /= 2;
1495
1496 return (boolean) !rn2(zap_odds);
1497}
1498
1499/* Use up at least minwt number of things made of material mat.
1500 * There's also a chance that other stuff will be used up. Finally,

Callers 1

bhitoFunction · 0.85

Calls 1

rn2Function · 0.85

Tested by

no test coverage detected