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

Function toggle_stealth

src/do_wear.c:105–140  ·  view source on GitHub ↗

putting on or taking off an item which confers stealth; give feedback and discover it iff stealth state is changing; stealth is blocked by riding unless hero+steed fly (handled with BStealth by mount and dismount routines) */

Source from the content-addressed store, hash-verified

103 stealth is blocked by riding unless hero+steed fly (handled with
104 BStealth by mount and dismount routines) */
105staticfn
106void
107toggle_stealth(
108 struct obj *obj,
109 long oldprop, /* prop[].extrinsic, with obj->owornmask pre-stripped */
110 boolean on)
111{
112 if (on ? gi.initial_don : svc.context.takeoff.cancelled_don)
113 return;
114
115 if (!oldprop /* extrinsic stealth from something else */
116 && !HStealth /* intrinsic stealth */
117 && !BStealth) { /* stealth blocked by something */
118 if (obj->otyp == RIN_STEALTH)
119 learnring(obj, TRUE);
120 else /* discover elven cloak or elven boots */
121 makeknown(obj->otyp);
122
123 if (on) {
124 if (!is_boots(obj))
125 You("move very quietly.");
126 else if (Levitation || Flying)
127 You("float imperceptibly.");
128 else
129 You("walk very quietly.");
130 } else {
131 boolean riding = (u.usteed != NULL);
132
133 You("%s%s are noisy.", riding ? "and " : "sure",
134 riding ? x_monnam(u.usteed, ARTICLE_YOUR, (char *) NULL,
135 (SUPPRESS_SADDLE | SUPPRESS_HALLUCINATION),
136 FALSE)
137 : "");
138 }
139 }
140}
141
142/* putting on or taking off an item which confers displacement, or gaining
143 or losing timed displacement after eating a displacer beast corpse or tin;

Callers 6

Boots_onFunction · 0.85
Boots_offFunction · 0.85
Cloak_onFunction · 0.85
Cloak_offFunction · 0.85
Ring_onFunction · 0.85
Ring_off_or_goneFunction · 0.85

Calls 2

learnringFunction · 0.85
YouFunction · 0.85

Tested by

no test coverage detected