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) */
| 103 | stealth is blocked by riding unless hero+steed fly (handled with |
| 104 | BStealth by mount and dismount routines) */ |
| 105 | staticfn |
| 106 | void |
| 107 | toggle_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; |