summaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 8f44db8..9a6a486 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -95,6 +95,8 @@ main = do
95 , cmd "test" rollTest "Roll a test using the stats of the currently focused entity" 95 , cmd "test" rollTest "Roll a test using the stats of the currently focused entity"
96 , cmd "combat" entitySeqVal "Roll sequence value for the current focus and enter combat" 96 , cmd "combat" entitySeqVal "Roll sequence value for the current focus and enter combat"
97 , cmd "combat'" factionSeqVal "Roll sequence values for all members of a faction and have them enter combat" 97 , cmd "combat'" factionSeqVal "Roll sequence values for all members of a faction and have them enter combat"
98 , cmd "uncombat" clearEntitySeqVal "Drop the focused entity out of combat"
99 , cmd "uncombat'" clearFactionSeqVal "Drop all members of a faction out of combat"
98 , cmd "spend" spendSeq "Spend some of the current focus´ AP" 100 , cmd "spend" spendSeq "Spend some of the current focus´ AP"
99 , cmd "delay" delay "Spend AP until the current focus´ sequence is no higher than the next highest and focus that one" 101 , 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" 102 , cmd "note" addNote "Add a note to the current focus"
@@ -307,7 +309,13 @@ entitySeqVal = withFocus entitySeqVal'
307factionSeqVal :: Completable Faction -> Sh GameState () 309factionSeqVal :: Completable Faction -> Sh GameState ()
308factionSeqVal = withArg $ \qFaction -> use gEntities >>= mapM_ (entitySeqVal') . Map.keys . Map.filter ((==) qFaction . view eFaction) 310factionSeqVal = withArg $ \qFaction -> use gEntities >>= mapM_ (entitySeqVal') . Map.keys . Map.filter ((==) qFaction . view eFaction)
309 311
310entitySeqVal' :: EntityIdentifier -> Sh GameState () 312clearEntitySeqVal :: Sh GameState ()
313clearEntitySeqVal = withFocus clearEntitySeqVal'
314
315clearFactionSeqVal :: Completable Faction -> Sh GameState ()
316clearFactionSeqVal = withArg $ \qFaction -> use gEntities >>= mapM_ (clearEntitySeqVal') . Map.keys . Map.filter ((==) qFaction . view eFaction)
317
318entitySeqVal', clearEntitySeqVal' :: EntityIdentifier -> Sh GameState ()
311entitySeqVal' ident = void . runMaybeT $ do 319entitySeqVal' ident = void . runMaybeT $ do
312 entity <- MaybeT $ preuse (gEntities . ix ident) 320 entity <- MaybeT $ preuse (gEntities . ix ident)
313 let sVal = fromMaybe (val ignored ["Sequenzwert"] False) $ preview (eStats . sSeqVal) entity 321 let sVal = fromMaybe (val ignored ["Sequenzwert"] False) $ preview (eStats . sSeqVal) entity
@@ -320,6 +328,7 @@ entitySeqVal' ident = void . runMaybeT $ do
320 & set seqEpsilon (entity ^. eStats . sSeqEpsilon) 328 & set seqEpsilon (entity ^. eStats . sSeqEpsilon)
321 gEntities . at ident .= Just (newEntity & set eSeqVal val) 329 gEntities . at ident .= Just (newEntity & set eSeqVal val)
322 gLog <>= pure (ident, "Sequence: " ++ show sNum) 330 gLog <>= pure (ident, "Sequence: " ++ show sNum)
331clearEntitySeqVal' ident = gEntities . ix ident . eSeqVal .= Nothing
323 332
324spendSeq :: Int -> String -> Sh GameState () 333spendSeq :: Int -> String -> Sh GameState ()
325spendSeq n logStr = withFocus $ \focusId -> do 334spendSeq n logStr = withFocus $ \focusId -> do