used for praying to check and fix levitation trouble */
| 2654 | |
| 2655 | /* used for praying to check and fix levitation trouble */ |
| 2656 | struct obj * |
| 2657 | stuck_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 */ |
| 2686 | struct obj * |
no test coverage detected