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

Function stone_luck

src/attrib.c:422–437  ·  view source on GitHub ↗

decide whether there are more blessed luckstones (plus luck-conferring artifacts) than cursed ones; optionally combine uncursed with blessed */

Source from the content-addressed store, hash-verified

420/* decide whether there are more blessed luckstones (plus luck-conferring
421 artifacts) than cursed ones; optionally combine uncursed with blessed */
422int
423stone_luck(boolean include_uncursed)
424{
425 struct obj *otmp;
426 long bonchance = 0;
427
428 for (otmp = gi.invent; otmp; otmp = otmp->nobj)
429 if (confers_luck(otmp)) {
430 if (otmp->cursed)
431 bonchance -= otmp->quan;
432 else if (otmp->blessed || include_uncursed)
433 bonchance += otmp->quan;
434 }
435
436 return sgn((int) bonchance);
437}
438
439/* there has just been an inventory change affecting a luck-granting item */
440void

Callers 3

nh_timeoutFunction · 0.85
set_moreluckFunction · 0.85
attributes_enlightenmentFunction · 0.85

Calls 2

confers_luckFunction · 0.85
sgnFunction · 0.85

Tested by

no test coverage detected