From 49d5fbcf0ac5322ba010230f0340b701d89d7fc2 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 10 Jun 2016 19:56:24 +0200 Subject: taking damage --- src/Main.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/Main.hs') 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 import Data.Map.Strict (Map) import qualified Data.Map.Strict as Map +import Data.Set (Set) +import qualified Data.Set as Set + import Data.Bimap (Bimap) import qualified Data.Bimap as Bimap @@ -84,7 +87,10 @@ main = do , cmd "spend" spendSeq "Spend some of the current focusĀ“ AP" , cmd "delay" delay "Spend AP until the current focusĀ“ sequence is no higher than the next highest" , cmd "note" addNote "Add a note to the current focus" + , cmd "hit" takeHit "Damage the focused entity" + , cmd "fatigue" takeFatigue "Inflict fatigue damage upon the focused entity" ] + , wordBreakChars = wordBreakChars initialShellDescription \\ [',', '*'] } void $ runShell description haskelineBackend (def :: GameState) @@ -244,3 +250,9 @@ delay = withFocus $ \focusId -> () <$ runMaybeT (delay' focusId) addNote :: String -> Sh GameState () addNote note = withFocus $ \focusId -> gEntities . ix focusId . eNotes %= (note :) + +takeHit :: Int -> Completable (Set Hitzone) -> Sh GameState () +takeHit dmg = withArg $ \zones -> withFocus $ \focusId -> forM_ zones $ \zone -> gEntities . ix focusId . eStats . sDamage . ix zone += dmg + +takeFatigue :: Int -> Sh GameState () +takeFatigue dmg = withFocus $ \focusId -> gEntities . ix focusId . eStats . sFatigue += dmg -- cgit v1.2.3