| 419 | } |
| 420 | |
| 421 | staticfn void |
| 422 | look_at_monster( |
| 423 | char *buf, char *monbuf, /* buf: output, monbuf: optional output */ |
| 424 | struct monst *mtmp, |
| 425 | coordxy x, coordxy y) |
| 426 | { |
| 427 | char *name, monnambuf[BUFSZ], healthbuf[BUFSZ]; |
| 428 | boolean accurate = !Hallucination; |
| 429 | |
| 430 | name = (mtmp->data == &mons[PM_COYOTE] && accurate) |
| 431 | ? coyotename(mtmp, monnambuf) |
| 432 | : distant_monnam(mtmp, ARTICLE_NONE, monnambuf); |
| 433 | Sprintf(buf, "%s%s%s%s", |
| 434 | (mtmp->mx != x || mtmp->my != y) |
| 435 | ? ((mtmp->isshk && accurate) ? "tail of " : "tail of a ") |
| 436 | : "", |
| 437 | accurate ? monhealthdescr(mtmp, TRUE, healthbuf) : "", |
| 438 | (mtmp->mtame && accurate) |
| 439 | ? "tame " |
| 440 | : (mtmp->mpeaceful && accurate) |
| 441 | ? "peaceful " |
| 442 | : "", |
| 443 | name); |
| 444 | if (u.ustuck == mtmp) { |
| 445 | if (u.uswallow || iflags.save_uswallow) /* monster detection */ |
| 446 | Strcat(buf, digests(mtmp->data) ? ", swallowing you" |
| 447 | : ", engulfing you"); |
| 448 | else |
| 449 | Strcat(buf, (Upolyd && sticks(gy.youmonst.data)) |
| 450 | ? ", being held" : ", holding you"); |
| 451 | } |
| 452 | /* if mtmp isn't able to move (other than because it is a type of |
| 453 | monster that never moves), say so [excerpt from mstatusline() for |
| 454 | stethoscope or wand of probing] */ |
| 455 | if (mtmp->mfrozen) |
| 456 | /* unfortunately mfrozen covers temporary sleep and being busy |
| 457 | (donning armor, for instance) as well as paralysis */ |
| 458 | Strcat(buf, ", can't move (paralyzed or sleeping or busy)"); |
| 459 | else if (mtmp->msleeping) |
| 460 | /* sleeping for an indeterminate duration */ |
| 461 | Strcat(buf, ", asleep"); |
| 462 | else if ((mtmp->mstrategy & STRAT_WAITMASK) != 0) |
| 463 | /* arbitrary reason why it isn't moving */ |
| 464 | Strcat(buf, ", meditating"); |
| 465 | |
| 466 | if (mtmp->mleashed) |
| 467 | Strcat(buf, ", leashed to you"); |
| 468 | if (mtmp->mtrapped && cansee(mtmp->mx, mtmp->my)) { |
| 469 | struct trap *t = t_at(mtmp->mx, mtmp->my); |
| 470 | int tt = t ? t->ttyp : NO_TRAP; |
| 471 | |
| 472 | /* newsym lets you know of the trap, so mention it here */ |
| 473 | if (tt == BEAR_TRAP || is_pit(tt) || tt == WEB) { |
| 474 | Sprintf(eos(buf), ", trapped in %s", an(trapname(tt, FALSE))); |
| 475 | t->tseen = 1; |
| 476 | } |
| 477 | } |
| 478 |
no test coverage detected