This commit is contained in:
2021-12-11 19:44:48 +00:00
parent c847955b7c
commit 7116129a37
15 changed files with 21 additions and 41 deletions
+2 -7
View File
@@ -1,6 +1,5 @@
module Dodge.Creature.State
( stateUpdate
, stateUpdate'
, stateUpdateDamage
, stateUpdateDamage'
, doDamage
@@ -44,13 +43,9 @@ import qualified Data.Vector.Mutable as MV
-- the creature before or after it has moved?
-- currently invSideEffects are applied after the creature moves, to correctly
-- update shield positions
stateUpdate :: CRUpdate -> Creature -> World -> World
stateUpdate f cr w = let (fw,mcr) = stateUpdateDamage doDamage f cr w
in fw $ w & creatures . at (_crID cr) .~ mcr
stateUpdate' :: (Creature -> World -> (World -> World, Creature))
stateUpdate :: (Creature -> World -> (World -> World, Creature))
-> Creature -> World -> World
stateUpdate' f cr w = let (fw,mcr) = stateUpdateDamage' doDamage f cr w
stateUpdate f cr w = let (fw,mcr) = stateUpdateDamage' doDamage f cr w
in fw $ w & creatures . at (_crID cr) .~ mcr
stateUpdateDamage :: (Creature -> Creature) -> CRUpdate -> CRUpdate