weapon description for status lines; started as a terser version of what ^X shows but has diverged to some extent */
| 478 | /* weapon description for status lines; started as a terser version of |
| 479 | what ^X shows but has diverged to some extent */ |
| 480 | char * |
| 481 | weapon_status(char *outbuf) |
| 482 | { |
| 483 | const char *res = 0; |
| 484 | |
| 485 | *outbuf = '\0'; /* lint suppression */ |
| 486 | if (!uwep) { |
| 487 | /* no weapon; gloves imply hands; humanoid also implies hands; |
| 488 | otherwise make no assumptions */ |
| 489 | res = uarmg ? "Empty-hnd" /* empty handed means "gloves only" */ |
| 490 | : humanoid(gy.youmonst.data) ? "Bare-hnds" /* bare hands */ |
| 491 | : "No-weapon"; |
| 492 | } else if (u.twoweap) { |
| 493 | /* two-weaponing implies hands and a weapon or wep-tool |
| 494 | (not other odd stuff) in each hand */ |
| 495 | res = "Dual-weps"; |
| 496 | /* note: dual wielding two lances doesn't produce double joust */ |
| 497 | if (u.usteed && (weapon_type(uwep) == P_LANCE |
| 498 | || weapon_type(uswapwep) == P_LANCE)) |
| 499 | res = "Dual+joust"; /* lance behaves specially when mounted */ |
| 500 | } else { |
| 501 | /* report most weapons by their skill class (so a katana will be |
| 502 | described as a long sword, for instance; mattock and hook are |
| 503 | exceptions), or wielded non-weapon item by its object class */ |
| 504 | char *p; |
| 505 | int skill = weapon_type(uwep); |
| 506 | |
| 507 | if (u.usteed && skill == P_LANCE) { |
| 508 | /* lance behaves specially when hero is mounted */ |
| 509 | res = "joust"; |
| 510 | } else if (uwep->otyp == AKLYS) { |
| 511 | /* aklys behaves specially when thrown while wielded, so |
| 512 | give it a distinct name instead of skill name of "club"; |
| 513 | [maybe FIXME?] for the time being |
| 514 | use real name even if 'obj' is undiscovered "thonged club" */ |
| 515 | res = "aklys"; |
| 516 | } else if (is_sword(uwep)) { |
| 517 | /* simplify short short/broad sword/long sword/two-handed sword |
| 518 | (similar to messages when dropped due to slippery fingers) */ |
| 519 | res = "sword"; |
| 520 | } else { |
| 521 | /* shorten several */ |
| 522 | switch (skill) { |
| 523 | case P_QUARTERSTAFF: |
| 524 | res = "staff"; |
| 525 | break; |
| 526 | case P_MORNING_STAR: |
| 527 | res = "mrng-star"; /* still pretty long */ |
| 528 | break; |
| 529 | case P_POLEARMS: |
| 530 | res = "pole"; |
| 531 | break; |
| 532 | case P_UNICORN_HORN: |
| 533 | res = "unihorn"; |
| 534 | break; |
| 535 | default: |
| 536 | res = weapon_descr(uwep); |
| 537 | /* [should this be moved into weapon_descr()?] */ |
no test coverage detected