maybe do something when hero sits on a throne */
| 36 | |
| 37 | /* maybe do something when hero sits on a throne */ |
| 38 | staticfn void |
| 39 | throne_sit_effect(void) |
| 40 | { |
| 41 | coordxy tx = u.ux, ty = u.uy; |
| 42 | |
| 43 | boolean special_throne = !!In_V_tower(&u.uz); |
| 44 | |
| 45 | if (rnd(6) > 4) { /* [why so convoluted? it's the same as '!rn2(3)'] */ |
| 46 | int effect = rnd(13); |
| 47 | |
| 48 | if (wizard && !iflags.debug_fuzzer) { |
| 49 | char buf[BUFSZ]; |
| 50 | int which; |
| 51 | |
| 52 | buf[0] = '\0'; |
| 53 | getlin("Throne sit effect (1..13) [0=random]", buf); |
| 54 | if (buf[0] == '\033') { |
| 55 | pline("%s", Never_mind); |
| 56 | return; /* caller will still cause a move to elapse */ |
| 57 | } |
| 58 | which = atoi(buf); |
| 59 | if (which >= 1 && which <= 13) |
| 60 | effect = which; |
| 61 | } |
| 62 | |
| 63 | if (special_throne) { |
| 64 | special_throne_effect(effect); |
| 65 | return; |
| 66 | } |
| 67 | |
| 68 | switch (effect) { |
| 69 | case 1: |
| 70 | (void) adjattrib(rn2(A_MAX), -rn1(4, 3), FALSE); |
| 71 | losehp(rnd(10), "cursed throne", KILLED_BY_AN); |
| 72 | break; |
| 73 | case 2: |
| 74 | (void) adjattrib(rn2(A_MAX), 1, FALSE); |
| 75 | break; |
| 76 | case 3: |
| 77 | pline("A%s electric shock shoots through your body!", |
| 78 | (Shock_resistance) ? "n" : " massive"); |
| 79 | losehp(Shock_resistance ? rnd(6) : rnd(30), "electric chair", |
| 80 | KILLED_BY_AN); |
| 81 | exercise(A_CON, FALSE); |
| 82 | break; |
| 83 | case 4: |
| 84 | You_feel("much, much better!"); |
| 85 | if (Upolyd) { |
| 86 | if (u.mh >= (u.mhmax - 5)) |
| 87 | u.mhmax += 4; |
| 88 | u.mh = u.mhmax; |
| 89 | } |
| 90 | if (u.uhp >= (u.uhpmax - 5)) { |
| 91 | u.uhpmax += 4; |
| 92 | if (u.uhpmax > u.uhppeak) |
| 93 | u.uhppeak = u.uhpmax; |
| 94 | } |
| 95 | u.uhp = u.uhpmax; |
no test coverage detected