| 1321 | } |
| 1322 | |
| 1323 | staticfn int |
| 1324 | trapeffect_rocktrap( |
| 1325 | struct monst *mtmp, |
| 1326 | struct trap *trap, |
| 1327 | unsigned trflags UNUSED) |
| 1328 | { |
| 1329 | struct obj *otmp; |
| 1330 | boolean harmless = FALSE; |
| 1331 | |
| 1332 | if (mtmp == &gy.youmonst) { |
| 1333 | if (trap->once && trap->tseen && !rn2(15)) { |
| 1334 | pline("A trap door in %s opens, but nothing falls out!", |
| 1335 | the(ceiling(u.ux, u.uy))); |
| 1336 | deltrap(trap); |
| 1337 | newsym(u.ux, u.uy); |
| 1338 | } else { |
| 1339 | int dmg = d(2, 6); /* should be std ROCK dmg? */ |
| 1340 | |
| 1341 | trap->once = 1; |
| 1342 | feeltrap(trap); |
| 1343 | otmp = t_missile(ROCK, trap); |
| 1344 | place_object(otmp, u.ux, u.uy); |
| 1345 | |
| 1346 | pline("A trap door in %s opens and %s falls on your %s!", |
| 1347 | the(ceiling(u.ux, u.uy)), an(xname(otmp)), body_part(HEAD)); |
| 1348 | if (uarmh) { |
| 1349 | /* normally passes_rocks() would protect against a falling |
| 1350 | rock, but not when wearing a helmet */ |
| 1351 | if (passes_rocks(gy.youmonst.data)) { |
| 1352 | pline("Unfortunately, you are wearing %s.", |
| 1353 | an(helm_simple_name(uarmh))); /* helm or hat */ |
| 1354 | dmg = 2; |
| 1355 | } else if (hard_helmet(uarmh)) { |
| 1356 | pline("Fortunately, you are wearing a hard helmet."); |
| 1357 | dmg = 2; |
| 1358 | } else if (flags.verbose) { |
| 1359 | pline("%s does not protect you.", Yname2(uarmh)); |
| 1360 | } |
| 1361 | } else if (passes_rocks(gy.youmonst.data)) { |
| 1362 | pline("It passes harmlessly through you."); |
| 1363 | harmless = TRUE; |
| 1364 | } |
| 1365 | if (!Blind) |
| 1366 | observe_object(otmp); |
| 1367 | stackobj(otmp); |
| 1368 | newsym(u.ux, u.uy); /* map the rock */ |
| 1369 | |
| 1370 | if (!harmless) { |
| 1371 | losehp(Maybe_Half_Phys(dmg), "falling rock", KILLED_BY_AN); |
| 1372 | exercise(A_STR, FALSE); |
| 1373 | } |
| 1374 | } |
| 1375 | } else { |
| 1376 | boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed); |
| 1377 | boolean see_it = cansee(mtmp->mx, mtmp->my); |
| 1378 | boolean trapkilled = FALSE; |
| 1379 | |
| 1380 | if (trap->once && trap->tseen && !rn2(15)) { |
no test coverage detected