summaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-06-08 22:45:07 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2016-06-08 22:45:07 +0200
commit85486c4838e23ca6d8b643c759d4e2a3035ef61d (patch)
treeca642cb38eae17ba88002c97973d79a9f34bf457 /src/Main.hs
parent73c24db325e741ca9402152d934bd28c7ac89fed (diff)
download2017-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.hs8
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
16import Data.Default 16import Data.Default
17import Data.CaseInsensitive (CI) 17import Data.CaseInsensitive (CI)
18import qualified Data.CaseInsensitive 18import qualified Data.CaseInsensitive as CI
19 19
20import Data.Map.Strict (Map) 20import Data.Map.Strict (Map)
21import qualified Data.Map.Strict as Map 21import qualified Data.Map.Strict as Map
@@ -183,7 +183,8 @@ rollTest = withArg $ enactTest' >=> maybe (return ()) (shellPutStrLn . ppResult)
183 183
184enactTest' :: (FormulaM Stats Test) -> Sh GameState (Maybe TestResult) 184enactTest' :: (FormulaM Stats Test) -> Sh GameState (Maybe TestResult)
185enactTest' test = withFocus' $ \focus -> do 185enactTest' 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)