From eea3a546370ed95321dcc21b4db739ad0d893dfb Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 25 Jun 2016 17:50:52 +0200 Subject: Inspect entities --- src/Main.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/Main.hs') 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 , cmd "hit" takeHit "Damage the focused entity" , cmd "fatigue" takeFatigue "Inflict fatigue damage upon the focused entity" , cmd "log" dumpLog "Print the combat log" + , cmd "val" printVal "Find the distribution of a specific value of the current entities" ] - , wordBreakChars = wordBreakChars initialShellDescription \\ [',', '*'] + , wordBreakChars = wordBreakChars initialShellDescription \\ [','] } void $ runShell description haskelineBackend (def :: GameState) @@ -336,7 +337,7 @@ doShock dmg efLens = withFocus $ \focusId -> do then guard $ dmg >= reBar else guard $ val >= bar lStats . efLens . seApplied .= True - (CI.original -> effectName, effect) <- view _Effect <$> (evalF . table $ cripple ^. seEffect) + Effect (CI.original -> effectName) effect <- evalF . table $ cripple ^. seEffect lStats <~ (MaybeT . fmap join . runMaybeT $ evalF effect) lift $ shellPutStrLn effectName lift . addNote $ "Effect: " ++ effectName @@ -371,3 +372,8 @@ dumpLog = use gLog >>= mapMOf (each . _1) toName >>= shellPutStrLn . toTable where toTable :: Seq (String, String) -> String toTable (map (rowG . toListOf both) . toList -> table) = layoutTableToString table (Just (["Entity", "String"], [def, def])) [def, def] unicodeBoldHeaderS + +printVal :: Completable (Formula Stats) -> Sh GameState () +printVal = withArg $ \formula -> withFocus $ \focusId -> do + name <- toName focusId + shellPutStrLn . show =<< focusState (gEntities . ix focusId . eStats) (findDistribution' [name] formula) -- cgit v1.2.3