summaryrefslogtreecommitdiff
path: root/src/Sequence
diff options
context:
space:
mode:
Diffstat (limited to 'src/Sequence')
-rw-r--r--src/Sequence/Contact/Archetypes.hs13
-rw-r--r--src/Sequence/Contact/Types.hs6
-rw-r--r--src/Sequence/Contact/Types/Internal.hs15
-rw-r--r--src/Sequence/Types.hs19
4 files changed, 37 insertions, 16 deletions
diff --git a/src/Sequence/Contact/Archetypes.hs b/src/Sequence/Contact/Archetypes.hs
index ff37fdb..32cfa22 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
99 , _sHitzones = cTable [ (1, 5, "Kopf") 100 , _sHitzones = cTable [ (1, 5, "Kopf")
100 , (6, 54, "Torso") 101 , (6, 54, "Torso")
101 , (55, 62, "Rechter Arm") 102 , (55, 62, "Rechter Arm")
@@ -113,7 +114,7 @@ human = Humanoid
113 , (26, 35, effect "Blind, Rechts") 114 , (26, 35, effect "Blind, Rechts")
114 , (36, 45, effect "Blind, Links") 115 , (36, 45, effect "Blind, Links")
115 , (46, 75, effect "Taub") 116 , (46, 75, effect "Taub")
116 , (76, 100, effect "Bewusstlos – 1w10 Runden") 117 , (76, 100, Effect "Bewusstlos" . unconscious $ d 10)
117 ]) 118 ])
118 ) 119 )
119 , ("Torso", def) 120 , ("Torso", def)
@@ -127,8 +128,13 @@ human = Humanoid
127 , _sDamage = const 0 128 , _sDamage = const 0
128 , _sFatigue = 0 129 , _sFatigue = 0
129 130
131 , _sSequence = Nothing
132
130 , _sPainShock = def 133 , _sPainShock = def
131 , _sFatigueShock = def 134 , _sFatigueShock = def
135
136 , _sExtraSkills = []
137 , _sModifiers = []
132 } 138 }
133 where 139 where
134 headshot = runMaybeT $ do 140 headshot = runMaybeT $ do
@@ -139,6 +145,11 @@ human = Humanoid
139 dmg' = if dmg >= 0 then dmg else 0 145 dmg' = if dmg >= 0 then dmg else 0
140 MaybeT . previews ctx $ set (sDamage' "Kopf") dmg' 146 MaybeT . previews ctx $ set (sDamage' "Kopf") dmg'
141 147
148 unconscious :: Formula Stats -> FormulaM Stats (Maybe Stats)
149 unconscious roundsF = do
150 rounds <- roundsF
151 previews ctx $ over (sSequence . _Just . seqRound . _Wrapped) (+ rounds)
152
142dog = Quadruped 153dog = Quadruped
143 { _sAStrength = vStrength 154 { _sAStrength = vStrength
144 , _sAEndurance = vEndurance 155 , _sAEndurance = vEndurance
diff --git a/src/Sequence/Contact/Types.hs b/src/Sequence/Contact/Types.hs
index a0add1a..dff886d 100644
--- a/src/Sequence/Contact/Types.hs
+++ b/src/Sequence/Contact/Types.hs
@@ -94,7 +94,7 @@ makePrisms ''SeqVal
94makeLenses ''SeqVal 94makeLenses ''SeqVal
95 95
96instance Default SeqVal where 96instance Default SeqVal where
97 def = SeqVal { _seqRound = 0 97 def = SeqVal { _seqRound = Down 0
98 , _seqVal = Nothing 98 , _seqVal = Nothing
99 , _seqEpsilon = False 99 , _seqEpsilon = False
100 } 100 }
@@ -112,7 +112,9 @@ makeLenses ''Stats
112 112
113instance Default Stats where 113instance Default Stats where
114 def = Prop 114 def = Prop
115 { _sHitzones = [("Volumen", 1)] 115 { _sSeqEpsilon = False
116
117 , _sHitzones = [("Volumen", 1)]
116 , _sArmor = const def 118 , _sArmor = const def
117 , _sCripple = const def 119 , _sCripple = const def
118 120
diff --git a/src/Sequence/Contact/Types/Internal.hs b/src/Sequence/Contact/Types/Internal.hs
index 7e9be2b..e4a2eef 100644
--- a/src/Sequence/Contact/Types/Internal.hs
+++ b/src/Sequence/Contact/Types/Internal.hs
@@ -7,6 +7,7 @@ import Sequence.Formula (Formula, FormulaM, Table)
7import Data.Map (Map) 7import Data.Map (Map)
8import Data.Set (Set) 8import Data.Set (Set)
9import Data.Ratio 9import Data.Ratio
10import Data.Ord
10import Data.Monoid 11import Data.Monoid
11 12
12import Control.Lens 13import Control.Lens
@@ -46,11 +47,11 @@ data Modifier = Modifier (CI String) (Test -> FormulaM Stats Test)
46data Effect = Effect (CI String) (FormulaM Stats (Maybe Stats)) 47data Effect = Effect (CI String) (FormulaM Stats (Maybe Stats))
47 48
48data SeqVal = SeqVal 49data SeqVal = SeqVal
49 { _seqRound :: Int 50 { _seqRound :: Down Int
50 , _seqVal :: Maybe Int 51 , _seqVal :: Maybe Int
51 , _seqEpsilon :: Bool 52 , _seqEpsilon :: Bool
52 } 53 }
53 deriving (Show, Ord, Eq) 54 deriving (Show, Eq, Ord)
54 55
55data ShockEffect = ShockEffect 56data ShockEffect = ShockEffect
56 { _seApplied :: Bool 57 { _seApplied :: Bool
@@ -60,7 +61,9 @@ data ShockEffect = ShockEffect
60 } 61 }
61 62
62data Stats = Prop 63data Stats = Prop
63 { _sHitzones :: Table Hitzone 64 { _sSeqEpsilon :: Bool
65
66 , _sHitzones :: Table Hitzone
64 , _sArmor :: Hitzone -> Armor 67 , _sArmor :: Hitzone -> Armor
65 , _sCripple :: Hitzone -> ShockEffect 68 , _sCripple :: Hitzone -> ShockEffect
66 69
@@ -123,6 +126,8 @@ data Stats = Prop
123 , _sPainTolerance 126 , _sPainTolerance
124 , _sFatigueTolerance :: Formula Stats 127 , _sFatigueTolerance :: Formula Stats
125 128
129 , _sSeqEpsilon :: Bool
130
126 , _sHitzones :: Table Hitzone 131 , _sHitzones :: Table Hitzone
127 , _sArmor :: Hitzone -> Armor 132 , _sArmor :: Hitzone -> Armor
128 , _sCripple :: Hitzone -> ShockEffect 133 , _sCripple :: Hitzone -> ShockEffect
@@ -161,6 +166,8 @@ data Stats = Prop
161 , _sPainTolerance 166 , _sPainTolerance
162 , _sFatigueTolerance :: Formula Stats 167 , _sFatigueTolerance :: Formula Stats
163 168
169 , _sSeqEpsilon :: Bool
170
164 , _sHitzones :: Table Hitzone 171 , _sHitzones :: Table Hitzone
165 , _sArmor :: Hitzone -> Armor 172 , _sArmor :: Hitzone -> Armor
166 , _sCripple :: Hitzone -> ShockEffect 173 , _sCripple :: Hitzone -> ShockEffect
@@ -199,6 +206,8 @@ data Stats = Prop
199 , _sPainTolerance 206 , _sPainTolerance
200 , _sFatigueTolerance :: Formula Stats 207 , _sFatigueTolerance :: Formula Stats
201 208
209 , _sSeqEpsilon :: Bool
210
202 , _sHitzones :: Table Hitzone 211 , _sHitzones :: Table Hitzone
203 , _sArmor :: Hitzone -> Armor 212 , _sArmor :: Hitzone -> Armor
204 , _sCripple :: Hitzone -> ShockEffect 213 , _sCripple :: Hitzone -> ShockEffect
diff --git a/src/Sequence/Types.hs b/src/Sequence/Types.hs
index 33bbc2a..f5bf010 100644
--- a/src/Sequence/Types.hs
+++ b/src/Sequence/Types.hs
@@ -6,7 +6,7 @@ module Sequence.Types
6 , Entity(..), eFaction, eSeqVal, eStats 6 , Entity(..), eFaction, eSeqVal, eStats
7 , EntityName(..), entityName 7 , EntityName(..), entityName
8 , EntityIdentifier(..), entityId, entityId' 8 , EntityIdentifier(..), entityId, entityId'
9 , inhabitedFactions, priorityQueue, tip, insertEntity, gFocus', gRound 9 , inhabitedFactions, priorityQueue, tip, insertEntity, gFocus', gRounds, gRounds', gRound
10 ) where 10 ) where
11 11
12import Control.Lens 12import Control.Lens
@@ -151,13 +151,12 @@ insertEntity entity = execState $ do
151 identifier <- use gNextId 151 identifier <- use gNextId
152 gEntities . at identifier ?= entity 152 gEntities . at identifier ?= entity
153 gNextId %= succ 153 gNextId %= succ
154
155gRounds :: Traversal' GameState Int
156gRounds = gEntities . each . eStats . sSequence . _Just . seqRound . _Wrapped
157
158gRounds' :: Getter GameState [Int]
159gRounds' = to $ nub . sort . toListOf gRounds
154 160
155gRound :: Lens' GameState Int 161gRound :: Getter GameState Int
156gRound = lens lowestRound $ flip trimBelow 162gRound = to $ getMin . (<> Min 0) . view (gRounds . _Unwrapped)
157 where
158 lowestRound = getMin . (<> Min 0) . view (gEntities . each . eStats . sSequence . _Just . seqRound . _Unwrapped)
159 trimBelow = over (gEntities . each . eStats . sSequence) . trimBelow'
160 trimBelow' cutoff = runReader . runMaybeT $ do
161 round <- MaybeT . preview $ _Just . seqRound
162 guard $ round >= cutoff
163 MaybeT ask