diff options
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/Main.hs b/src/Main.hs index f409a04..a38b514 100644 --- a/src/Main.hs +++ b/src/Main.hs | |||
@@ -308,16 +308,31 @@ doShock dmg efLens = withFocus $ \focusId -> do | |||
308 | if cripple ^. seApplied | 308 | if cripple ^. seApplied |
309 | then guard $ dmg >= reBar | 309 | then guard $ dmg >= reBar |
310 | else guard $ val >= bar | 310 | else guard $ val >= bar |
311 | lStats . efLens . seApplied .= True | ||
311 | (CI.original -> effectName, effect) <- view _Effect <$> (evalF . table $ cripple ^. seEffect) | 312 | (CI.original -> effectName, effect) <- view _Effect <$> (evalF . table $ cripple ^. seEffect) |
312 | lStats <~ (MaybeT . fmap join . runMaybeT $ evalF effect) | 313 | lStats <~ (MaybeT . fmap join . runMaybeT $ evalF effect) |
313 | lift $ shellPutStrLn effectName | 314 | lift $ shellPutStrLn effectName |
314 | lift . addNote $ "Effect: " ++ effectName | 315 | lift . addNote $ "Effect: " ++ effectName |
315 | 316 | ||
316 | takeHit :: Int -> Completable (Set Hitzone) -> Sh GameState () | 317 | takeHit :: Int -> Completable (Set Hitzone) -> Completable DamageType -> Sh GameState () |
317 | takeHit dmg = withArg $ \zones -> withFocus $ \focusId -> forM_ zones $ \zone -> do | 318 | takeHit dmg a1 a2 = flip withArg a1 $ \zones -> flip withArg a2 $ \dType -> withFocus $ \focusId -> forM_ zones $ \zone -> void . runMaybeT $ do |
318 | gEntities . ix focusId . eStats . sDamage . ix zone += dmg | 319 | let |
319 | doShock dmg (sCripple . ix zone) | 320 | lStats :: Traversal' GameState Stats |
320 | doShock dmg sPainShock | 321 | lStats = gEntities . ix focusId . eStats |
322 | name <- toName focusId | ||
323 | armor <- MaybeT . preuse $ lStats . sArmor . ix zone | ||
324 | dmg' <- MaybeT . focusState lStats . evalFormula' name $ absorb armor dType dmg | ||
325 | forM_ (Map.toList dmg') $ \(dType, dmg) -> lift . runMaybeT $ do | ||
326 | guard $ dmg > 0 | ||
327 | lift $ shellPutStrLn $ name ++ " took " ++ show dmg ++ " " ++ show dType | ||
328 | case dType of | ||
329 | Fatigue -> lStats . sFatigue += dmg | ||
330 | _ -> lStats . sDamage . ix zone += dmg | ||
331 | case dType of | ||
332 | Fatigue -> lift $ doShock dmg sFatigueShock | ||
333 | _ -> lift $ do | ||
334 | doShock dmg (sCripple . ix zone) | ||
335 | doShock dmg sPainShock | ||
321 | 336 | ||
322 | takeFatigue :: Int -> Sh GameState () | 337 | takeFatigue :: Int -> Sh GameState () |
323 | takeFatigue dmg = withFocus $ \focusId -> do | 338 | takeFatigue dmg = withFocus $ \focusId -> do |