diff options
author | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-09 12:49:05 +0200 |
---|---|---|
committer | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-09 12:49:05 +0200 |
commit | 90c94957cb7f1fef4df051d18700a34ecb797293 (patch) | |
tree | b71a81f6c6ee2cbbe5d0dfb7e10ab22a9e47bc60 /src | |
parent | c95106d9230df8a8cd8536b6fd1710550ab68128 (diff) | |
download | 2017-01-16_17:13:37-90c94957cb7f1fef4df051d18700a34ecb797293.tar 2017-01-16_17:13:37-90c94957cb7f1fef4df051d18700a34ecb797293.tar.gz 2017-01-16_17:13:37-90c94957cb7f1fef4df051d18700a34ecb797293.tar.bz2 2017-01-16_17:13:37-90c94957cb7f1fef4df051d18700a34ecb797293.tar.xz 2017-01-16_17:13:37-90c94957cb7f1fef4df051d18700a34ecb797293.zip |
unified damage dealing & healing
Diffstat (limited to 'src')
-rw-r--r-- | src/Main.hs | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/Main.hs b/src/Main.hs index 46f1fa6..4b78ae2 100644 --- a/src/Main.hs +++ b/src/Main.hs | |||
@@ -99,7 +99,8 @@ main = do | |||
99 | , cmd "delay" delay "Spend AP until the current focusĀ“ sequence is no higher than the next highest and focus that one" | 99 | , cmd "delay" delay "Spend AP until the current focusĀ“ sequence is no higher than the next highest and focus that one" |
100 | , cmd "note" addNote "Add a note to the current focus" | 100 | , cmd "note" addNote "Add a note to the current focus" |
101 | , cmd "hit" takeHit "Damage the focused entity" | 101 | , cmd "hit" takeHit "Damage the focused entity" |
102 | , cmd "fatigue" takeFatigue "Inflict fatigue damage upon the focused entity" | 102 | , cmd "heal" healDmg "Heal the focused entity" |
103 | , cmd "heal'" healFatigue "Heal the focused entity of fatigue" | ||
103 | , cmd "log" dumpLog "Print the combat log" | 104 | , cmd "log" dumpLog "Print the combat log" |
104 | , cmd "val" printVal "Find the distribution of a specific value of the current entities" | 105 | , cmd "val" printVal "Find the distribution of a specific value of the current entities" |
105 | ] | 106 | ] |
@@ -375,11 +376,17 @@ takeHit dmg a1 a2 = flip withArg a1 $ \zones -> flip withArg a2 $ \dType -> with | |||
375 | _ -> lift $ do | 376 | _ -> lift $ do |
376 | doShock dmg (sCripple . ix zone) | 377 | doShock dmg (sCripple . ix zone) |
377 | doShock dmg sPainShock | 378 | doShock dmg sPainShock |
378 | 379 | ||
379 | takeFatigue :: Int -> Sh GameState () | 380 | healDmg :: Int -> Completable (Set Hitzone) -> Sh GameState () |
380 | takeFatigue dmg = withFocus $ \focusId -> do | 381 | healDmg n = withArg $ \zones -> withFocus $ \focusId -> do |
381 | gEntities . ix focusId . eStats . sFatigue += dmg | 382 | gLog <>= pure (focusId, "Heal " ++ show (map (review hitzone) $ toList zones) ++ " for " ++ show n ++ " each") |
382 | doShock dmg sFatigueShock | 383 | forM_ zones $ \zone -> do |
384 | gEntities . ix focusId . eStats . sDamage . ix zone -= n | ||
385 | |||
386 | healFatigue :: Int -> Sh GameState () | ||
387 | healFatigue n = withFocus $ \focusId -> do | ||
388 | gLog <>= pure (focusId, "Heal for " ++ show n ++ " Fatigue") | ||
389 | gEntities . ix focusId . eStats . sFatigue -= n | ||
383 | 390 | ||
384 | dumpLog :: Sh GameState () | 391 | dumpLog :: Sh GameState () |
385 | dumpLog = use gLog >>= mapMOf (each . _1) toName >>= shellPutStrLn . toTable | 392 | dumpLog = use gLog >>= mapMOf (each . _1) toName >>= shellPutStrLn . toTable |