Further cleanup
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user