diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-06-08 22:45:07 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-06-08 22:45:07 +0200 |
commit | 85486c4838e23ca6d8b643c759d4e2a3035ef61d (patch) | |
tree | ca642cb38eae17ba88002c97973d79a9f34bf457 /src/Main.hs | |
parent | 73c24db325e741ca9402152d934bd28c7ac89fed (diff) | |
download | 2017-01-16_17:13:37-85486c4838e23ca6d8b643c759d4e2a3035ef61d.tar 2017-01-16_17:13:37-85486c4838e23ca6d8b643c759d4e2a3035ef61d.tar.gz 2017-01-16_17:13:37-85486c4838e23ca6d8b643c759d4e2a3035ef61d.tar.bz2 2017-01-16_17:13:37-85486c4838e23ca6d8b643c759d4e2a3035ef61d.tar.xz 2017-01-16_17:13:37-85486c4838e23ca6d8b643c759d4e2a3035ef61d.zip |
framework for damage tracking
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Main.hs b/src/Main.hs index 145df7a..b7c6a6e 100644 --- a/src/Main.hs +++ b/src/Main.hs | |||
@@ -15,7 +15,7 @@ import System.Directory | |||
15 | 15 | ||
16 | import Data.Default | 16 | import Data.Default |
17 | import Data.CaseInsensitive (CI) | 17 | import Data.CaseInsensitive (CI) |
18 | import qualified Data.CaseInsensitive | 18 | import qualified Data.CaseInsensitive as CI |
19 | 19 | ||
20 | import Data.Map.Strict (Map) | 20 | import Data.Map.Strict (Map) |
21 | import qualified Data.Map.Strict as Map | 21 | import qualified Data.Map.Strict as Map |
@@ -183,7 +183,8 @@ rollTest = withArg $ enactTest' >=> maybe (return ()) (shellPutStrLn . ppResult) | |||
183 | 183 | ||
184 | enactTest' :: (FormulaM Stats Test) -> Sh GameState (Maybe TestResult) | 184 | enactTest' :: (FormulaM Stats Test) -> Sh GameState (Maybe TestResult) |
185 | enactTest' test = withFocus' $ \focus -> do | 185 | enactTest' test = withFocus' $ \focus -> do |
186 | (newFocus, result) <- evalFormula focus (enactTest =<< test) | 186 | focusName <- use gFocus >>= toName . fromJust |
187 | (newFocus, result) <- evalFormula focusName focus (enactTest =<< test) | ||
187 | gFocus' .= newFocus | 188 | gFocus' .= newFocus |
188 | return result | 189 | return result |
189 | 190 | ||
@@ -200,5 +201,6 @@ entitySeqVal' ident = do | |||
200 | case (,) <$> entity <*> sVal of | 201 | case (,) <$> entity <*> sVal of |
201 | Nothing -> return () | 202 | Nothing -> return () |
202 | Just (entity, sVal) -> do | 203 | Just (entity, sVal) -> do |
203 | (newEntity, view (seqVal . re _Just) -> val) <- evalFormula entity sVal | 204 | name <- toName ident |
205 | (newEntity, view (seqVal . re _Just) -> val) <- evalFormula name entity sVal | ||
204 | gEntities . at ident .= Just (newEntity & set eSeqVal val) | 206 | gEntities . at ident .= Just (newEntity & set eSeqVal val) |