MCPcopy Index your code
hub / github.com/NetHack/NetHack / wielding_corpse

Function wielding_corpse

src/do_wear.c:607–643  ·  view source on GitHub ↗

check for wielding cockatrice corpse after taking off gloves or yellow dragon scales/mail or having temporary stoning resistance time out */

Source from the content-addressed store, hash-verified

605/* check for wielding cockatrice corpse after taking off gloves or yellow
606 dragon scales/mail or having temporary stoning resistance time out */
607void
608wielding_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
645int
646Gloves_off(void)

Callers 3

Gloves_offFunction · 0.85
dragon_armor_handlingFunction · 0.85
nh_timeoutFunction · 0.85

Calls 10

YouFunction · 0.85
corpse_xnameFunction · 0.85
makepluralFunction · 0.85
body_partFunction · 0.85
gloves_simple_nameFunction · 0.85
strsubstFunction · 0.85
simpleonamesFunction · 0.85
killer_xnameFunction · 0.85
instapetrifyFunction · 0.85
remove_worn_itemFunction · 0.85

Tested by

no test coverage detected