diff options
author | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-25 12:56:47 +0200 |
---|---|---|
committer | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-25 12:56:47 +0200 |
commit | 7cb729577b26ce53ecd9c497be2e496b984f66d7 (patch) | |
tree | 1136c6256a678cfbe012d3faea8c31d8fd764268 /src | |
parent | 9983d6cfc0eebf0dff720a285db3b0f180c8b854 (diff) | |
download | 2017-01-16_17:13:37-7cb729577b26ce53ecd9c497be2e496b984f66d7.tar 2017-01-16_17:13:37-7cb729577b26ce53ecd9c497be2e496b984f66d7.tar.gz 2017-01-16_17:13:37-7cb729577b26ce53ecd9c497be2e496b984f66d7.tar.bz2 2017-01-16_17:13:37-7cb729577b26ce53ecd9c497be2e496b984f66d7.tar.xz 2017-01-16_17:13:37-7cb729577b26ce53ecd9c497be2e496b984f66d7.zip |
Allow dropping out of combat
Diffstat (limited to 'src')
-rw-r--r-- | src/Main.hs | 11 |
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' | |||
307 | factionSeqVal :: Completable Faction -> Sh GameState () | 309 | factionSeqVal :: Completable Faction -> Sh GameState () |
308 | factionSeqVal = withArg $ \qFaction -> use gEntities >>= mapM_ (entitySeqVal') . Map.keys . Map.filter ((==) qFaction . view eFaction) | 310 | factionSeqVal = withArg $ \qFaction -> use gEntities >>= mapM_ (entitySeqVal') . Map.keys . Map.filter ((==) qFaction . view eFaction) |
309 | 311 | ||
310 | entitySeqVal' :: EntityIdentifier -> Sh GameState () | 312 | clearEntitySeqVal :: Sh GameState () |
313 | clearEntitySeqVal = withFocus clearEntitySeqVal' | ||
314 | |||
315 | clearFactionSeqVal :: Completable Faction -> Sh GameState () | ||
316 | clearFactionSeqVal = withArg $ \qFaction -> use gEntities >>= mapM_ (clearEntitySeqVal') . Map.keys . Map.filter ((==) qFaction . view eFaction) | ||
317 | |||
318 | entitySeqVal', clearEntitySeqVal' :: EntityIdentifier -> Sh GameState () | ||
311 | entitySeqVal' ident = void . runMaybeT $ do | 319 | entitySeqVal' 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) |
331 | clearEntitySeqVal' ident = gEntities . ix ident . eSeqVal .= Nothing | ||
323 | 332 | ||
324 | spendSeq :: Int -> String -> Sh GameState () | 333 | spendSeq :: Int -> String -> Sh GameState () |
325 | spendSeq n logStr = withFocus $ \focusId -> do | 334 | spendSeq n logStr = withFocus $ \focusId -> do |