| 2262 | } |
| 2263 | |
| 2264 | staticfn void |
| 2265 | eataccessory(struct obj *otmp) |
| 2266 | { |
| 2267 | int typ = otmp->otyp; |
| 2268 | long oldprop; |
| 2269 | |
| 2270 | /* Note: rings are not so common that this is unbalancing. */ |
| 2271 | /* (How often do you even _find_ 3 rings of polymorph in a game?) */ |
| 2272 | oldprop = u.uprops[objects[typ].oc_oprop].intrinsic; |
| 2273 | if (otmp == uleft || otmp == uright) { |
| 2274 | Ring_gone(otmp); |
| 2275 | if (u.uhp <= 0) |
| 2276 | return; /* died from sink fall */ |
| 2277 | } |
| 2278 | observe_object(otmp); |
| 2279 | otmp->known = 1; /* by taste */ |
| 2280 | if (!rn2(otmp->oclass == RING_CLASS ? 3 : 5)) { |
| 2281 | switch (otmp->otyp) { |
| 2282 | default: |
| 2283 | if (!objects[typ].oc_oprop) |
| 2284 | break; /* should never happen */ |
| 2285 | |
| 2286 | if (!(u.uprops[objects[typ].oc_oprop].intrinsic & FROMOUTSIDE)) |
| 2287 | accessory_has_effect(otmp); |
| 2288 | |
| 2289 | u.uprops[objects[typ].oc_oprop].intrinsic |= FROMOUTSIDE; |
| 2290 | |
| 2291 | switch (typ) { |
| 2292 | case RIN_SEE_INVISIBLE: |
| 2293 | set_mimic_blocking(); |
| 2294 | see_monsters(); |
| 2295 | if (Invis && !oldprop && !ESee_invisible |
| 2296 | && !perceives(gy.youmonst.data) && !Blind) { |
| 2297 | newsym(u.ux, u.uy); |
| 2298 | pline("Suddenly you can see yourself."); |
| 2299 | makeknown(typ); |
| 2300 | } |
| 2301 | break; |
| 2302 | case RIN_INVISIBILITY: |
| 2303 | if (!oldprop && !EInvis && !BInvis && !See_invisible |
| 2304 | && !Blind) { |
| 2305 | newsym(u.ux, u.uy); |
| 2306 | Your("body takes on a %s transparency...", |
| 2307 | Hallucination ? "normal" : "strange"); |
| 2308 | makeknown(typ); |
| 2309 | } |
| 2310 | break; |
| 2311 | case RIN_PROTECTION_FROM_SHAPE_CHAN: |
| 2312 | rescham(); |
| 2313 | break; |
| 2314 | case RIN_LEVITATION: |
| 2315 | /* undo the `.intrinsic |= FROMOUTSIDE' done above */ |
| 2316 | u.uprops[LEVITATION].intrinsic = oldprop; |
| 2317 | if (!Levitation) { |
| 2318 | float_up(); |
| 2319 | incr_itimeout(&HLevitation, d(10, 20)); |
| 2320 | makeknown(typ); |
| 2321 | } |
no test coverage detected