diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-06-10 14:20:08 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-06-10 14:20:08 +0200 |
commit | 486604532fa99fd294bb2d0c4166d815de6d4fde (patch) | |
tree | 03000fb1b99b75e94c0836e20180e9a82d578e66 /src | |
parent | d8b49cbe1aff7cb3fcacac01d36128a248fc848b (diff) | |
download | 2017-01-16_17:13:37-486604532fa99fd294bb2d0c4166d815de6d4fde.tar 2017-01-16_17:13:37-486604532fa99fd294bb2d0c4166d815de6d4fde.tar.gz 2017-01-16_17:13:37-486604532fa99fd294bb2d0c4166d815de6d4fde.tar.bz2 2017-01-16_17:13:37-486604532fa99fd294bb2d0c4166d815de6d4fde.tar.xz 2017-01-16_17:13:37-486604532fa99fd294bb2d0c4166d815de6d4fde.zip |
entity notes
Diffstat (limited to 'src')
-rw-r--r-- | src/Main.hs | 20 | ||||
-rw-r--r-- | src/Sequence/Contact/Archetypes.hs | 5 | ||||
-rw-r--r-- | src/Sequence/Types.hs | 2 |
3 files changed, 24 insertions, 3 deletions
diff --git a/src/Main.hs b/src/Main.hs index e6d694a..36f2687 100644 --- a/src/Main.hs +++ b/src/Main.hs | |||
@@ -59,7 +59,10 @@ main = do | |||
59 | description = initialShellDescription | 59 | description = initialShellDescription |
60 | { historyFile = Just historyFile | 60 | { historyFile = Just historyFile |
61 | , prompt = \st -> return $ maybe "" (++ " ") ((evalState ?? st) . toName <$> view gFocus st) ++ "→ " | 61 | , prompt = \st -> return $ maybe "" (++ " ") ((evalState ?? st) . toName <$> view gFocus st) ++ "→ " |
62 | , beforePrompt = gets stateOutline >>= (\str -> if null str then return () else shellPutStrLn str) | 62 | , beforePrompt = do |
63 | { gets stateOutline >>= (\str -> if null str then return () else shellPutStr str) | ||
64 | ; gets focusNotes >>= (\str -> if null str then return () else shellPutStrLn str) | ||
65 | } | ||
63 | , commandStyle = OnlyCommands | 66 | , commandStyle = OnlyCommands |
64 | , shellCommands = [ exitCommand "exit" | 67 | , shellCommands = [ exitCommand "exit" |
65 | , helpCommand "help" | 68 | , helpCommand "help" |
@@ -80,6 +83,7 @@ main = do | |||
80 | , cmd "combat'" factionSeqVal "Roll sequence values for all members of a faction and have them enter combat" | 83 | , cmd "combat'" factionSeqVal "Roll sequence values for all members of a faction and have them enter combat" |
81 | , cmd "spend" spendSeq "Spend some of the current focus´ AP" | 84 | , cmd "spend" spendSeq "Spend some of the current focus´ AP" |
82 | , cmd "delay" delay "Spend AP until the current focus´ sequence is no higher than the next highest" | 85 | , cmd "delay" delay "Spend AP until the current focus´ sequence is no higher than the next highest" |
86 | , cmd "note" addNote "Add a note to the current focus" | ||
83 | ] | 87 | ] |
84 | } | 88 | } |
85 | void $ runShell description haskelineBackend (def :: GameState) | 89 | void $ runShell description haskelineBackend (def :: GameState) |
@@ -106,6 +110,15 @@ stateOutline st | |||
106 | roundStr n = show n ++ " Rounds later" | 110 | roundStr n = show n ++ " Rounds later" |
107 | factions = map (view faction') $ st ^. inhabitedFactions | 111 | factions = map (view faction') $ st ^. inhabitedFactions |
108 | 112 | ||
113 | focusNotes :: GameState -> String | ||
114 | focusNotes = maybe "" (unlines . map dotted) . preview (gFocus' . eNotes) | ||
115 | where | ||
116 | dotted "" = " • " | ||
117 | dotted str | ||
118 | | fstL : [] <- lines str = " • " ++ fstL | ||
119 | | fstL : tailL <- lines str = " • " ++ fstL ++ "\n" ++ unlines (map (" " ++ ) tailL) | ||
120 | | otherwise = "" | ||
121 | |||
109 | -- Query state | 122 | -- Query state |
110 | listFactions, listEntities :: Sh GameState () | 123 | listFactions, listEntities :: Sh GameState () |
111 | listFactions = use inhabitedFactions >>= mapM_ (shellPutStrLn . view faction') | 124 | listFactions = use inhabitedFactions >>= mapM_ (shellPutStrLn . view faction') |
@@ -119,7 +132,7 @@ blur = gFocus .= Nothing | |||
119 | -- Manual focus | 132 | -- Manual focus |
120 | setFocus :: Completable EntityIdentifier -> Sh GameState () | 133 | setFocus :: Completable EntityIdentifier -> Sh GameState () |
121 | setFocus = withArg $ \ident -> gFocus ?= ident | 134 | setFocus = withArg $ \ident -> gFocus ?= ident |
122 | 135 | ||
123 | -- Drop information | 136 | -- Drop information |
124 | remove :: Sh GameState () | 137 | remove :: Sh GameState () |
125 | remove = withFocus $ \ident -> do | 138 | remove = withFocus $ \ident -> do |
@@ -228,3 +241,6 @@ delay = withFocus $ \focusId -> () <$ runMaybeT (delay' focusId) | |||
228 | focusSeq <- MaybeT . preuse $ gEntities . ix focusId . eStats . sSequence . _Just . seqVal . _Just | 241 | focusSeq <- MaybeT . preuse $ gEntities . ix focusId . eStats . sSequence . _Just . seqVal . _Just |
229 | guard $ focusSeq > tipSeq | 242 | guard $ focusSeq > tipSeq |
230 | lift . spendSeq $ focusSeq - tipSeq | 243 | lift . spendSeq $ focusSeq - tipSeq |
244 | |||
245 | addNote :: String -> Sh GameState () | ||
246 | addNote note = withFocus $ \focusId -> gEntities . ix focusId . eNotes %= (note :) | ||
diff --git a/src/Sequence/Contact/Archetypes.hs b/src/Sequence/Contact/Archetypes.hs index 32cfa22..30aa2b6 100644 --- a/src/Sequence/Contact/Archetypes.hs +++ b/src/Sequence/Contact/Archetypes.hs | |||
@@ -96,6 +96,7 @@ human = Humanoid | |||
96 | , _sPainTolerance = vMass `quot'` 2 + vWillpower | 96 | , _sPainTolerance = vMass `quot'` 2 + vWillpower |
97 | , _sFatigueTolerance = vWillpower `quot'` 2 + vEndurance | 97 | , _sFatigueTolerance = vWillpower `quot'` 2 + vEndurance |
98 | 98 | ||
99 | , _sSeqEpsilon = False | ||
99 | 100 | ||
100 | , _sHitzones = cTable [ (1, 5, "Kopf") | 101 | , _sHitzones = cTable [ (1, 5, "Kopf") |
101 | , (6, 54, "Torso") | 102 | , (6, 54, "Torso") |
@@ -173,6 +174,8 @@ dog = Quadruped | |||
173 | , _sPainTolerance = vMass `quot'` 2 + vWillpower | 174 | , _sPainTolerance = vMass `quot'` 2 + vWillpower |
174 | , _sFatigueTolerance = vWillpower `quot'` 2 + vEndurance | 175 | , _sFatigueTolerance = vWillpower `quot'` 2 + vEndurance |
175 | 176 | ||
177 | , _sSeqEpsilon = False | ||
178 | |||
176 | , _sHitzones = [ ("Kopf", 0.05) | 179 | , _sHitzones = [ ("Kopf", 0.05) |
177 | , ("Torso", 0.49) | 180 | , ("Torso", 0.49) |
178 | , ("Rechter Vorderlauf", 0.08) | 181 | , ("Rechter Vorderlauf", 0.08) |
@@ -208,6 +211,8 @@ dolphin = Dolphin | |||
208 | , _sPainTolerance = vMass `quot'` 2 + vWillpower | 211 | , _sPainTolerance = vMass `quot'` 2 + vWillpower |
209 | , _sFatigueTolerance = vWillpower `quot'` 2 + vEndurance | 212 | , _sFatigueTolerance = vWillpower `quot'` 2 + vEndurance |
210 | 213 | ||
214 | , _sSeqEpsilon = False | ||
215 | |||
211 | , _sHitzones = [ ("Kopf", 0.10) | 216 | , _sHitzones = [ ("Kopf", 0.10) |
212 | , ("Rumpf", 0.65) | 217 | , ("Rumpf", 0.65) |
213 | , ("Schwanz", 0.25) | 218 | , ("Schwanz", 0.25) |
diff --git a/src/Sequence/Types.hs b/src/Sequence/Types.hs index f5bf010..6594f78 100644 --- a/src/Sequence/Types.hs +++ b/src/Sequence/Types.hs | |||
@@ -3,7 +3,7 @@ | |||
3 | module Sequence.Types | 3 | module Sequence.Types |
4 | ( GameState, gEntities, gEntityNames, gFocus, gNextId' | 4 | ( GameState, gEntities, gEntityNames, gFocus, gNextId' |
5 | , Faction, faction, faction' | 5 | , Faction, faction, faction' |
6 | , Entity(..), eFaction, eSeqVal, eStats | 6 | , Entity(..), eFaction, eSeqVal, eStats, eNotes |
7 | , EntityName(..), entityName | 7 | , EntityName(..), entityName |
8 | , EntityIdentifier(..), entityId, entityId' | 8 | , EntityIdentifier(..), entityId, entityId' |
9 | , inhabitedFactions, priorityQueue, tip, insertEntity, gFocus', gRounds, gRounds', gRound | 9 | , inhabitedFactions, priorityQueue, tip, insertEntity, gFocus', gRounds, gRounds', gRound |