From 583f6cddc1c17bd93bb7b33cb1a5210fc330ff0f Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 14 Jun 2016 11:53:42 +0200 Subject: cleanup --- src/Sequence/Contact/Archetypes.hs | 226 ++++++++++++++++++------------------- src/Sequence/Formula.hs | 7 +- 2 files changed, 117 insertions(+), 116 deletions(-) (limited to 'src/Sequence') diff --git a/src/Sequence/Contact/Archetypes.hs b/src/Sequence/Contact/Archetypes.hs index 1bf2b7e..8bb44d4 100644 --- a/src/Sequence/Contact/Archetypes.hs +++ b/src/Sequence/Contact/Archetypes.hs @@ -15,7 +15,7 @@ import Sequence.Formula import Sequence.Types import Sequence.Utils -import Data.Map (Map) +import Data.Map (Map, (!)) import qualified Data.Map as Map import Data.Set (Set) @@ -150,44 +150,44 @@ human = Humanoid , (91, 100, "Linkes Bein") ] , _sArmor = const def - , _sCripple = fromJust . flip Map.lookup [ ("Kopf", def - & set seVal (sDamage' "Kopf" . to return) - & set seBar (vitBar 0.5) - & set seReBar (vitBar 0.2) - & set seEffect (cTable [ (1, 10, death "Kopf") - , (11, 25, effect "Blind") - , (26, 35, effect "Blind, Rechts") - , (36, 45, effect "Blind, Links") - , (46, 75, effect "Taub") - , (76, 100, Effect "Bewusstlos" . unconsciousR $ d 10) - ]) - ) - , ("Torso", def - & set seVal (sDamage' "Torso" . to return) - & set seBar (vitBar 0.75) - & set seReBar (vitBar 0.2) - & set seEffect (cTable [ (1, 5, death "Torso") - , (6, 25, Effect "Organschäden" . previews ctx $ over sFatigue (+ 25) . over (sDamage' "Torso") (+ 10)) - , (26, 45, effect "Innere Blutung (3 Schaden (Au) Minuten)") - , (46, 75, Effect "Bewusstlos" unconscious) - , (76, 100, Effect "Bewusstlos" . unconsciousR $ d 10) - ]) - ) - , ("Rechter Arm", arm "Rechter Arm") - , ("Linker Arm", arm "Linker Arm") - , ("Unterleib", def - & set seVal (sDamage' "Unterleib" . to return) - & set seBar (vitBar 0.2) - & set seReBar (vitBar 0.2) - & set seEffect ( cTable [ (1, 5, effect "Querschnittsgelähmt") - , (6, 25, Effect "Kastration" . previews ctx $ over sFatigue (+ 15)) - , (26, 50, effect "Innere Blutung (2 Schaden (Au) Minuten)") - , (51, 100, Effect "Bewusstlos" unconscious) - ]) - ) - , ("Rechtes Bein", bein "Rechtes Bein") - , ("Linkes Bein", bein "Linkes Bein") - ] + , _sCripple = (!) [ ("Kopf", def + & set seVal (sDamage' "Kopf" . to return) + & set seBar (vitBar 0.5) + & set seReBar (vitBar 0.2) + & set seEffect (cTable [ (1, 10, death "Kopf") + , (11, 25, effect "Blind") + , (26, 35, effect "Blind, Rechts") + , (36, 45, effect "Blind, Links") + , (46, 75, effect "Taub") + , (76, 100, Effect "Bewusstlos" . unconsciousR $ d 10) + ]) + ) + , ("Torso", def + & set seVal (sDamage' "Torso" . to return) + & set seBar (vitBar 0.75) + & set seReBar (vitBar 0.2) + & set seEffect (cTable [ (1, 5, death "Torso") + , (6, 25, Effect "Organschäden" . previews ctx $ over sFatigue (+ 25) . over (sDamage' "Torso") (+ 10)) + , (26, 45, effect "Innere Blutung (3 Schaden (Au) Minuten)") + , (46, 75, Effect "Bewusstlos" unconscious) + , (76, 100, Effect "Bewusstlos" . unconsciousR $ d 10) + ]) + ) + , ("Rechter Arm", arm "Rechter Arm") + , ("Linker Arm", arm "Linker Arm") + , ("Unterleib", def + & set seVal (sDamage' "Unterleib" . to return) + & set seBar (vitBar 0.2) + & set seReBar (vitBar 0.2) + & set seEffect ( cTable [ (1, 5, effect "Querschnittsgelähmt") + , (6, 25, Effect "Kastration" . previews ctx $ over sFatigue (+ 15)) + , (26, 50, effect "Innere Blutung (2 Schaden (Au) Minuten)") + , (51, 100, Effect "Bewusstlos" unconscious) + ]) + ) + , ("Rechtes Bein", bein "Rechtes Bein") + , ("Linkes Bein", bein "Linkes Bein") + ] , _sDamage = const 0 , _sFatigue = 0 @@ -269,45 +269,45 @@ dog = Quadruped , (91, 100, "Linker Hinterlauf") ] , _sArmor = const def - , _sCripple = fromJust . flip Map.lookup [ ("Kopf", def - & set seVal (sDamage' "Kopf" . to return) - & set seBar (vitBar 0.5) - & set seReBar (vitBar 0.2) - & set seEffect (cTable [ (1, 10, death "Kopf") - , (11, 25, effect "Blind") - , (26, 35, effect "Blind, Rechts") - , (36, 45, effect "Blind, Links") - , (46, 75, effect "Geruchssinn ist verloren") - , (76, 100, Effect "Bewusstlos" . unconsciousR $ 2 * d 10) - ]) - ) - , ("Torso", def - & set seVal (sDamage' "Torso" . to return) - & set seBar (vitBar 0.75) - & set seReBar (vitBar 0.2) - & set seEffect ( cTable [ (1, 5, death "Torso") - , (6, 25, Effect "Organschäden" . previews ctx $ over sFatigue (+ 25) . over (sDamage' "Torso") (+ 10)) - , (26, 45, effect "Innere Blutung (3 Schaden (Au) Minuten)") - , (46, 75, Effect "Bewusstlos" unconscious) - , (76, 100, Effect "Bewusstlos" . unconsciousR $ d 10) - ]) - ) - , ("Hinterteil", def - & set seVal (sDamage' "Hinterteil" . to return) - & set seBar (vitBar 0.2) - & set seReBar (vitBar 0.2) - & set seEffect ( cTable [ (1, 5, effect "Querschnittsgelähmt") - , (6, 25, Effect "Kastration" . previews ctx $ over sFatigue (+ 10)) - , (26, 50, effect "Innere Blutung (2 Schaden (Au) Minuten)") - , (51, 100, Effect "Bewusstlos" . unconsciousR $ 2 * d 10) - ]) - ) - , (\x -> (x, lauf x)) "Rechter Vorderlauf" - , (\x -> (x, lauf x)) "Linker Vorderlauf" - , (\x -> (x, lauf x)) "Rechter Hinterlauf" - , (\x -> (x, lauf x)) "Linker Hinterlauf" - ] - + , _sCripple = (!) [ ("Kopf", def + & set seVal (sDamage' "Kopf" . to return) + & set seBar (vitBar 0.5) + & set seReBar (vitBar 0.2) + & set seEffect (cTable [ (1, 10, death "Kopf") + , (11, 25, effect "Blind") + , (26, 35, effect "Blind, Rechts") + , (36, 45, effect "Blind, Links") + , (46, 75, effect "Geruchssinn ist verloren") + , (76, 100, Effect "Bewusstlos" . unconsciousR $ 2 * d 10) + ]) + ) + , ("Torso", def + & set seVal (sDamage' "Torso" . to return) + & set seBar (vitBar 0.75) + & set seReBar (vitBar 0.2) + & set seEffect ( cTable [ (1, 5, death "Torso") + , (6, 25, Effect "Organschäden" . previews ctx $ over sFatigue (+ 25) . over (sDamage' "Torso") (+ 10)) + , (26, 45, effect "Innere Blutung (3 Schaden (Au) Minuten)") + , (46, 75, Effect "Bewusstlos" unconscious) + , (76, 100, Effect "Bewusstlos" . unconsciousR $ d 10) + ]) + ) + , ("Hinterteil", def + & set seVal (sDamage' "Hinterteil" . to return) + & set seBar (vitBar 0.2) + & set seReBar (vitBar 0.2) + & set seEffect ( cTable [ (1, 5, effect "Querschnittsgelähmt") + , (6, 25, Effect "Kastration" . previews ctx $ over sFatigue (+ 10)) + , (26, 50, effect "Innere Blutung (2 Schaden (Au) Minuten)") + , (51, 100, Effect "Bewusstlos" . unconsciousR $ 2 * d 10) + ]) + ) + , (\x -> (x, lauf x)) "Rechter Vorderlauf" + , (\x -> (x, lauf x)) "Linker Vorderlauf" + , (\x -> (x, lauf x)) "Rechter Hinterlauf" + , (\x -> (x, lauf x)) "Linker Hinterlauf" + ] + , _sDamage = const 0 , _sFatigue = 0 @@ -360,41 +360,41 @@ dolphin = Dolphin , ("Schwanz", 0.25) ] , _sArmor = const def - , _sCripple = fromJust . flip Map.lookup [ ("Kopf", def - & set seVal (sDamage' "Kopf" . to return) - & set seBar (vitBar 0.6) - & set seReBar (vitBar 0.2) - & set seEffect ( cTable [ (1, 10, death "Kopf") - , (11, 25, effect "Blind") - , (26, 35, effect "Blind, Rechts") - , (36, 45, effect "Blind, Links") - , (46, 75, effect "Verlust des Biosonar") - , (76, 100, Effect "Bewusstlos" . unconsciousR $ 2 * d 10) - ]) - ) - , ("Rumpf", def - & set seVal (sDamage' "Rumpf" . to return) - & set seBar (vitBar 0.8) - & set seReBar (vitBar 0.2) - & set seEffect ( cTable [ (1, 5, death "Rumpf") - , (6, 25, Effect "Organschäden" . previews ctx $ over sFatigue (+ 7) . over (sDamage' "Rumpf") (+ 20)) - , (26, 45, effect "Blutung (2 Schaden (Au) Minuten)") - , (46, 75, Effect "Bewusstlos" unconscious) - , (76, 100, Effect "Bewusstlos" . unconsciousR $ d 10) - ]) - ) - , ("Schwanz", def - & set seVal (sDamage' "Schwanz" . to return) - & set seBar (vitBar 0.4) - & set seReBar (vitBar 0.2) - & set seEffect ( cTable [ (1, 10, amputate "Schwanz") - , (11, 25, effect "Halbierte Bewegung") - , (26, 45, Effect "Schmerz" . previews ctx $ over sFatigue (+ 15)) - , (46, 100, effect "Fleischwunde") - ]) - ) - ] - + , _sCripple = (!) [ ("Kopf", def + & set seVal (sDamage' "Kopf" . to return) + & set seBar (vitBar 0.6) + & set seReBar (vitBar 0.2) + & set seEffect ( cTable [ (1, 10, death "Kopf") + , (11, 25, effect "Blind") + , (26, 35, effect "Blind, Rechts") + , (36, 45, effect "Blind, Links") + , (46, 75, effect "Verlust des Biosonar") + , (76, 100, Effect "Bewusstlos" . unconsciousR $ 2 * d 10) + ]) + ) + , ("Rumpf", def + & set seVal (sDamage' "Rumpf" . to return) + & set seBar (vitBar 0.8) + & set seReBar (vitBar 0.2) + & set seEffect ( cTable [ (1, 5, death "Rumpf") + , (6, 25, Effect "Organschäden" . previews ctx $ over sFatigue (+ 7) . over (sDamage' "Rumpf") (+ 20)) + , (26, 45, effect "Blutung (2 Schaden (Au) Minuten)") + , (46, 75, Effect "Bewusstlos" unconscious) + , (76, 100, Effect "Bewusstlos" . unconsciousR $ d 10) + ]) + ) + , ("Schwanz", def + & set seVal (sDamage' "Schwanz" . to return) + & set seBar (vitBar 0.4) + & set seReBar (vitBar 0.2) + & set seEffect ( cTable [ (1, 10, amputate "Schwanz") + , (11, 25, effect "Halbierte Bewegung") + , (26, 45, Effect "Schmerz" . previews ctx $ over sFatigue (+ 15)) + , (46, 100, effect "Fleischwunde") + ]) + ) + ] + , _sDamage = const 0 , _sFatigue = 0 diff --git a/src/Sequence/Formula.hs b/src/Sequence/Formula.hs index be5032a..a3675c6 100644 --- a/src/Sequence/Formula.hs +++ b/src/Sequence/Formula.hs @@ -103,9 +103,10 @@ quot' = liftM2 quot askQuestion :: (MonadIO m, sInput :<: lInput) => [String] -> (lInput, Maybe (Formula sInput)) -> Question sInput -> m (lInput, Maybe (Formula sInput)) askQuestion promptPref input q@(Question{..}) = flip (if keepResult then set $ _1 . ctx' . answer else set _2 . Just) input . maybe (throwError q) return <$> askQ (wPromptPref $ promptPref ++ prompt) (join . fmap readMaybe) where - wPromptPref [] = " »" - wPromptPref [x] = x ++ " »" - wPromptPref (x:xs) = x ++ " » " ++ wPromptPref xs + wPromptPref [] = " " ++ sep + wPromptPref [x] = x ++ " " ++ sep + wPromptPref (x:xs) = x ++ " " ++ sep ++ " " ++ wPromptPref xs + sep = "»" evalFormula :: (MonadIO m, sInput :<: lInput) => [String] -> lInput -> FormulaM sInput a -> m (lInput, a) evalFormula promptPref input = evalFormula' [] promptPref (input, Nothing) -- cgit v1.2.3