From d8b49cbe1aff7cb3fcacac01d36128a248fc848b Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 10 Jun 2016 14:02:54 +0200 Subject: More sequence fu --- src/Sequence/Contact/Archetypes.hs | 13 ++++++++++++- src/Sequence/Contact/Types.hs | 6 ++++-- src/Sequence/Contact/Types/Internal.hs | 15 ++++++++++++--- 3 files changed, 28 insertions(+), 6 deletions(-) (limited to 'src/Sequence/Contact') diff --git a/src/Sequence/Contact/Archetypes.hs b/src/Sequence/Contact/Archetypes.hs index ff37fdb..32cfa22 100644 --- a/src/Sequence/Contact/Archetypes.hs +++ b/src/Sequence/Contact/Archetypes.hs @@ -96,6 +96,7 @@ human = Humanoid , _sPainTolerance = vMass `quot'` 2 + vWillpower , _sFatigueTolerance = vWillpower `quot'` 2 + vEndurance + , _sHitzones = cTable [ (1, 5, "Kopf") , (6, 54, "Torso") , (55, 62, "Rechter Arm") @@ -113,7 +114,7 @@ human = Humanoid , (26, 35, effect "Blind, Rechts") , (36, 45, effect "Blind, Links") , (46, 75, effect "Taub") - , (76, 100, effect "Bewusstlos – 1w10 Runden") + , (76, 100, Effect "Bewusstlos" . unconscious $ d 10) ]) ) , ("Torso", def) @@ -127,8 +128,13 @@ human = Humanoid , _sDamage = const 0 , _sFatigue = 0 + , _sSequence = Nothing + , _sPainShock = def , _sFatigueShock = def + + , _sExtraSkills = [] + , _sModifiers = [] } where headshot = runMaybeT $ do @@ -139,6 +145,11 @@ human = Humanoid dmg' = if dmg >= 0 then dmg else 0 MaybeT . previews ctx $ set (sDamage' "Kopf") dmg' + unconscious :: Formula Stats -> FormulaM Stats (Maybe Stats) + unconscious roundsF = do + rounds <- roundsF + previews ctx $ over (sSequence . _Just . seqRound . _Wrapped) (+ rounds) + dog = Quadruped { _sAStrength = vStrength , _sAEndurance = vEndurance diff --git a/src/Sequence/Contact/Types.hs b/src/Sequence/Contact/Types.hs index a0add1a..dff886d 100644 --- a/src/Sequence/Contact/Types.hs +++ b/src/Sequence/Contact/Types.hs @@ -94,7 +94,7 @@ makePrisms ''SeqVal makeLenses ''SeqVal instance Default SeqVal where - def = SeqVal { _seqRound = 0 + def = SeqVal { _seqRound = Down 0 , _seqVal = Nothing , _seqEpsilon = False } @@ -112,7 +112,9 @@ makeLenses ''Stats instance Default Stats where def = Prop - { _sHitzones = [("Volumen", 1)] + { _sSeqEpsilon = False + + , _sHitzones = [("Volumen", 1)] , _sArmor = const def , _sCripple = const def diff --git a/src/Sequence/Contact/Types/Internal.hs b/src/Sequence/Contact/Types/Internal.hs index 7e9be2b..e4a2eef 100644 --- a/src/Sequence/Contact/Types/Internal.hs +++ b/src/Sequence/Contact/Types/Internal.hs @@ -7,6 +7,7 @@ import Sequence.Formula (Formula, FormulaM, Table) import Data.Map (Map) import Data.Set (Set) import Data.Ratio +import Data.Ord import Data.Monoid import Control.Lens @@ -46,11 +47,11 @@ data Modifier = Modifier (CI String) (Test -> FormulaM Stats Test) data Effect = Effect (CI String) (FormulaM Stats (Maybe Stats)) data SeqVal = SeqVal - { _seqRound :: Int + { _seqRound :: Down Int , _seqVal :: Maybe Int , _seqEpsilon :: Bool } - deriving (Show, Ord, Eq) + deriving (Show, Eq, Ord) data ShockEffect = ShockEffect { _seApplied :: Bool @@ -60,7 +61,9 @@ data ShockEffect = ShockEffect } data Stats = Prop - { _sHitzones :: Table Hitzone + { _sSeqEpsilon :: Bool + + , _sHitzones :: Table Hitzone , _sArmor :: Hitzone -> Armor , _sCripple :: Hitzone -> ShockEffect @@ -123,6 +126,8 @@ data Stats = Prop , _sPainTolerance , _sFatigueTolerance :: Formula Stats + , _sSeqEpsilon :: Bool + , _sHitzones :: Table Hitzone , _sArmor :: Hitzone -> Armor , _sCripple :: Hitzone -> ShockEffect @@ -161,6 +166,8 @@ data Stats = Prop , _sPainTolerance , _sFatigueTolerance :: Formula Stats + , _sSeqEpsilon :: Bool + , _sHitzones :: Table Hitzone , _sArmor :: Hitzone -> Armor , _sCripple :: Hitzone -> ShockEffect @@ -199,6 +206,8 @@ data Stats = Prop , _sPainTolerance , _sFatigueTolerance :: Formula Stats + , _sSeqEpsilon :: Bool + , _sHitzones :: Table Hitzone , _sArmor :: Hitzone -> Armor , _sCripple :: Hitzone -> ShockEffect -- cgit v1.2.3