summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregor Kleen <pngwjpgh@users.noreply.github.com>2016-08-12 17:04:44 +0200
committerGregor Kleen <pngwjpgh@users.noreply.github.com>2016-08-12 17:04:44 +0200
commit21896f81fd30c314d1826af19c25c386bd28e1be (patch)
tree879c70faeaee57e81afa3549735fc67fa153085c /src
parente65e3f11fe911a6ca1009cf35f4b3e7ca907c459 (diff)
download2017-01-16_17:13:37-21896f81fd30c314d1826af19c25c386bd28e1be.tar
2017-01-16_17:13:37-21896f81fd30c314d1826af19c25c386bd28e1be.tar.gz
2017-01-16_17:13:37-21896f81fd30c314d1826af19c25c386bd28e1be.tar.bz2
2017-01-16_17:13:37-21896f81fd30c314d1826af19c25c386bd28e1be.tar.xz
2017-01-16_17:13:37-21896f81fd30c314d1826af19c25c386bd28e1be.zip
dynamically typed equipment
Diffstat (limited to 'src')
-rw-r--r--src/Sequence/Contact/Archetypes.hs8
-rw-r--r--src/Sequence/Contact/Types.hs7
-rw-r--r--src/Sequence/Contact/Types/Internal.hs10
3 files changed, 25 insertions, 0 deletions
diff --git a/src/Sequence/Contact/Archetypes.hs b/src/Sequence/Contact/Archetypes.hs
index c93210d..1973b97 100644
--- a/src/Sequence/Contact/Archetypes.hs
+++ b/src/Sequence/Contact/Archetypes.hs
@@ -122,6 +122,8 @@ prop = Prop
122 122
123 , _sExtraSkills = [] 123 , _sExtraSkills = []
124 , _sModifiers = [] 124 , _sModifiers = []
125
126 , _sEquipment = []
125 } 127 }
126 128
127player = prop { _sSeqEpsilon = True } 129player = prop { _sSeqEpsilon = True }
@@ -247,6 +249,8 @@ human = Humanoid
247 249
248 , _sExtraSkills = [] 250 , _sExtraSkills = []
249 , _sModifiers = damageMods 251 , _sModifiers = damageMods
252
253 , _sEquipment = []
250 } 254 }
251 where 255 where
252 arm zone = def 256 arm zone = def
@@ -353,6 +357,8 @@ dog = Quadruped
353 357
354 , _sExtraSkills = [] 358 , _sExtraSkills = []
355 , _sModifiers = damageMods 359 , _sModifiers = damageMods
360
361 , _sEquipment = []
356 } 362 }
357 where 363 where
358 lauf zone = def 364 lauf zone = def
@@ -440,6 +446,8 @@ dolphin = Dolphin
440 446
441 , _sExtraSkills = [] 447 , _sExtraSkills = []
442 , _sModifiers = damageMods 448 , _sModifiers = damageMods
449
450 , _sEquipment = []
443 } 451 }
444 452
445childOfMu = human 453childOfMu = human
diff --git a/src/Sequence/Contact/Types.hs b/src/Sequence/Contact/Types.hs
index 12283b9..df33506 100644
--- a/src/Sequence/Contact/Types.hs
+++ b/src/Sequence/Contact/Types.hs
@@ -26,6 +26,8 @@ import Data.List
26import Data.Ord 26import Data.Ord
27import Data.ExtendedReal 27import Data.ExtendedReal
28import Data.Monoid (Monoid(..), (<>)) 28import Data.Monoid (Monoid(..), (<>))
29import Data.Dynamic
30import Data.Dynamic.Lens
29 31
30import Control.Monad.Reader (ask, local) 32import Control.Monad.Reader (ask, local)
31import Control.Monad.State 33import Control.Monad.State
@@ -152,6 +154,8 @@ instance Default Stats where
152 154
153 , _sExtraSkills = [] 155 , _sExtraSkills = []
154 , _sModifiers = [] 156 , _sModifiers = []
157
158 , _sEquipment = []
155 } 159 }
156 160
157applyModifier :: String -> (Test -> FormulaM Stats Test) -> Effect 161applyModifier :: String -> (Test -> FormulaM Stats Test) -> Effect
@@ -179,6 +183,9 @@ sDamage' zone = sDamage . ix zone
179sCripple' :: Hitzone -> Traversal' Stats ShockEffect 183sCripple' :: Hitzone -> Traversal' Stats ShockEffect
180sCripple' zone = sCripple . ix zone 184sCripple' zone = sCripple . ix zone
181 185
186sEquipment' :: Typeable a => String -> Traversal' Stats a
187sEquipment' (CI.mk -> k) = sEquipment . ix k . traverse . _Dynamic
188
182sTotalDamage :: Lens' Stats Int 189sTotalDamage :: Lens' Stats Int
183sTotalDamage = lens retrieve $ flip spread 190sTotalDamage = lens retrieve $ flip spread
184 where 191 where
diff --git a/src/Sequence/Contact/Types/Internal.hs b/src/Sequence/Contact/Types/Internal.hs
index ca4d022..9df3527 100644
--- a/src/Sequence/Contact/Types/Internal.hs
+++ b/src/Sequence/Contact/Types/Internal.hs
@@ -10,6 +10,8 @@ import Data.Ratio
10import Data.Ord 10import Data.Ord
11import Data.Monoid 11import Data.Monoid
12 12
13import Data.Dynamic
14
13import Control.Lens 15import Control.Lens
14 16
15import Data.CaseInsensitive (CI) 17import Data.CaseInsensitive (CI)
@@ -108,6 +110,8 @@ data Stats = Prop
108 110
109 , _sExtraSkills :: Map (CI String) (FormulaM Stats Test) 111 , _sExtraSkills :: Map (CI String) (FormulaM Stats Test)
110 , _sModifiers :: Set Modifier 112 , _sModifiers :: Set Modifier
113
114 , _sEquipment :: Map (CI String) [Dynamic]
111 } 115 }
112 | Humanoid 116 | Humanoid
113 { _sAStrength 117 { _sAStrength
@@ -173,6 +177,8 @@ data Stats = Prop
173 177
174 , _sExtraSkills :: Map (CI String) (FormulaM Stats Test) 178 , _sExtraSkills :: Map (CI String) (FormulaM Stats Test)
175 , _sModifiers :: Set Modifier 179 , _sModifiers :: Set Modifier
180
181 , _sEquipment :: Map (CI String) [Dynamic]
176 } 182 }
177 | Quadruped 183 | Quadruped
178 { _sAStrength 184 { _sAStrength
@@ -213,6 +219,8 @@ data Stats = Prop
213 219
214 , _sExtraSkills :: Map (CI String) (FormulaM Stats Test) 220 , _sExtraSkills :: Map (CI String) (FormulaM Stats Test)
215 , _sModifiers :: Set Modifier 221 , _sModifiers :: Set Modifier
222
223 , _sEquipment :: Map (CI String) [Dynamic]
216 } 224 }
217 | Dolphin 225 | Dolphin
218 { _sAStrength 226 { _sAStrength
@@ -253,4 +261,6 @@ data Stats = Prop
253 261
254 , _sExtraSkills :: Map (CI String) (FormulaM Stats Test) 262 , _sExtraSkills :: Map (CI String) (FormulaM Stats Test)
255 , _sModifiers :: Set Modifier 263 , _sModifiers :: Set Modifier
264
265 , _sEquipment :: Map (CI String) [Dynamic]
256 } 266 }