summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-06-12 16:13:08 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2016-06-12 16:13:08 +0200
commitae1ea97cdcca8d230dbee9460ae5d28242404d20 (patch)
tree09d05f1c3720d19a8d73959bb8cd64cb7155d4d2 /src
parent532600423afbfe83185c6de28f951ebc3bcf5c3f (diff)
download2017-01-16_17:13:37-ae1ea97cdcca8d230dbee9460ae5d28242404d20.tar
2017-01-16_17:13:37-ae1ea97cdcca8d230dbee9460ae5d28242404d20.tar.gz
2017-01-16_17:13:37-ae1ea97cdcca8d230dbee9460ae5d28242404d20.tar.bz2
2017-01-16_17:13:37-ae1ea97cdcca8d230dbee9460ae5d28242404d20.tar.xz
2017-01-16_17:13:37-ae1ea97cdcca8d230dbee9460ae5d28242404d20.zip
damage modifiers
Diffstat (limited to 'src')
-rw-r--r--src/Sequence/Contact/Archetypes.hs20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/Sequence/Contact/Archetypes.hs b/src/Sequence/Contact/Archetypes.hs
index 5f431de..d790917 100644
--- a/src/Sequence/Contact/Archetypes.hs
+++ b/src/Sequence/Contact/Archetypes.hs
@@ -1,4 +1,4 @@
1{-# LANGUAGE OverloadedStrings, OverloadedLists, ViewPatterns, MultiParamTypeClasses #-} 1{-# LANGUAGE OverloadedStrings, OverloadedLists, ViewPatterns, MultiParamTypeClasses, RankNTypes #-}
2 2
3module Sequence.Contact.Archetypes where 3module Sequence.Contact.Archetypes where
4 4
@@ -18,6 +18,9 @@ import Sequence.Utils
18import Data.Map (Map) 18import Data.Map (Map)
19import qualified Data.Map as Map 19import qualified Data.Map as Map
20 20
21import Data.Set (Set)
22import qualified Data.Set as Set
23
21import Data.Default 24import Data.Default
22import Data.Maybe 25import Data.Maybe
23import Data.Ratio 26import Data.Ratio
@@ -72,6 +75,19 @@ amputate zone = Effect (CI.mk $ review hitzone zone ++ " ist verloren") . runMay
72 sHitzones %= Map.delete zone 75 sHitzones %= Map.delete zone
73 sMaxVitality %= view (mapping . scaled $ 1 - zoneProp) 76 sMaxVitality %= view (mapping . scaled $ 1 - zoneProp)
74 77
78damageMods :: Set Modifier
79damageMods = [ Modifier "Schmerz" $ damageMod sTotalDamage sPainTolerance
80 , Modifier "Erschöpfung" $ damageMod sFatigue sFatigueTolerance
81 ]
82 where
83 damageMod :: Traversal' Stats Int -> Traversal' Stats (Formula Stats) -> Test -> FormulaM Stats Test
84 damageMod lDmg lTolerance test = fmap (fromMaybe test) . runMaybeT $ do
85 dmg <- MaybeT (preview $ ctx . lDmg)
86 tolerance <- lift =<< MaybeT (preview $ ctx . lTolerance)
87 guard $ dmg > tolerance
88 let mod = dmg - tolerance
89 return $ test & over tMod (+ mod)
90
75human = Humanoid 91human = Humanoid
76 { _sAStrength = vStrength 92 { _sAStrength = vStrength
77 , _sAEndurance = vEndurance 93 , _sAEndurance = vEndurance
@@ -192,7 +208,7 @@ human = Humanoid
192 ]) 208 ])
193 209
194 , _sExtraSkills = [] 210 , _sExtraSkills = []
195 , _sModifiers = [] 211 , _sModifiers = damageMods
196 } 212 }
197 where 213 where
198 arm zone = def 214 arm zone = def