MCPcopy Create free account
hub / github.com/NetHack/NetHack / item_what

Function item_what

src/zap.c:5721–5763  ·  view source on GitHub ↗

for enlightenment; currently only useful in wizard mode; cf from_what() */

Source from the content-addressed store, hash-verified

5719
5720/* for enlightenment; currently only useful in wizard mode; cf from_what() */
5721char *
5722item_what(int dmgtyp)
5723{
5724 static char whatbuf[50];
5725 const char *what = 0;
5726 int prop = adtyp_to_prop(dmgtyp);
5727 long xtrinsic = u.uprops[prop].extrinsic;
5728
5729 whatbuf[0] = '\0';
5730 if (wizard) {
5731 if (!prop || !xtrinsic) {
5732 ; /* 'what' stays Null */
5733 } else if (xtrinsic & W_ARMC) {
5734 what = cloak_simple_name(uarmc);
5735 } else if (xtrinsic & W_ARM) {
5736 what = suit_simple_name(uarm); /* "dragon {scales,mail}" */
5737 } else if (xtrinsic & W_ARMU) {
5738 what = shirt_simple_name(uarmu);
5739 } else if (xtrinsic & W_ARMH) {
5740 what = helm_simple_name(uarmh);
5741 } else if (xtrinsic & W_ARMG) {
5742 what = gloves_simple_name(uarmg);
5743 } else if (xtrinsic & W_ARMF) {
5744 what = boots_simple_name(uarmf);
5745 } else if (xtrinsic & W_ARMS) {
5746 what = shield_simple_name(uarms);
5747 } else if (xtrinsic & (W_AMUL | W_TOOL)) {
5748 what = simpleonames((xtrinsic & W_AMUL) ? uamul : ublindf);
5749 } else if (xtrinsic & W_RING) {
5750 if ((xtrinsic & W_RING) == W_RING) /* both */
5751 what = "rings";
5752 else
5753 what = simpleonames((xtrinsic & W_RINGL) ? uleft : uright);
5754 } else if (xtrinsic & W_WEP) {
5755 what = simpleonames(uwep);
5756 }
5757 /* format the output to be ready for enl_msg() to append it to
5758 "Your items {are,were} protected against <damage-type>" */
5759 if (what) /* strlen(what) will be less than 30 */
5760 Sprintf(whatbuf, " by your %.40s", what);
5761 }
5762 return whatbuf;
5763}
5764
5765/*
5766 * destroy_strings[dindx][0:singular,1:plural,2:killer_reason]

Callers 1

item_resistance_messageFunction · 0.85

Calls 9

adtyp_to_propFunction · 0.85
cloak_simple_nameFunction · 0.85
suit_simple_nameFunction · 0.85
shirt_simple_nameFunction · 0.85
helm_simple_nameFunction · 0.85
gloves_simple_nameFunction · 0.85
boots_simple_nameFunction · 0.85
shield_simple_nameFunction · 0.85
simpleonamesFunction · 0.85

Tested by

no test coverage detected