diff options
author | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-06-25 17:50:52 +0200 |
---|---|---|
committer | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-06-25 17:50:52 +0200 |
commit | eea3a546370ed95321dcc21b4db739ad0d893dfb (patch) | |
tree | 6e7686fcd84dccf83d85b4245022ec61e1a5f8d2 /src/Main.hs | |
parent | 7a80cf63d55c62a2e5fbf4c937fae4e33f5629c2 (diff) | |
download | 2017-01-16_17:13:37-eea3a546370ed95321dcc21b4db739ad0d893dfb.tar 2017-01-16_17:13:37-eea3a546370ed95321dcc21b4db739ad0d893dfb.tar.gz 2017-01-16_17:13:37-eea3a546370ed95321dcc21b4db739ad0d893dfb.tar.bz2 2017-01-16_17:13:37-eea3a546370ed95321dcc21b4db739ad0d893dfb.tar.xz 2017-01-16_17:13:37-eea3a546370ed95321dcc21b4db739ad0d893dfb.zip |
Inspect entities
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Main.hs b/src/Main.hs index 636e5ea..eeed4d9 100644 --- a/src/Main.hs +++ b/src/Main.hs | |||
@@ -99,8 +99,9 @@ main = do | |||
99 | , cmd "hit" takeHit "Damage the focused entity" | 99 | , cmd "hit" takeHit "Damage the focused entity" |
100 | , cmd "fatigue" takeFatigue "Inflict fatigue damage upon the focused entity" | 100 | , cmd "fatigue" takeFatigue "Inflict fatigue damage upon the focused entity" |
101 | , cmd "log" dumpLog "Print the combat log" | 101 | , cmd "log" dumpLog "Print the combat log" |
102 | , cmd "val" printVal "Find the distribution of a specific value of the current entities" | ||
102 | ] | 103 | ] |
103 | , wordBreakChars = wordBreakChars initialShellDescription \\ [',', '*'] | 104 | , wordBreakChars = wordBreakChars initialShellDescription \\ [','] |
104 | } | 105 | } |
105 | void $ runShell description haskelineBackend (def :: GameState) | 106 | void $ runShell description haskelineBackend (def :: GameState) |
106 | 107 | ||
@@ -336,7 +337,7 @@ doShock dmg efLens = withFocus $ \focusId -> do | |||
336 | then guard $ dmg >= reBar | 337 | then guard $ dmg >= reBar |
337 | else guard $ val >= bar | 338 | else guard $ val >= bar |
338 | lStats . efLens . seApplied .= True | 339 | lStats . efLens . seApplied .= True |
339 | (CI.original -> effectName, effect) <- view _Effect <$> (evalF . table $ cripple ^. seEffect) | 340 | Effect (CI.original -> effectName) effect <- evalF . table $ cripple ^. seEffect |
340 | lStats <~ (MaybeT . fmap join . runMaybeT $ evalF effect) | 341 | lStats <~ (MaybeT . fmap join . runMaybeT $ evalF effect) |
341 | lift $ shellPutStrLn effectName | 342 | lift $ shellPutStrLn effectName |
342 | lift . addNote $ "Effect: " ++ effectName | 343 | lift . addNote $ "Effect: " ++ effectName |
@@ -371,3 +372,8 @@ dumpLog = use gLog >>= mapMOf (each . _1) toName >>= shellPutStrLn . toTable | |||
371 | where | 372 | where |
372 | toTable :: Seq (String, String) -> String | 373 | toTable :: Seq (String, String) -> String |
373 | toTable (map (rowG . toListOf both) . toList -> table) = layoutTableToString table (Just (["Entity", "String"], [def, def])) [def, def] unicodeBoldHeaderS | 374 | toTable (map (rowG . toListOf both) . toList -> table) = layoutTableToString table (Just (["Entity", "String"], [def, def])) [def, def] unicodeBoldHeaderS |
375 | |||
376 | printVal :: Completable (Formula Stats) -> Sh GameState () | ||
377 | printVal = withArg $ \formula -> withFocus $ \focusId -> do | ||
378 | name <- toName focusId | ||
379 | shellPutStrLn . show =<< focusState (gEntities . ix focusId . eStats) (findDistribution' [name] formula) | ||