summaryrefslogtreecommitdiff
path: root/src/Sequence/Contact
diff options
context:
space:
mode:
Diffstat (limited to 'src/Sequence/Contact')
-rw-r--r--src/Sequence/Contact/Archetypes.hs4
-rw-r--r--src/Sequence/Contact/Types.hs15
-rw-r--r--src/Sequence/Contact/Types/Internal.hs8
3 files changed, 27 insertions, 0 deletions
diff --git a/src/Sequence/Contact/Archetypes.hs b/src/Sequence/Contact/Archetypes.hs
index 1973b97..f8d4c9d 100644
--- a/src/Sequence/Contact/Archetypes.hs
+++ b/src/Sequence/Contact/Archetypes.hs
@@ -119,6 +119,7 @@ prop = Prop
119 , _sFatigueShock = def 119 , _sFatigueShock = def
120 120
121 , _sSequence = Nothing 121 , _sSequence = Nothing
122 , _sTimer = Nothing
122 123
123 , _sExtraSkills = [] 124 , _sExtraSkills = []
124 , _sModifiers = [] 125 , _sModifiers = []
@@ -230,6 +231,7 @@ human = Humanoid
230 , _sFatigue = 0 231 , _sFatigue = 0
231 232
232 , _sSequence = Nothing 233 , _sSequence = Nothing
234 , _sTimer = Nothing
233 235
234 , _sPainShock = def 236 , _sPainShock = def
235 & set seReBar (vitBar 0.75) 237 & set seReBar (vitBar 0.75)
@@ -351,6 +353,7 @@ dog = Quadruped
351 , _sFatigue = 0 353 , _sFatigue = 0
352 354
353 , _sSequence = Nothing 355 , _sSequence = Nothing
356 , _sTimer = Nothing
354 357
355 , _sPainShock = def 358 , _sPainShock = def
356 , _sFatigueShock = def 359 , _sFatigueShock = def
@@ -440,6 +443,7 @@ dolphin = Dolphin
440 , _sFatigue = 0 443 , _sFatigue = 0
441 444
442 , _sSequence = Nothing 445 , _sSequence = Nothing
446 , _sTimer = Nothing
443 447
444 , _sPainShock = def 448 , _sPainShock = def
445 , _sFatigueShock = def 449 , _sFatigueShock = def
diff --git a/src/Sequence/Contact/Types.hs b/src/Sequence/Contact/Types.hs
index 5f8808d..c69a698 100644
--- a/src/Sequence/Contact/Types.hs
+++ b/src/Sequence/Contact/Types.hs
@@ -123,6 +123,20 @@ instance Default SeqVal where
123 } 123 }
124 124
125makeLenses ''ShockEffect 125makeLenses ''ShockEffect
126
127absTime :: Lens' Timer Rational
128absTime = lens get set
129 where
130 get (Constant n) = n
131 get (Scaled n) = n
132 set (Constant _) n = Constant n
133 set (Scaled _) n = Scaled n
134
135instance Eq Timer where
136 (==) = (==) `on` view absTime
137
138instance Ord Timer where
139 compare = comparing $ view absTime
126 140
127instance Default ShockEffect where 141instance Default ShockEffect where
128 def = ShockEffect { _seApplied = False 142 def = ShockEffect { _seApplied = False
@@ -148,6 +162,7 @@ instance Default Stats where
148 , _sFatigue = 0 162 , _sFatigue = 0
149 163
150 , _sSequence = Nothing 164 , _sSequence = Nothing
165 , _sTimer = Nothing
151 166
152 , _sPainShock = def 167 , _sPainShock = def
153 , _sFatigueShock = def 168 , _sFatigueShock = def
diff --git a/src/Sequence/Contact/Types/Internal.hs b/src/Sequence/Contact/Types/Internal.hs
index 7938a06..11116e9 100644
--- a/src/Sequence/Contact/Types/Internal.hs
+++ b/src/Sequence/Contact/Types/Internal.hs
@@ -83,6 +83,10 @@ data SeqVal = SeqVal
83 } 83 }
84 deriving (Show, Eq, Ord) 84 deriving (Show, Eq, Ord)
85 85
86data Timer = Scaled Rational
87 | Constant Rational
88 deriving (Show)
89
86data ShockEffect = ShockEffect 90data ShockEffect = ShockEffect
87 { _seApplied :: Bool 91 { _seApplied :: Bool
88 , _seVal 92 , _seVal
@@ -107,6 +111,7 @@ data Stats = Prop
107 , _sFatigueShock :: ShockEffect 111 , _sFatigueShock :: ShockEffect
108 112
109 , _sSequence :: Maybe SeqVal 113 , _sSequence :: Maybe SeqVal
114 , _sTimer :: Maybe Timer
110 115
111 , _sExtraSkills :: Map (CI String) (FormulaM Stats Test) 116 , _sExtraSkills :: Map (CI String) (FormulaM Stats Test)
112 , _sModifiers :: Set Modifier 117 , _sModifiers :: Set Modifier
@@ -171,6 +176,7 @@ data Stats = Prop
171 , _sFatigue :: Int 176 , _sFatigue :: Int
172 177
173 , _sSequence :: Maybe SeqVal 178 , _sSequence :: Maybe SeqVal
179 , _sTimer :: Maybe Timer
174 180
175 , _sPainShock :: ShockEffect 181 , _sPainShock :: ShockEffect
176 , _sFatigueShock :: ShockEffect 182 , _sFatigueShock :: ShockEffect
@@ -213,6 +219,7 @@ data Stats = Prop
213 , _sFatigue :: Int 219 , _sFatigue :: Int
214 220
215 , _sSequence :: Maybe SeqVal 221 , _sSequence :: Maybe SeqVal
222 , _sTimer :: Maybe Timer
216 223
217 , _sPainShock :: ShockEffect 224 , _sPainShock :: ShockEffect
218 , _sFatigueShock :: ShockEffect 225 , _sFatigueShock :: ShockEffect
@@ -255,6 +262,7 @@ data Stats = Prop
255 , _sFatigue :: Int 262 , _sFatigue :: Int
256 263
257 , _sSequence :: Maybe SeqVal 264 , _sSequence :: Maybe SeqVal
265 , _sTimer :: Maybe Timer
258 266
259 , _sPainShock :: ShockEffect 267 , _sPainShock :: ShockEffect
260 , _sFatigueShock :: ShockEffect 268 , _sFatigueShock :: ShockEffect