summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregor Kleen <pngwjpgh@users.noreply.github.com>2016-08-12 17:29:41 +0200
committerGregor Kleen <pngwjpgh@users.noreply.github.com>2016-08-12 17:29:41 +0200
commite34688e295964500e1d0215e55fa57fe3628e9bc (patch)
tree874f6bb895646f88e1e77e5ca4174ba3fe460621 /src
parent21896f81fd30c314d1826af19c25c386bd28e1be (diff)
download2017-01-16_17:13:37-e34688e295964500e1d0215e55fa57fe3628e9bc.tar
2017-01-16_17:13:37-e34688e295964500e1d0215e55fa57fe3628e9bc.tar.gz
2017-01-16_17:13:37-e34688e295964500e1d0215e55fa57fe3628e9bc.tar.bz2
2017-01-16_17:13:37-e34688e295964500e1d0215e55fa57fe3628e9bc.tar.xz
2017-01-16_17:13:37-e34688e295964500e1d0215e55fa57fe3628e9bc.zip
better equipment accessor
Diffstat (limited to 'src')
-rw-r--r--src/Sequence/Contact/Types.hs4
-rw-r--r--src/Sequence/Contact/Types/Internal.hs8
2 files changed, 6 insertions, 6 deletions
diff --git a/src/Sequence/Contact/Types.hs b/src/Sequence/Contact/Types.hs
index df33506..5f8808d 100644
--- a/src/Sequence/Contact/Types.hs
+++ b/src/Sequence/Contact/Types.hs
@@ -183,8 +183,8 @@ sDamage' zone = sDamage . ix zone
183sCripple' :: Hitzone -> Traversal' Stats ShockEffect 183sCripple' :: Hitzone -> Traversal' Stats ShockEffect
184sCripple' zone = sCripple . ix zone 184sCripple' zone = sCripple . ix zone
185 185
186sEquipment' :: Typeable a => String -> Traversal' Stats a 186sEquipment' :: Typeable a => String -> Lens' Stats (Maybe a)
187sEquipment' (CI.mk -> k) = sEquipment . ix k . traverse . _Dynamic 187sEquipment' (CI.mk -> k) = lens (preview _Dynamic <=< view (sEquipment . at k)) (flip $ set (sEquipment . at k) . (preview (re _Dynamic) =<<))
188 188
189sTotalDamage :: Lens' Stats Int 189sTotalDamage :: Lens' Stats Int
190sTotalDamage = lens retrieve $ flip spread 190sTotalDamage = lens retrieve $ flip spread
diff --git a/src/Sequence/Contact/Types/Internal.hs b/src/Sequence/Contact/Types/Internal.hs
index 9df3527..7938a06 100644
--- a/src/Sequence/Contact/Types/Internal.hs
+++ b/src/Sequence/Contact/Types/Internal.hs
@@ -111,7 +111,7 @@ data Stats = Prop
111 , _sExtraSkills :: Map (CI String) (FormulaM Stats Test) 111 , _sExtraSkills :: Map (CI String) (FormulaM Stats Test)
112 , _sModifiers :: Set Modifier 112 , _sModifiers :: Set Modifier
113 113
114 , _sEquipment :: Map (CI String) [Dynamic] 114 , _sEquipment :: Map (CI String) Dynamic
115 } 115 }
116 | Humanoid 116 | Humanoid
117 { _sAStrength 117 { _sAStrength
@@ -178,7 +178,7 @@ data Stats = Prop
178 , _sExtraSkills :: Map (CI String) (FormulaM Stats Test) 178 , _sExtraSkills :: Map (CI String) (FormulaM Stats Test)
179 , _sModifiers :: Set Modifier 179 , _sModifiers :: Set Modifier
180 180
181 , _sEquipment :: Map (CI String) [Dynamic] 181 , _sEquipment :: Map (CI String) Dynamic
182 } 182 }
183 | Quadruped 183 | Quadruped
184 { _sAStrength 184 { _sAStrength
@@ -220,7 +220,7 @@ data Stats = Prop
220 , _sExtraSkills :: Map (CI String) (FormulaM Stats Test) 220 , _sExtraSkills :: Map (CI String) (FormulaM Stats Test)
221 , _sModifiers :: Set Modifier 221 , _sModifiers :: Set Modifier
222 222
223 , _sEquipment :: Map (CI String) [Dynamic] 223 , _sEquipment :: Map (CI String) Dynamic
224 } 224 }
225 | Dolphin 225 | Dolphin
226 { _sAStrength 226 { _sAStrength
@@ -262,5 +262,5 @@ data Stats = Prop
262 , _sExtraSkills :: Map (CI String) (FormulaM Stats Test) 262 , _sExtraSkills :: Map (CI String) (FormulaM Stats Test)
263 , _sModifiers :: Set Modifier 263 , _sModifiers :: Set Modifier
264 264
265 , _sEquipment :: Map (CI String) [Dynamic] 265 , _sEquipment :: Map (CI String) Dynamic
266 } 266 }