| 2291 | } |
| 2292 | |
| 2293 | void |
| 2294 | drop_boulder_on_player( |
| 2295 | boolean confused, |
| 2296 | boolean helmet_protects, |
| 2297 | boolean byu, |
| 2298 | boolean skip_uswallow) |
| 2299 | { |
| 2300 | int dmg; |
| 2301 | struct obj *otmp2; |
| 2302 | |
| 2303 | /* hit monster if swallowed */ |
| 2304 | if (u.uswallow && !skip_uswallow) { |
| 2305 | drop_boulder_on_monster(u.ux, u.uy, confused, byu); |
| 2306 | return; |
| 2307 | } |
| 2308 | |
| 2309 | otmp2 = mksobj(confused ? ROCK : BOULDER, FALSE, FALSE); |
| 2310 | if (!otmp2) |
| 2311 | return; |
| 2312 | otmp2->quan = confused ? rn1(5, 2) : 1; |
| 2313 | otmp2->owt = weight(otmp2); |
| 2314 | if (!amorphous(gy.youmonst.data) && !Passes_walls |
| 2315 | && !noncorporeal(gy.youmonst.data) && !unsolid(gy.youmonst.data)) { |
| 2316 | You("are hit by %s!", doname(otmp2)); |
| 2317 | dmg = (int) (dmgval(otmp2, &gy.youmonst) * otmp2->quan); |
| 2318 | if (uarmh && helmet_protects) { |
| 2319 | if (hard_helmet(uarmh)) { |
| 2320 | pline("Fortunately, you are wearing a hard helmet."); |
| 2321 | if (dmg > 2) |
| 2322 | dmg = 2; |
| 2323 | } else if (flags.verbose) { |
| 2324 | pline("%s does not protect you.", Yname2(uarmh)); |
| 2325 | } |
| 2326 | } |
| 2327 | } else |
| 2328 | dmg = 0; |
| 2329 | wake_nearto(u.ux, u.uy, 4 * 4); |
| 2330 | /* Must be before the losehp(), for bones files */ |
| 2331 | if (!flooreffects(otmp2, u.ux, u.uy, "fall")) { |
| 2332 | place_object(otmp2, u.ux, u.uy); |
| 2333 | stackobj(otmp2); |
| 2334 | newsym(u.ux, u.uy); |
| 2335 | } |
| 2336 | if (dmg) |
| 2337 | losehp(Maybe_Half_Phys(dmg), "scroll of earth", KILLED_BY_AN); |
| 2338 | } |
| 2339 | |
| 2340 | boolean |
| 2341 | drop_boulder_on_monster(coordxy x, coordxy y, boolean confused, boolean byu) |
no test coverage detected