summaryrefslogtreecommitdiff
path: root/src/Sequence
diff options
context:
space:
mode:
Diffstat (limited to 'src/Sequence')
-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