diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-06-12 16:13:08 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-06-12 16:13:08 +0200 |
commit | ae1ea97cdcca8d230dbee9460ae5d28242404d20 (patch) | |
tree | 09d05f1c3720d19a8d73959bb8cd64cb7155d4d2 /src | |
parent | 532600423afbfe83185c6de28f951ebc3bcf5c3f (diff) | |
download | 2017-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.hs | 20 |
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 | ||
3 | module Sequence.Contact.Archetypes where | 3 | module Sequence.Contact.Archetypes where |
4 | 4 | ||
@@ -18,6 +18,9 @@ import Sequence.Utils | |||
18 | import Data.Map (Map) | 18 | import Data.Map (Map) |
19 | import qualified Data.Map as Map | 19 | import qualified Data.Map as Map |
20 | 20 | ||
21 | import Data.Set (Set) | ||
22 | import qualified Data.Set as Set | ||
23 | |||
21 | import Data.Default | 24 | import Data.Default |
22 | import Data.Maybe | 25 | import Data.Maybe |
23 | import Data.Ratio | 26 | import 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 | ||
78 | damageMods :: Set Modifier | ||
79 | damageMods = [ 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 | |||
75 | human = Humanoid | 91 | human = 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 |