try to get the player back in a viable state after being killed */
| 701 | |
| 702 | /* try to get the player back in a viable state after being killed */ |
| 703 | staticfn void |
| 704 | savelife(int how) |
| 705 | { |
| 706 | int uhpmin; |
| 707 | int givehp = 50 + 10 * (ACURR(A_CON) / 2); |
| 708 | |
| 709 | /* life-drain/level-loss to experience level 0 kills without actually |
| 710 | reducing ulevel below 1, but include this for bulletproofing */ |
| 711 | if (u.ulevel < 1) |
| 712 | u.ulevel = 1; |
| 713 | uhpmin = minuhpmax(10); |
| 714 | if (u.uhpmax < uhpmin) |
| 715 | setuhpmax(uhpmin, TRUE); |
| 716 | u.uhp = min(u.uhpmax, givehp); |
| 717 | if (Upolyd) /* Unchanging, or death which bypasses losing hit points */ |
| 718 | u.mh = min(u.mhmax, givehp); |
| 719 | if (u.uhunger < 500 || how == CHOKING) { |
| 720 | init_uhunger(); |
| 721 | } |
| 722 | /* cure impending doom of sickness hero won't have time to fix |
| 723 | [shouldn't this also be applied to other fatal timeouts?] */ |
| 724 | if ((Sick & TIMEOUT) == 1L) { |
| 725 | make_sick(0L, (char *) 0, FALSE, SICK_ALL); |
| 726 | } |
| 727 | gn.nomovemsg = "You survived that attempt on your life."; |
| 728 | svc.context.move = 0; |
| 729 | |
| 730 | gm.multi = -1; /* can't move again during the current turn */ |
| 731 | /* in case being life-saved is immediately followed by being killed |
| 732 | again (perhaps due to zap rebound); this text will be appended to |
| 733 | "killed by <something>, while " |
| 734 | in high scores entry, if any, and in logfile (but not on tombstone) */ |
| 735 | gm.multi_reason = Role_if(PM_TOURIST) ? "being toyed with by Fate" |
| 736 | : "attempting to cheat Death"; |
| 737 | |
| 738 | if (u.utrap && u.utraptype == TT_LAVA) |
| 739 | reset_utrap(FALSE); |
| 740 | disp.botl = TRUE; |
| 741 | u.ugrave_arise = NON_PM; |
| 742 | HUnchanging = 0L; |
| 743 | curs_on_u(); |
| 744 | if (!svc.context.mon_moving) |
| 745 | endmultishot(FALSE); |
| 746 | if (u.uswallow) { |
| 747 | /* might drop hero onto a trap that kills her all over again */ |
| 748 | expels(u.ustuck, u.ustuck->data, TRUE); |
| 749 | } else if (u.ustuck) { |
| 750 | if (Upolyd && sticks(gy.youmonst.data)) |
| 751 | You("release %s.", mon_nam(u.ustuck)); |
| 752 | else |
| 753 | pline("%s releases you.", Monnam(u.ustuck)); |
| 754 | unstuck(u.ustuck); |
| 755 | } |
| 756 | } |
| 757 | |
| 758 | /* |
| 759 | * Get valuables from the given list. Revised code: the list always remains |
no test coverage detected