True if monster is resistant to light-induced blindness */
| 245 | |
| 246 | /* True if monster is resistant to light-induced blindness */ |
| 247 | boolean |
| 248 | resists_blnd(struct monst *mon) |
| 249 | { |
| 250 | struct permonst *ptr = mon->data; |
| 251 | boolean is_you = (mon == &gy.youmonst); |
| 252 | |
| 253 | if (is_you ? (Blind || Unaware) |
| 254 | : (mon->mblinded || !mon->mcansee || !haseyes(ptr) |
| 255 | /* BUG: temporary sleep sets mfrozen, but since |
| 256 | paralysis does too, we can't check it */ |
| 257 | || mon->msleeping)) |
| 258 | return TRUE; |
| 259 | /* yellow light, Archon; !dust vortex, !cobra, !raven */ |
| 260 | if (dmgtype_fromattack(ptr, AD_BLND, AT_EXPL) |
| 261 | || dmgtype_fromattack(ptr, AD_BLND, AT_GAZE)) |
| 262 | return TRUE; |
| 263 | /* Sunsword */ |
| 264 | if (resists_blnd_by_arti(mon)) |
| 265 | return TRUE; |
| 266 | /* catchall */ |
| 267 | if (is_you && Blnd_resist) { |
| 268 | impossible("'Blnd_resist' but not resists_blnd()?"); |
| 269 | return TRUE; |
| 270 | } |
| 271 | return FALSE; |
| 272 | } |
| 273 | |
| 274 | /* True iff monster is resistant to light-induced blindness due to worn |
| 275 | or wielded magical equipment (used to decide whether to show sparkle |
no test coverage detected