summaryrefslogtreecommitdiff
path: root/src/Sequence
diff options
context:
space:
mode:
Diffstat (limited to 'src/Sequence')
-rw-r--r--src/Sequence/Contact/Archetypes.hs1
-rw-r--r--src/Sequence/Contact/Types.hs1
-rw-r--r--src/Sequence/Contact/Types/Internal.hs5
-rw-r--r--src/Sequence/Formula.hs4
-rw-r--r--src/Sequence/Types.hs4
-rw-r--r--src/Sequence/Utils.hs2
6 files changed, 12 insertions, 5 deletions
diff --git a/src/Sequence/Contact/Archetypes.hs b/src/Sequence/Contact/Archetypes.hs
index 30aa2b6..1ad26bb 100644
--- a/src/Sequence/Contact/Archetypes.hs
+++ b/src/Sequence/Contact/Archetypes.hs
@@ -110,6 +110,7 @@ human = Humanoid
110 , _sCripple = fromJust . flip Map.lookup [ ("Kopf", def 110 , _sCripple = fromJust . flip Map.lookup [ ("Kopf", def
111 & set seVal (sDamage' "Kopf" . to return) 111 & set seVal (sDamage' "Kopf" . to return)
112 & set seBar (sMaxVitality . mapping (scaled 0.5)) 112 & set seBar (sMaxVitality . mapping (scaled 0.5))
113 & set seReBar (sMaxVitality . mapping (scaled 0.2))
113 & set seEffect (cTable [ (1, 10, Effect "Tod" headshot) 114 & set seEffect (cTable [ (1, 10, Effect "Tod" headshot)
114 , (11, 25, effect "Blind") 115 , (11, 25, effect "Blind")
115 , (26, 35, effect "Blind, Rechts") 116 , (26, 35, effect "Blind, Rechts")
diff --git a/src/Sequence/Contact/Types.hs b/src/Sequence/Contact/Types.hs
index 47687b7..9854d92 100644
--- a/src/Sequence/Contact/Types.hs
+++ b/src/Sequence/Contact/Types.hs
@@ -107,6 +107,7 @@ instance Default ShockEffect where
107 def = ShockEffect { _seApplied = False 107 def = ShockEffect { _seApplied = False
108 , _seVal = ignored 108 , _seVal = ignored
109 , _seBar = ignored 109 , _seBar = ignored
110 , _seReBar = ignored
110 , _seEffect = def 111 , _seEffect = def
111 } 112 }
112 113
diff --git a/src/Sequence/Contact/Types/Internal.hs b/src/Sequence/Contact/Types/Internal.hs
index e4a2eef..0fe6266 100644
--- a/src/Sequence/Contact/Types/Internal.hs
+++ b/src/Sequence/Contact/Types/Internal.hs
@@ -55,8 +55,9 @@ data SeqVal = SeqVal
55 55
56data ShockEffect = ShockEffect 56data ShockEffect = ShockEffect
57 { _seApplied :: Bool 57 { _seApplied :: Bool
58 , _seVal :: Getting (First (Formula Stats)) Stats (Formula Stats) 58 , _seVal
59 , _seBar :: Getting (First (Formula Stats)) Stats (Formula Stats) 59 , _seBar
60 , _seReBar :: Getting (First (Formula Stats)) Stats (Formula Stats)
60 , _seEffect :: Table Effect 61 , _seEffect :: Table Effect
61 } 62 }
62 63
diff --git a/src/Sequence/Formula.hs b/src/Sequence/Formula.hs
index ca945f8..4f2e61b 100644
--- a/src/Sequence/Formula.hs
+++ b/src/Sequence/Formula.hs
@@ -28,6 +28,7 @@ import Data.Bool
28import Data.List 28import Data.List
29import Data.Maybe 29import Data.Maybe
30import Data.Either 30import Data.Either
31import Data.Tuple
31 32
32import Data.Set (Set) 33import Data.Set (Set)
33import qualified Data.Set as Set 34import qualified Data.Set as Set
@@ -109,6 +110,9 @@ evalFormula = evalFormula' []
109 Left q@(Question{..}) -> askQuestion promptPref input q >>= flip (flip evalFormula' promptPref $ bool (pure . set (ctx' . answer) $ throwError q) mempty keepResult ++ finalChanges) formula 110 Left q@(Question{..}) -> askQuestion promptPref input q >>= flip (flip evalFormula' promptPref $ bool (pure . set (ctx' . answer) $ throwError q) mempty keepResult ++ finalChanges) formula
110 Right result -> return (foldr ($) input finalChanges, result) 111 Right result -> return (foldr ($) input finalChanges, result)
111 112
113evalFormula' :: (MonadIO m, sInput :<: lInput, MonadState lInput m) => String -> FormulaM sInput a -> m a
114evalFormula' promptPref formula = uncurry (<$) . over _2 put . swap =<< flip (evalFormula promptPref) formula =<< get
115
112val :: Integral a => Traversal' input (Formula input) -> String -> Bool -> Formula input 116val :: Integral a => Traversal' input (Formula input) -> String -> Bool -> Formula input
113val answer prompt keepResult = do 117val answer prompt keepResult = do
114 gets (Set.member prompt) >>= bool (modify $ Set.insert prompt) (modify (Set.delete prompt) >> throwError Question{..}) 118 gets (Set.member prompt) >>= bool (modify $ Set.insert prompt) (modify (Set.delete prompt) >> throwError Question{..})
diff --git a/src/Sequence/Types.hs b/src/Sequence/Types.hs
index 6594f78..59397d5 100644
--- a/src/Sequence/Types.hs
+++ b/src/Sequence/Types.hs
@@ -78,8 +78,8 @@ instance Default Entity where
78eSeqVal :: Lens' Entity (Maybe SeqVal) 78eSeqVal :: Lens' Entity (Maybe SeqVal)
79eSeqVal = eStats . sSequence 79eSeqVal = eStats . sSequence
80 80
81instance (Entity :<: a) => Stats :<: a where 81instance Stats :<: Entity where
82 ctx' = ctx' . eStats 82 ctx' = eStats
83 83
84newtype EntityName = EntityName { _entityName :: CI String } 84newtype EntityName = EntityName { _entityName :: CI String }
85 deriving (Show, Eq, Ord) 85 deriving (Show, Eq, Ord)
diff --git a/src/Sequence/Utils.hs b/src/Sequence/Utils.hs
index bbd1477..8b205ea 100644
--- a/src/Sequence/Utils.hs
+++ b/src/Sequence/Utils.hs
@@ -112,5 +112,5 @@ instance Argument (Set Hitzone) GameState where
112 ws = Set.fromList . map CI.mk . filter (not . null) . map trim . split $ protoWs 112 ws = Set.fromList . map CI.mk . filter (not . null) . map trim . split $ protoWs
113 hasGlob = Set.member "*" ws 113 hasGlob = Set.member "*" ws
114 hitzones <- Set.map (view _Hitzone) . Map.keysSet <$> MaybeT (preuse $ gFocus' . eStats . sHitzones) 114 hitzones <- Set.map (view _Hitzone) . Map.keysSet <$> MaybeT (preuse $ gFocus' . eStats . sHitzones)
115 guard (hasGlob || hitzones `Set.isSubsetOf` ws) 115 guard (hasGlob || ws `Set.isSubsetOf` hitzones)
116 return . Set.map (review _Hitzone) $ if hasGlob then hitzones else ws 116 return . Set.map (review _Hitzone) $ if hasGlob then hitzones else ws