ball&chain might hit hero when falling through a trap door */
| 40 | |
| 41 | /* ball&chain might hit hero when falling through a trap door */ |
| 42 | void |
| 43 | ballfall(void) |
| 44 | { |
| 45 | boolean gets_hit; |
| 46 | |
| 47 | if (!uball || (uball && carried(uball) && welded(uball))) |
| 48 | return; |
| 49 | |
| 50 | gets_hit = (((uball->ox != u.ux) || (uball->oy != u.uy)) |
| 51 | && ((uwep == uball) ? FALSE : (boolean) rn2(5))); |
| 52 | ballrelease(TRUE); |
| 53 | if (gets_hit) { |
| 54 | int dmg = rn1(7, 25); |
| 55 | |
| 56 | pline_The("iron ball falls on your %s.", body_part(HEAD)); |
| 57 | if (uarmh) { |
| 58 | if (hard_helmet(uarmh)) { |
| 59 | pline("Fortunately, you are wearing a hard helmet."); |
| 60 | dmg = 3; |
| 61 | } else if (flags.verbose) |
| 62 | pline("%s does not protect you.", Yname2(uarmh)); |
| 63 | } |
| 64 | losehp(Maybe_Half_Phys(dmg), "crunched in the head by an iron ball", |
| 65 | NO_KILLER_PREFIX); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | /* |
| 70 | * To make this work, we have to mess with the hero's mind. The rules for |
no test coverage detected