diff options
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) | ||