diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Main.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Main.hs b/src/Main.hs index 3d098e2..279a65d 100644 --- a/src/Main.hs +++ b/src/Main.hs | |||
@@ -163,11 +163,12 @@ stateMaintenance = do | |||
163 | (nStats, x) <- (evalFormula [name] :: Stats -> FormulaM Stats a -> MaybeT (Sh GameState) (Stats, a)) stats formula | 163 | (nStats, x) <- (evalFormula [name] :: Stats -> FormulaM Stats a -> MaybeT (Sh GameState) (Stats, a)) stats formula |
164 | lStats .= nStats | 164 | lStats .= nStats |
165 | return x | 165 | return x |
166 | isDead <- evalF =<< MaybeT (preuse $ lStats . sDead) | 166 | safe a = lift $ fromMaybe False <$> runMaybeT a |
167 | isUnconscious <- evalF =<< MaybeT (preuse $ lStats . sUnconscious) | 167 | isDead <- safe $ evalF =<< MaybeT (preuse $ lStats . sDead) |
168 | isDestroyed <- evalF =<< MaybeT (preuse $ lStats . sDestroyed) | 168 | isUnconscious <- safe $ evalF =<< MaybeT (preuse $ lStats . sUnconscious) |
169 | isDestroyed <- safe $ evalF =<< MaybeT (preuse $ lStats . sDestroyed) | ||
169 | guard $ isDead || isUnconscious || isDestroyed | 170 | guard $ isDead || isUnconscious || isDestroyed |
170 | case (isDead, isDestroyed, isUnconscious) of | 171 | case (isDead, isUnconscious, isDestroyed) of |
171 | (True, _, _) -> lift . shellPutStrLn $ name ++ " is dead" | 172 | (True, _, _) -> lift . shellPutStrLn $ name ++ " is dead" |
172 | (_, True, _) -> lift . shellPutStrLn $ name ++ " is unconscious" | 173 | (_, True, _) -> lift . shellPutStrLn $ name ++ " is unconscious" |
173 | (_, _, True) -> lift . shellPutStrLn $ name ++ " is destroyed" | 174 | (_, _, True) -> lift . shellPutStrLn $ name ++ " is destroyed" |