Further cleanup

This commit is contained in:
2022-03-25 14:04:13 +00:00
parent a07647d89d
commit 1607879014
10 changed files with 61 additions and 300 deletions
+4 -5
View File
@@ -13,12 +13,13 @@ import Data.List
defaultApplyDamage :: [Damage] -> Creature -> World -> World
defaultApplyDamage ds cr w = foldl' (applyIndividualDamage cr) w ds'
& creatures . ix (_crID cr) %~ doPoisonDam
where
(_,ds') = partition isPoison ds
(ps,ds') = partition isPoison ds
isPoison Damage{_dmType=PoisonDam} = True
isPoison _ = False
-- poisonDam = quot (max 0 (sum (map _dmAmount ps))) 10
-- doPoisonDam = crHP -~ poisonDam
poisonDam = quot (max 0 (sum (map _dmAmount ps))) 10
doPoisonDam = crHP -~ poisonDam
applyDamageEffect :: Damage -> DamageEffect -> Creature -> World -> World
applyDamageEffect dm de cr w = case de of
@@ -54,8 +55,6 @@ applyDamageEffect dm de cr w = case de of
applyIndividualDamage :: Creature -> World -> Damage -> World
applyIndividualDamage cr w dm = applyDamageEffect dm (_dmEffect dm) cr $ applyIndividualDamage' cr w dm
-- & applyDamageEffect dm (_dmEffect dm)
applyIndividualDamage' :: Creature -> World -> Damage -> World
applyIndividualDamage' cr w dm = case _dmType dm of
Piercing -> applyPiercingDamage cr dm w