diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-06-10 19:56:24 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-06-10 19:56:24 +0200 |
commit | 49d5fbcf0ac5322ba010230f0340b701d89d7fc2 (patch) | |
tree | a651511ebdae05c14b188982f695c19463fff7b1 /src/Main.hs | |
parent | 0daa059aa8c6ece13d337e6f3dba30b89527530d (diff) | |
download | 2017-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.hs | 12 |
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 | |||
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 |
22 | 22 | ||
23 | import Data.Set (Set) | ||
24 | import qualified Data.Set as Set | ||
25 | |||
23 | import Data.Bimap (Bimap) | 26 | import Data.Bimap (Bimap) |
24 | import qualified Data.Bimap as Bimap | 27 | import 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 | ||
245 | addNote :: String -> Sh GameState () | 251 | addNote :: String -> Sh GameState () |
246 | addNote note = withFocus $ \focusId -> gEntities . ix focusId . eNotes %= (note :) | 252 | addNote note = withFocus $ \focusId -> gEntities . ix focusId . eNotes %= (note :) |
253 | |||
254 | takeHit :: Int -> Completable (Set Hitzone) -> Sh GameState () | ||
255 | takeHit dmg = withArg $ \zones -> withFocus $ \focusId -> forM_ zones $ \zone -> gEntities . ix focusId . eStats . sDamage . ix zone += dmg | ||
256 | |||
257 | takeFatigue :: Int -> Sh GameState () | ||
258 | takeFatigue dmg = withFocus $ \focusId -> gEntities . ix focusId . eStats . sFatigue += dmg | ||