summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregor Kleen <pngwjpgh@users.noreply.github.com>2016-07-10 19:15:08 +0200
committerGregor Kleen <pngwjpgh@users.noreply.github.com>2016-07-10 19:15:08 +0200
commit7bd64df07668883920be7e0bf9d6eaea96dfba12 (patch)
treed9611d6437f819dcb7ecdae1dc439e9035486066 /src
parent10945609fe1e5f32ff8f5ca606ad098df7b2c794 (diff)
download2017-01-16_17:13:37-7bd64df07668883920be7e0bf9d6eaea96dfba12.tar
2017-01-16_17:13:37-7bd64df07668883920be7e0bf9d6eaea96dfba12.tar.gz
2017-01-16_17:13:37-7bd64df07668883920be7e0bf9d6eaea96dfba12.tar.bz2
2017-01-16_17:13:37-7bd64df07668883920be7e0bf9d6eaea96dfba12.tar.xz
2017-01-16_17:13:37-7bd64df07668883920be7e0bf9d6eaea96dfba12.zip
correctly handle electrical damage
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 279a65d..ace3ef2 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -373,13 +373,22 @@ takeHit dmg a1 a2 = flip withArg a1 $ \zones -> flip withArg a2 $ \dType -> with
373 guard $ dmg > 0 373 guard $ dmg > 0
374 lift . outputLogged focusId $ show dmg ++ " " ++ show dType ++ " to " ++ show (review hitzone zone) 374 lift . outputLogged focusId $ show dmg ++ " " ++ show dType ++ " to " ++ show (review hitzone zone)
375 case dType of 375 case dType of
376 Fatigue -> lStats . sFatigue += dmg 376 Electric -> do
377 _ -> lStats . sDamage . ix zone += dmg 377 lStats . sFatigue += dmg
378 case dType of 378 lift $ doShock dmg sFatigueShock
379 Fatigue -> lift $ doShock dmg sFatigueShock 379 mass <- (MaybeT . focusState lStats . evalFormula' [name]) =<< MaybeT (preuse $ lStats . sAMass)
380 _ -> lift $ do 380 willpower <- (MaybeT . focusState lStats . evalFormula' [name]) =<< MaybeT (preuse $ lStats . sAWillpower)
381 doShock dmg (sCripple . ix zone) 381 let loss = max 0 $ dmg - mass - willpower
382 doShock dmg sPainShock 382 lStats . sSequence . _Just . seqVal . _Just -= loss
383 guard $ loss > willpower
384 lift $ addNote "prone"
385 Fatigue -> do
386 lStats . sFatigue += dmg
387 lift $ doShock dmg sFatigueShock
388 _ -> do
389 lStats . sDamage . ix zone += dmg
390 lift $ doShock dmg (sCripple . ix zone)
391 lift $ doShock dmg sPainShock
383 392
384healDmg :: Int -> Completable (Set Hitzone) -> Sh GameState () 393healDmg :: Int -> Completable (Set Hitzone) -> Sh GameState ()
385healDmg n = withArg $ \zones -> withFocus $ \focusId -> do 394healDmg n = withArg $ \zones -> withFocus $ \focusId -> do