summaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-06-10 19:56:24 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2016-06-10 19:56:24 +0200
commit49d5fbcf0ac5322ba010230f0340b701d89d7fc2 (patch)
treea651511ebdae05c14b188982f695c19463fff7b1 /src/Main.hs
parent0daa059aa8c6ece13d337e6f3dba30b89527530d (diff)
download2017-01-16_17:13:37-49d5fbcf0ac5322ba010230f0340b701d89d7fc2.tar
2017-01-16_17:13:37-49d5fbcf0ac5322ba010230f0340b701d89d7fc2.tar.gz
2017-01-16_17:13:37-49d5fbcf0ac5322ba010230f0340b701d89d7fc2.tar.bz2
2017-01-16_17:13:37-49d5fbcf0ac5322ba010230f0340b701d89d7fc2.tar.xz
2017-01-16_17:13:37-49d5fbcf0ac5322ba010230f0340b701d89d7fc2.zip
taking damage
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Main.hs b/src/Main.hs
index d07cad5..e239bec 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -20,6 +20,9 @@ import qualified Data.CaseInsensitive as CI
20import Data.Map.Strict (Map) 20import Data.Map.Strict (Map)
21import qualified Data.Map.Strict as Map 21import qualified Data.Map.Strict as Map
22 22
23import Data.Set (Set)
24import qualified Data.Set as Set
25
23import Data.Bimap (Bimap) 26import Data.Bimap (Bimap)
24import qualified Data.Bimap as Bimap 27import qualified Data.Bimap as Bimap
25 28
@@ -84,7 +87,10 @@ main = do
84 , cmd "spend" spendSeq "Spend some of the current focus´ AP" 87 , cmd "spend" spendSeq "Spend some of the current focus´ AP"
85 , cmd "delay" delay "Spend AP until the current focus´ sequence is no higher than the next highest" 88 , cmd "delay" delay "Spend AP until the current focus´ sequence is no higher than the next highest"
86 , cmd "note" addNote "Add a note to the current focus" 89 , cmd "note" addNote "Add a note to the current focus"
90 , cmd "hit" takeHit "Damage the focused entity"
91 , cmd "fatigue" takeFatigue "Inflict fatigue damage upon the focused entity"
87 ] 92 ]
93 , wordBreakChars = wordBreakChars initialShellDescription \\ [',', '*']
88 } 94 }
89 void $ runShell description haskelineBackend (def :: GameState) 95 void $ runShell description haskelineBackend (def :: GameState)
90 96
@@ -244,3 +250,9 @@ delay = withFocus $ \focusId -> () <$ runMaybeT (delay' focusId)
244 250
245addNote :: String -> Sh GameState () 251addNote :: String -> Sh GameState ()
246addNote note = withFocus $ \focusId -> gEntities . ix focusId . eNotes %= (note :) 252addNote note = withFocus $ \focusId -> gEntities . ix focusId . eNotes %= (note :)
253
254takeHit :: Int -> Completable (Set Hitzone) -> Sh GameState ()
255takeHit dmg = withArg $ \zones -> withFocus $ \focusId -> forM_ zones $ \zone -> gEntities . ix focusId . eStats . sDamage . ix zone += dmg
256
257takeFatigue :: Int -> Sh GameState ()
258takeFatigue dmg = withFocus $ \focusId -> gEntities . ix focusId . eStats . sFatigue += dmg