check for wielding cockatrice corpse after taking off gloves or yellow dragon scales/mail or having temporary stoning resistance time out */
| 605 | /* check for wielding cockatrice corpse after taking off gloves or yellow |
| 606 | dragon scales/mail or having temporary stoning resistance time out */ |
| 607 | void |
| 608 | wielding_corpse( |
| 609 | struct obj *obj, /* uwep, potentially a wielded cockatrice corpse */ |
| 610 | struct obj *how, /* gloves or dragon armor or Null (resist timeout) */ |
| 611 | boolean voluntary) /* True: taking protective armor off on purpose */ |
| 612 | { |
| 613 | if (!obj || obj->otyp != CORPSE || uarmg) |
| 614 | return; |
| 615 | /* note: can't dual-wield with non-weapons/weapon-tools so u.twoweap |
| 616 | will always be false if uswapwep happens to be a corpse */ |
| 617 | if (obj != uwep && (obj != uswapwep || !u.twoweap)) |
| 618 | return; |
| 619 | |
| 620 | if (touch_petrifies(&mons[obj->corpsenm]) && !Stone_resistance) { |
| 621 | char kbuf[BUFSZ], hbuf[BUFSZ]; |
| 622 | |
| 623 | You("%s %s in your bare %s.", |
| 624 | (how && is_gloves(how)) ? "now wield" : "are wielding", |
| 625 | corpse_xname(obj, (const char *) 0, CXN_ARTICLE), |
| 626 | makeplural(body_part(HAND))); |
| 627 | /* "removing" ought to be "taking off" but that makes the |
| 628 | tombstone text more likely to be truncated */ |
| 629 | if (how) |
| 630 | Sprintf(hbuf, "%s %s", voluntary ? "removing" : "losing", |
| 631 | is_gloves(how) ? gloves_simple_name(how) |
| 632 | : strsubst(simpleonames(how), "set of ", "")); |
| 633 | else |
| 634 | Strcpy(hbuf, "resistance timing out"); |
| 635 | Snprintf(kbuf, sizeof kbuf, "%s while wielding %s", |
| 636 | hbuf, killer_xname(obj)); |
| 637 | instapetrify(kbuf); |
| 638 | /* life-saved or got poly'd into a stone golem; can't continue |
| 639 | wielding cockatrice corpse unless have now become resistant */ |
| 640 | if (!Stone_resistance) |
| 641 | remove_worn_item(obj, FALSE); |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | int |
| 646 | Gloves_off(void) |
no test coverage detected