when dying while running the debug fuzzer, [almost] always keep going; True: forced survival; False: doomed unless wearing life-save amulet */
| 942 | /* when dying while running the debug fuzzer, [almost] always keep going; |
| 943 | True: forced survival; False: doomed unless wearing life-save amulet */ |
| 944 | staticfn boolean |
| 945 | fuzzer_savelife(int how) |
| 946 | { |
| 947 | /* |
| 948 | * Some debugging code pulled out of done() to unclutter it. |
| 949 | * 'done_seq' is maintained in done(). |
| 950 | */ |
| 951 | if (!program_state.panicking && how != PANICKED && how != TRICKED) { |
| 952 | savelife(how); |
| 953 | |
| 954 | /* periodically restore characteristics plus lost experience |
| 955 | levels or cure lycanthropy or both; those conditions make the |
| 956 | hero vulnerable to repeat deaths (often by becoming surrounded |
| 957 | while being too encumbered to do anything) */ |
| 958 | if (!rn2((gd.done_seq > gh.hero_seq + 2L) ? 2 : 10)) { |
| 959 | struct obj *potion; |
| 960 | int propidx, proptim, remedies = 0; |
| 961 | |
| 962 | /* get rid of temporary potion with obfree() rather than useup() |
| 963 | because it doesn't get entered into inventory */ |
| 964 | if (ismnum(u.ulycn) && !rn2(3)) { |
| 965 | potion = mksobj(POT_WATER, TRUE, FALSE); |
| 966 | bless(potion); |
| 967 | (void) peffects(potion); |
| 968 | obfree(potion, (struct obj *) 0); |
| 969 | ++remedies; |
| 970 | } |
| 971 | if (!remedies || rn2(3)) { |
| 972 | potion = mksobj(POT_RESTORE_ABILITY, TRUE, FALSE); |
| 973 | bless(potion); |
| 974 | (void) peffects(potion); |
| 975 | obfree(potion, (struct obj *) 0); |
| 976 | ++remedies; |
| 977 | } |
| 978 | if (!rn2(3 + 3 * remedies)) { |
| 979 | /* confer temporary resistances for first 8 properties: |
| 980 | fire, cold, sleep, disint, shock, poison, acid, stone */ |
| 981 | for (propidx = 1; propidx <= 8; ++propidx) { |
| 982 | if (!u.uprops[propidx].intrinsic |
| 983 | && !u.uprops[propidx].extrinsic |
| 984 | && (proptim = rn2(3)) > 0) /* 0..2 */ |
| 985 | set_itimeout(&u.uprops[propidx].intrinsic, |
| 986 | (long) (2 * proptim + 1)); /* 3 or 5 */ |
| 987 | } |
| 988 | ++remedies; |
| 989 | } |
| 990 | if (!rn2(5 + 5 * remedies)) { |
| 991 | ; /* might confer temporary Antimagic (magic resistance) |
| 992 | * or even Invulnerable */ |
| 993 | } |
| 994 | } |
| 995 | /* clear stale cause of death info after life-saving */ |
| 996 | svk.killer.name[0] = '\0'; |
| 997 | svk.killer.format = 0; |
| 998 | |
| 999 | /* |
| 1000 | * Guard against getting stuck in a loop if we die in one of |
| 1001 | * the few ways where life-saving isn't effective (cited case |
no test coverage detected