Add terminal GODON command
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
module Dodge.Creature.State
|
||||
( stateUpdate
|
||||
, stateUpdateDamage
|
||||
, doDamage
|
||||
, clearDamage
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Hammer
|
||||
@@ -35,20 +37,19 @@ import Data.Monoid
|
||||
import qualified Data.Vector as V
|
||||
import qualified Data.Vector.Mutable as MV
|
||||
|
||||
--dummyUpdate :: CRUpdate
|
||||
--dummyUpdate cr _ = (Endo id, Just cr)
|
||||
|
||||
-- | The movement is updated before the ai in order to correctly set the oldpos.
|
||||
-- This should be made more sensible: should the movement side effects apply to
|
||||
-- the creature before or after it has moved?
|
||||
-- currently invSideEffects are applied after the creature moves, to correctly
|
||||
-- update shield positions
|
||||
stateUpdate :: CRUpdate -> CRUpdate
|
||||
stateUpdate u cr w = case u (updateMovement cr) w of
|
||||
stateUpdate = stateUpdateDamage doDamage
|
||||
|
||||
stateUpdateDamage :: (Creature -> Creature) -> CRUpdate -> CRUpdate
|
||||
stateUpdateDamage damageupdate u cr w = case u (updateMovement cr) w of
|
||||
(f, maybeCr) ->
|
||||
( Endo $ invSideEff (fromMaybe cr maybeCr) . movementSideEff cr . deathEff . appEndo f
|
||||
--, fmap (stepReloading . doDamage . crAutoReload) $ crOrCorpse =<< maybeCr
|
||||
, fmap (stepReloading . doDamage) $ crOrCorpse =<< maybeCr
|
||||
, fmap (stepReloading . damageupdate) $ crOrCorpse =<< maybeCr
|
||||
)
|
||||
where
|
||||
crOrCorpse cr'
|
||||
@@ -81,6 +82,9 @@ setOldPos cr = cr
|
||||
--meleeCooldown :: CRUpdate -> CRUpdate
|
||||
--meleeCooldown u cr = u $ cr & crMeleeCooldown . _Just %~ (max 0 . (\x -> x - 1))
|
||||
|
||||
clearDamage :: Creature -> Creature
|
||||
clearDamage = crState . crDamage .~ []
|
||||
|
||||
doDamage :: Creature -> Creature
|
||||
doDamage cr = set (crState . crDamage) []
|
||||
. over (crState . crPastDamage) (advancePastDamages dams)
|
||||
|
||||
Reference in New Issue
Block a user