From 23e50d1cf2ebd4d7e020a76ba4fc9e1e33b9f587 Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Tue, 31 May 2016 00:49:04 +1000 Subject: [PATCH] - Safety googles (and anything tinted) will protect you from being blinded by bright lights. --- data.c | 1 + lf.c | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/data.c b/data.c index e7f436a..a7cfe71 100644 --- a/data.c +++ b/data.c @@ -8418,6 +8418,7 @@ void initobjects(void) { addflag(lastot->flags, F_RARITY, H_FOREST, 100, RR_COMMON, NULL); addflag(lastot->flags, F_GOESON, BP_EYES, NA, NA, NULL); addflag(lastot->flags, F_OBHP, 20, 20, NA, NULL); + addflag(lastot->flags, F_TINTED, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOQUALITY, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_CRITPROTECTION, 100, NA, NA, NULL); addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); diff --git a/lf.c b/lf.c index fbf8b13..3faca7c 100644 --- a/lf.c +++ b/lf.c @@ -13917,14 +13917,22 @@ int lfproduceslight(lifeform_t *lf, object_t **fromwhat) { } int lighthurtseyes(lifeform_t *lf) { - // note: if you don't have eyes, your'e safe! - if (!isblind(lf) && !lfhasflagval(lf, F_NOBODYPART, BP_EYES, NA, NA, NULL)) { - flag_t *f; - f = lfhasflag(lf, F_SEEINDARK); - if (f && (f->val[1] == B_BLINDABLE)) { - return B_TRUE; - } + flag_t *f; + + if (eyesshaded(lf)) return B_FALSE; + + if (isblind(lf)) return B_FALSE; + + // if you don't have eyes, your'e safe! + if (lfhasflagval(lf, F_NOBODYPART, BP_EYES, NA, NA, NULL)) { + return B_FALSE; } + + f = lfhasflag(lf, F_SEEINDARK); + if (f && (f->val[1] == B_BLINDABLE)) { + return B_TRUE; + } + return B_FALSE; }