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

Function stuck_ring

src/do_wear.c:2656–2683  ·  view source on GitHub ↗

used for praying to check and fix levitation trouble */

Source from the content-addressed store, hash-verified

2654
2655/* used for praying to check and fix levitation trouble */
2656struct obj *
2657stuck_ring(struct obj *ring, int otyp)
2658{
2659 if (ring != uleft && ring != uright) {
2660 impossible("stuck_ring: neither left nor right?");
2661 return (struct obj *) 0;
2662 }
2663
2664 if (ring && ring->otyp == otyp) {
2665 /* reasons ring can't be removed match those checked by select_off();
2666 limbless case has extra checks because ordinarily it's temporary */
2667 if (nolimbs(gy.youmonst.data) && uamul
2668 && uamul->otyp == AMULET_OF_UNCHANGING && uamul->cursed)
2669 return uamul;
2670 if (welded(uwep) && ((ring == RING_ON_PRIMARY) || bimanual(uwep)))
2671 return uwep;
2672 if (uarmg && uarmg->cursed)
2673 return uarmg;
2674 if (ring->cursed)
2675 return ring;
2676 /* normally outermost layer is processed first, but slippery gloves
2677 wears off quickly so uncurse ring itself before handling those */
2678 if (uarmg && Glib)
2679 return uarmg;
2680 }
2681 /* either no ring or not right type or nothing prevents its removal */
2682 return (struct obj *) 0;
2683}
2684
2685/* also for praying; find worn item that confers "Unchanging" attribute */
2686struct obj *

Callers 3

in_troubleFunction · 0.85
fix_worst_troubleFunction · 0.85
one_characteristicFunction · 0.85

Calls 2

weldedFunction · 0.85
impossibleFunction · 0.70

Tested by

no test coverage detected