| 258 | static const char eyemsg[] = "%s momentarily %s."; |
| 259 | |
| 260 | void |
| 261 | make_blinded(long xtime, boolean talk) |
| 262 | { |
| 263 | long old = BlindedTimeout; |
| 264 | boolean u_could_see, can_see_now; |
| 265 | const char *eyes; |
| 266 | |
| 267 | /* we probe ahead in case the Eyes of the Overworld |
| 268 | are or will be overriding blindness */ |
| 269 | u_could_see = !Blind; |
| 270 | set_itimeout(&HBlinded, xtime ? 1L : 0L); |
| 271 | can_see_now = !Blind; |
| 272 | set_itimeout(&HBlinded, old); |
| 273 | |
| 274 | if (Unaware) |
| 275 | talk = FALSE; |
| 276 | |
| 277 | if (can_see_now && !u_could_see) { /* regaining sight */ |
| 278 | if (talk) { |
| 279 | if (Hallucination) |
| 280 | pline("Far out! Everything is all cosmic again!"); |
| 281 | else |
| 282 | You("can see again."); |
| 283 | } |
| 284 | } else if (old && !xtime) { |
| 285 | /* clearing temporary blindness without toggling blindness */ |
| 286 | if (talk) { |
| 287 | if (!haseyes(gy.youmonst.data) || PermaBlind) { |
| 288 | strange_feeling((struct obj *) 0, (char *) 0); |
| 289 | } else if (Blindfolded) { |
| 290 | eyes = body_part(EYE); |
| 291 | if (eyecount(gy.youmonst.data) != 1) |
| 292 | eyes = makeplural(eyes); |
| 293 | Your(eyemsg, eyes, vtense(eyes, "itch")); |
| 294 | } else { /* Eyes of the Overworld */ |
| 295 | Your(vismsg, "brighten", Hallucination ? "sadder" : "normal"); |
| 296 | } |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | if (u_could_see && !can_see_now) { /* losing sight */ |
| 301 | if (talk) { |
| 302 | if (Hallucination) |
| 303 | pline("Oh, bummer! Everything is dark! Help!"); |
| 304 | else |
| 305 | pline("A cloud of darkness falls upon you."); |
| 306 | } |
| 307 | /* Before the hero goes blind, set the ball&chain variables. */ |
| 308 | if (Punished) |
| 309 | set_bc(0); |
| 310 | } else if (!old && xtime) { |
| 311 | /* setting temporary blindness without toggling blindness */ |
| 312 | if (talk) { |
| 313 | if (!haseyes(gy.youmonst.data) || PermaBlind) { |
| 314 | strange_feeling((struct obj *) 0, (char *) 0); |
| 315 | } else if (Blindfolded) { |
| 316 | eyes = body_part(EYE); |
| 317 | if (eyecount(gy.youmonst.data) != 1) |
no test coverage detected