player chose 'uarmh' for #tip (pickup.c); visual #chat, sort of... */
| 1424 | |
| 1425 | /* player chose 'uarmh' for #tip (pickup.c); visual #chat, sort of... */ |
| 1426 | int |
| 1427 | tiphat(void) |
| 1428 | { |
| 1429 | struct monst *mtmp; |
| 1430 | struct obj *otmp; |
| 1431 | int x, y, range, glyph, vismon, unseen, statue, res; |
| 1432 | |
| 1433 | if (!uarmh) /* can't get here from there */ |
| 1434 | return 0; |
| 1435 | |
| 1436 | res = uarmh->bknown ? 0 : 1; |
| 1437 | if (cursed(uarmh)) /* "You can't. It is cursed." */ |
| 1438 | return res; /* if learned of curse, use a move */ |
| 1439 | |
| 1440 | /* might choose a position, but dealing with direct lines is simpler */ |
| 1441 | if (!getdir("At whom? (in what direction)")) /* bail on ESC */ |
| 1442 | return res; /* iffy; now know it's not cursed for sure (since we got |
| 1443 | * past prior test) but might have already known that */ |
| 1444 | res = 1; /* physical action is going to take place */ |
| 1445 | |
| 1446 | /* most helmets have a short wear/take-off delay and we could set |
| 1447 | 'multi' to account for that, but we'll pretend that no extra time |
| 1448 | beyond the current move is necessary */ |
| 1449 | You("briefly doff your %s.", helm_simple_name(uarmh)); |
| 1450 | |
| 1451 | if (!u.dx && !u.dy) { |
| 1452 | if (u.usteed && u.dz > 0) { |
| 1453 | if (helpless(u.usteed)) |
| 1454 | pline("%s doesn't notice.", Monnam(u.usteed)); |
| 1455 | else |
| 1456 | (void) domonnoise(u.usteed); |
| 1457 | } else if (u.dz) { |
| 1458 | pline("There's no one %s there.", (u.dz < 0) ? "up" : "down"); |
| 1459 | } else { |
| 1460 | pline_The("lout here doesn't acknowledge you..."); |
| 1461 | } |
| 1462 | return res; |
| 1463 | } |
| 1464 | |
| 1465 | mtmp = (struct monst *) 0; |
| 1466 | vismon = unseen = statue = 0, glyph = GLYPH_MON_OFF; |
| 1467 | x = u.ux, y = u.uy; |
| 1468 | for (range = 1; range <= BOLT_LIM + 1; ++range) { |
| 1469 | x += u.dx, y += u.dy; |
| 1470 | if (!isok(x, y) || (range > 1 && !couldsee(x, y))) { |
| 1471 | /* switch back to coordinates for previous iteration's 'mtmp' */ |
| 1472 | x -= u.dx, y -= u.dy; |
| 1473 | break; |
| 1474 | } |
| 1475 | mtmp = m_at(x, y); |
| 1476 | vismon = (mtmp && canseemon(mtmp)); |
| 1477 | glyph = glyph_at(x, y); |
| 1478 | unseen = glyph_is_invisible(glyph); |
| 1479 | statue = (glyph_is_statue(glyph) /* mimic or hallucinatory statue */ |
| 1480 | || (!vismon && !unseen && (otmp = vobj_at(x, y)) != 0 |
| 1481 | && otmp->otyp == STATUE)); /* or actual statue */ |
| 1482 | if (vismon && (M_AP_TYPE(mtmp) == M_AP_FURNITURE |
| 1483 | || M_AP_TYPE(mtmp) == M_AP_OBJECT)) |
no test coverage detected