Simplify creature update
This commit is contained in:
@@ -150,7 +150,7 @@ moduleCombinations =
|
|||||||
, [amod [INCENDIARYMODULE] "+INCENDIARY" (itParams . lasBeam .~ BeamCombine flameBeamCombine)
|
, [amod [INCENDIARYMODULE] "+INCENDIARY" (itParams . lasBeam .~ BeamCombine flameBeamCombine)
|
||||||
,amod [STATICMODULE] "+STATIC"
|
,amod [STATICMODULE] "+STATIC"
|
||||||
( (itParams . lasBeam .~ BeamCombine teslaBeamCombine)
|
( (itParams . lasBeam .~ BeamCombine teslaBeamCombine)
|
||||||
. (itParams . subParams .~ Just teslaParams)
|
. (itParams . subParams ?~ teslaParams)
|
||||||
)
|
)
|
||||||
,amod [TRANSFORMER] "+SPLIT" (itParams . lasBeam .~ BeamCombine splitBeamCombine)
|
,amod [TRANSFORMER] "+SPLIT" (itParams . lasBeam .~ BeamCombine splitBeamCombine)
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ module Dodge.Creature
|
|||||||
, smallChaseCrit
|
, smallChaseCrit
|
||||||
) where
|
) where
|
||||||
import Dodge.Creature.State.Data
|
import Dodge.Creature.State.Data
|
||||||
|
import Dodge.Creature.Update
|
||||||
--import Dodge.Item.Weapon.Grenade
|
--import Dodge.Item.Weapon.Grenade
|
||||||
import Dodge.Item.Weapon.Booster
|
import Dodge.Item.Weapon.Booster
|
||||||
import Dodge.Item.Weapon.Utility
|
import Dodge.Item.Weapon.Utility
|
||||||
@@ -20,7 +21,7 @@ import Dodge.Item.Craftable
|
|||||||
--import Dodge.Creature.SetTarget
|
--import Dodge.Creature.SetTarget
|
||||||
import Dodge.Creature.Volition
|
import Dodge.Creature.Volition
|
||||||
import Dodge.Creature.Test
|
import Dodge.Creature.Test
|
||||||
import Dodge.Creature.Impulse
|
--import Dodge.Creature.Impulse
|
||||||
import Dodge.Creature.SentinelAI
|
import Dodge.Creature.SentinelAI
|
||||||
import Dodge.Creature.LauncherCrit
|
import Dodge.Creature.LauncherCrit
|
||||||
import Dodge.Creature.PistolCrit
|
import Dodge.Creature.PistolCrit
|
||||||
@@ -66,8 +67,8 @@ spawnerCrit = defaultCreature
|
|||||||
miniGunCrit :: Creature
|
miniGunCrit :: Creature
|
||||||
miniGunCrit = defaultCreature
|
miniGunCrit = defaultCreature
|
||||||
{ _crPict = basicCrPict red
|
{ _crPict = basicCrPict red
|
||||||
, _crUpdate = stateUpdate $ impulsiveAI $
|
, _crUpdate = defaultImpulsive $
|
||||||
sentinelFireType (const shootTillEmpty)
|
[sentinelFireType (const shootTillEmpty)]
|
||||||
, _crActionPlan = ActionPlan
|
, _crActionPlan = ActionPlan
|
||||||
{ _crImpulse = []
|
{ _crImpulse = []
|
||||||
, _crAction = []
|
, _crAction = []
|
||||||
@@ -87,7 +88,7 @@ longCrit :: Creature
|
|||||||
longCrit = defaultCreature
|
longCrit = defaultCreature
|
||||||
{ _crPict = basicCrPict red
|
{ _crPict = basicCrPict red
|
||||||
-- , _crUpdate = stateUpdate sniperAI
|
-- , _crUpdate = stateUpdate sniperAI
|
||||||
, _crUpdate = stateUpdate $ impulsiveAI $ sentinelFireType $ const shootTillEmpty
|
, _crUpdate = defaultImpulsive $ [sentinelFireType $ const shootTillEmpty]
|
||||||
, _crActionPlan = ActionPlan
|
, _crActionPlan = ActionPlan
|
||||||
{ _crImpulse = []
|
{ _crImpulse = []
|
||||||
, _crAction = []
|
, _crAction = []
|
||||||
@@ -107,7 +108,7 @@ multGunCrit = defaultCreature
|
|||||||
, _crInvSel = 0
|
, _crInvSel = 0
|
||||||
, _crRad = 10
|
, _crRad = 10
|
||||||
, _crHP = 300
|
, _crHP = 300
|
||||||
, _crUpdate = stateUpdate $ impulsiveAI $ sentinelExtraWatchUpdate
|
, _crUpdate = defaultImpulsive $ [sentinelExtraWatchUpdate
|
||||||
[ ( const $ not . crHasAmmo
|
[ ( const $ not . crHasAmmo
|
||||||
, \_ _ -> StrategyActions Reload reloadActions
|
, \_ _ -> StrategyActions Reload reloadActions
|
||||||
)
|
)
|
||||||
@@ -120,6 +121,7 @@ multGunCrit = defaultCreature
|
|||||||
[ drawwp `DoActionThen` shootFirstMiss `DoActionThen` DoImpulses [ChangeStrategy WatchAndWait] ]
|
[ drawwp `DoActionThen` shootFirstMiss `DoActionThen` DoImpulses [ChangeStrategy WatchAndWait] ]
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
]
|
||||||
, _crActionPlan = ActionPlan
|
, _crActionPlan = ActionPlan
|
||||||
{ _crImpulse = []
|
{ _crImpulse = []
|
||||||
, _crAction = []
|
, _crAction = []
|
||||||
@@ -148,7 +150,7 @@ startCr = defaultCreature
|
|||||||
, _crMvDir = pi/2
|
, _crMvDir = pi/2
|
||||||
, _crID = 0
|
, _crID = 0
|
||||||
, _crPict = basicCrPict black
|
, _crPict = basicCrPict black
|
||||||
, _crUpdate = stateUpdate yourControl
|
, _crUpdate = stateUpdate' yourControl'
|
||||||
, _crRad = 10
|
, _crRad = 10
|
||||||
, _crMass = 10
|
, _crMass = 10
|
||||||
, _crHP = 1000
|
, _crHP = 1000
|
||||||
|
|||||||
@@ -3,12 +3,13 @@ module Dodge.Creature.ArmourChase
|
|||||||
) where
|
) where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
import Dodge.Creature.State
|
--import Dodge.Creature.State
|
||||||
import Dodge.Creature.ChainUpdates
|
import Dodge.Creature.Update
|
||||||
|
--import Dodge.Creature.ChainUpdates
|
||||||
import Dodge.Creature.ReaderUpdate
|
import Dodge.Creature.ReaderUpdate
|
||||||
import Dodge.Creature.Perception
|
import Dodge.Creature.Perception
|
||||||
import Dodge.Creature.Picture
|
import Dodge.Creature.Picture
|
||||||
import Dodge.Creature.Impulse
|
--import Dodge.Creature.Impulse
|
||||||
import Dodge.Creature.Action
|
import Dodge.Creature.Action
|
||||||
import Dodge.Item.Equipment
|
import Dodge.Item.Equipment
|
||||||
import Dodge.Item.Consumable
|
import Dodge.Item.Consumable
|
||||||
@@ -19,7 +20,7 @@ import Control.Lens
|
|||||||
|
|
||||||
armourChaseCrit :: Creature
|
armourChaseCrit :: Creature
|
||||||
armourChaseCrit = defaultCreature
|
armourChaseCrit = defaultCreature
|
||||||
{ _crUpdate = stateUpdate $ impulsiveAI $ chainCreatureUpdates
|
{ _crUpdate = defaultImpulsive
|
||||||
[ watchUpdateStrat []
|
[ watchUpdateStrat []
|
||||||
, const doStrategyActions
|
, const doStrategyActions
|
||||||
, performActions
|
, performActions
|
||||||
|
|||||||
@@ -4,10 +4,11 @@ module Dodge.Creature.AutoCrit
|
|||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
import Dodge.Creature.Picture
|
import Dodge.Creature.Picture
|
||||||
|
import Dodge.Creature.Update
|
||||||
import Dodge.Creature.SentinelAI
|
import Dodge.Creature.SentinelAI
|
||||||
--import Dodge.Creature.ChooseTarget
|
--import Dodge.Creature.ChooseTarget
|
||||||
import Dodge.Creature.Impulse
|
--import Dodge.Creature.Impulse
|
||||||
import Dodge.Creature.State
|
--import Dodge.Creature.State
|
||||||
--import Dodge.Creature.State.Data
|
--import Dodge.Creature.State.Data
|
||||||
import Dodge.Item.Weapon.BulletGuns
|
import Dodge.Item.Weapon.BulletGuns
|
||||||
import Dodge.Item.Consumable
|
import Dodge.Item.Consumable
|
||||||
@@ -21,7 +22,7 @@ import qualified Data.IntMap.Strict as IM
|
|||||||
autoCrit :: Creature
|
autoCrit :: Creature
|
||||||
autoCrit = defaultCreature
|
autoCrit = defaultCreature
|
||||||
{ _crPict = basicCrPict red
|
{ _crPict = basicCrPict red
|
||||||
, _crUpdate = stateUpdate $ impulsiveAI sentinelAI
|
, _crUpdate = defaultImpulsive [sentinelAI]
|
||||||
, _crActionPlan = ActionPlan
|
, _crActionPlan = ActionPlan
|
||||||
{ _crImpulse = []
|
{ _crImpulse = []
|
||||||
, _crAction = []
|
, _crAction = []
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ smallChaseCrit = chaseCrit
|
|||||||
}
|
}
|
||||||
chaseCrit :: Creature
|
chaseCrit :: Creature
|
||||||
chaseCrit = defaultCreature
|
chaseCrit = defaultCreature
|
||||||
{ _crUpdate = stateUpdate $ impulsiveAI $ chainCreatureUpdates
|
{ _crUpdate = stateUpdate' $ impulsiveAI' $ chainCreatureUpdates
|
||||||
[ const doStrategyActions
|
[ const doStrategyActions
|
||||||
, performActions
|
, performActions
|
||||||
, const overrideMeleeCloseTarget
|
, const overrideMeleeCloseTarget
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ import Control.Monad.State
|
|||||||
--import System.Random
|
--import System.Random
|
||||||
import Data.List
|
import Data.List
|
||||||
|
|
||||||
|
applyNoDamage :: [Damage] -> Creature -> World -> World
|
||||||
|
applyNoDamage _ _ = id
|
||||||
|
|
||||||
defaultApplyDamage :: [Damage] -> Creature -> World -> World
|
defaultApplyDamage :: [Damage] -> Creature -> World -> World
|
||||||
defaultApplyDamage ds cr w = foldl' (applyIndividualDamage cr) w ds'
|
defaultApplyDamage ds cr w = foldl' (applyIndividualDamage cr) w ds'
|
||||||
& creatures . ix (_crID cr) %~ doPoisonDam
|
& creatures . ix (_crID cr) %~ doPoisonDam
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
{-# LANGUAGE TupleSections #-}
|
{-# LANGUAGE TupleSections #-}
|
||||||
module Dodge.Creature.Impulse
|
module Dodge.Creature.Impulse
|
||||||
( impulsiveAI
|
( impulsiveAI
|
||||||
|
, impulsiveAI'
|
||||||
, followImpulses
|
, followImpulses
|
||||||
, followThenClearImpulses
|
, followThenClearImpulses
|
||||||
|
, followThenClearImpulses'
|
||||||
) where
|
) where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Creature.Vocalization
|
import Dodge.Creature.Vocalization
|
||||||
@@ -17,6 +19,12 @@ import System.Random
|
|||||||
import Data.Bifunctor
|
import Data.Bifunctor
|
||||||
--import Data.Maybe
|
--import Data.Maybe
|
||||||
|
|
||||||
|
impulsiveAI' :: (World -> Creature -> Creature)
|
||||||
|
-> Creature -> World -> World
|
||||||
|
impulsiveAI' f cr w = g w & creatures . ix (_crID cr) .~ cr'
|
||||||
|
where
|
||||||
|
(g,cr') = impulsiveAI f cr w
|
||||||
|
|
||||||
impulsiveAI
|
impulsiveAI
|
||||||
:: (World -> Creature -> Creature) -- | internal creature update
|
:: (World -> Creature -> Creature) -- | internal creature update
|
||||||
-> Creature
|
-> Creature
|
||||||
@@ -24,6 +32,11 @@ impulsiveAI
|
|||||||
-> (World -> World , Creature)
|
-> (World -> World , Creature)
|
||||||
impulsiveAI f cr w = followImpulses w $ f w cr
|
impulsiveAI f cr w = followImpulses w $ f w cr
|
||||||
|
|
||||||
|
followThenClearImpulses' :: Creature -> World -> World
|
||||||
|
followThenClearImpulses' cr w = f w & creatures . ix (_crID cr) .~ cr'
|
||||||
|
where
|
||||||
|
(f,cr') = followThenClearImpulses w cr
|
||||||
|
|
||||||
followThenClearImpulses :: World -> Creature -> (World -> World, Creature)
|
followThenClearImpulses :: World -> Creature -> (World -> World, Creature)
|
||||||
followThenClearImpulses w = second f . followImpulses w
|
followThenClearImpulses w = second f . followImpulses w
|
||||||
where
|
where
|
||||||
|
|||||||
@@ -5,15 +5,16 @@ module Dodge.Creature.LauncherCrit
|
|||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
import Dodge.Creature.Picture
|
import Dodge.Creature.Picture
|
||||||
import Dodge.Creature.ChainUpdates
|
--import Dodge.Creature.ChainUpdates
|
||||||
import Dodge.Creature.Test
|
import Dodge.Creature.Test
|
||||||
import Dodge.Creature.Volition
|
import Dodge.Creature.Volition
|
||||||
import Dodge.Creature.Strategy
|
import Dodge.Creature.Strategy
|
||||||
import Dodge.Creature.ReaderUpdate
|
import Dodge.Creature.ReaderUpdate
|
||||||
import Dodge.Creature.Perception
|
import Dodge.Creature.Perception
|
||||||
import Dodge.Creature.State
|
--import Dodge.Creature.State
|
||||||
|
import Dodge.Creature.Update
|
||||||
import Dodge.Item.Weapon.Launcher
|
import Dodge.Item.Weapon.Launcher
|
||||||
import Dodge.Creature.Impulse
|
--import Dodge.Creature.Impulse
|
||||||
import Dodge.Creature.Action
|
import Dodge.Creature.Action
|
||||||
import Geometry.Data
|
import Geometry.Data
|
||||||
import Picture
|
import Picture
|
||||||
@@ -24,7 +25,7 @@ import Control.Lens
|
|||||||
launcherCrit :: Creature
|
launcherCrit :: Creature
|
||||||
launcherCrit = defaultCreature
|
launcherCrit = defaultCreature
|
||||||
{ _crPict = basicCrPict red
|
{ _crPict = basicCrPict red
|
||||||
, _crUpdate = stateUpdate $ impulsiveAI $ chainCreatureUpdates
|
, _crUpdate = defaultImpulsive
|
||||||
[ performActions
|
[ performActions
|
||||||
, watchUpdateStrat
|
, watchUpdateStrat
|
||||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0) [retreatFire])
|
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0) [retreatFire])
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import Control.Lens
|
|||||||
ltAutoCrit :: Creature
|
ltAutoCrit :: Creature
|
||||||
ltAutoCrit = defaultCreature
|
ltAutoCrit = defaultCreature
|
||||||
{ _crPict = basicCrPict red
|
{ _crPict = basicCrPict red
|
||||||
, _crUpdate = stateUpdate $ impulsiveAI $ chainCreatureUpdates
|
, _crUpdate = stateUpdate' $ impulsiveAI' $ chainCreatureUpdates
|
||||||
[ performActions
|
[ performActions
|
||||||
, watchUpdateStrat
|
, watchUpdateStrat
|
||||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
|
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import Control.Monad.State
|
|||||||
pistolCrit :: Creature
|
pistolCrit :: Creature
|
||||||
pistolCrit = defaultCreature
|
pistolCrit = defaultCreature
|
||||||
{ _crPict = basicCrPict red
|
{ _crPict = basicCrPict red
|
||||||
, _crUpdate = stateUpdate $ impulsiveAI $ chainCreatureUpdates
|
, _crUpdate = stateUpdate' $ impulsiveAI' $ chainCreatureUpdates
|
||||||
[ performActions
|
[ performActions
|
||||||
, watchUpdateStrat
|
, watchUpdateStrat
|
||||||
[ (crHasTargetLOS, \w cr -> StrategyActions (ShootAt 0)
|
[ (crHasTargetLOS, \w cr -> StrategyActions (ShootAt 0)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import Control.Lens
|
|||||||
spreadGunCrit :: Creature
|
spreadGunCrit :: Creature
|
||||||
spreadGunCrit = defaultCreature
|
spreadGunCrit = defaultCreature
|
||||||
{ _crPict = basicCrPict red
|
{ _crPict = basicCrPict red
|
||||||
, _crUpdate = stateUpdate $ impulsiveAI $ chainCreatureUpdates
|
, _crUpdate = stateUpdate' $ impulsiveAI' $ chainCreatureUpdates
|
||||||
[performActions
|
[performActions
|
||||||
,watchUpdateStrat
|
,watchUpdateStrat
|
||||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
|
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
module Dodge.Creature.State
|
module Dodge.Creature.State
|
||||||
( stateUpdate
|
( stateUpdate'
|
||||||
, stateUpdateDamage
|
, stateUpdateDamage
|
||||||
, doDamage
|
, doDamage
|
||||||
, clearDamage
|
, clearDamage
|
||||||
@@ -8,6 +8,7 @@ module Dodge.Creature.State
|
|||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Hammer
|
import Dodge.Hammer
|
||||||
import Dodge.Reloading
|
import Dodge.Reloading
|
||||||
|
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Dodge.Creature.State.WalkCycle
|
import Dodge.Creature.State.WalkCycle
|
||||||
--import Dodge.Creature.Test
|
--import Dodge.Creature.Test
|
||||||
@@ -38,20 +39,47 @@ import System.Random
|
|||||||
--import qualified Data.Vector as V
|
--import qualified Data.Vector as V
|
||||||
--import qualified Data.Vector.Mutable as MV
|
--import qualified Data.Vector.Mutable as MV
|
||||||
|
|
||||||
-- | The movement is updated before the ai in order to correctly set the oldpos.
|
foldCr :: [Creature -> World -> World]
|
||||||
|
-> Creature -> World -> World
|
||||||
|
foldCr xs cr w = foldr ($ cr) w xs
|
||||||
|
|
||||||
|
-- | this seems to work, but I am not sure about the ordering:
|
||||||
|
-- previously, the movement was updated before the ai in order to correctly set the oldpos.
|
||||||
-- This should be made more sensible: should the movement side effects apply to
|
-- This should be made more sensible: should the movement side effects apply to
|
||||||
-- the creature before or after it has moved?
|
-- the creature before or after it has moved?
|
||||||
-- currently invSideEffects are applied after the creature moves, to correctly
|
-- at what point invSideEffects is applied wrt to when the creature moves
|
||||||
-- update shield positions
|
-- may effect whether the shield moves correctly
|
||||||
stateUpdate :: (Creature -> World -> (World -> World, Creature))
|
stateUpdate' :: (Creature -> World -> World) -> Creature -> World -> World
|
||||||
-> Creature -> World -> World
|
stateUpdate' f = foldCr
|
||||||
stateUpdate = stateUpdateDamage doDamage
|
[ checkDeath
|
||||||
|
, doDamage
|
||||||
|
, invSideEff
|
||||||
|
, movementSideEff
|
||||||
|
, moveCrHammerUp
|
||||||
|
, stepReloading'
|
||||||
|
, updateMovement'
|
||||||
|
, f
|
||||||
|
]
|
||||||
|
|
||||||
|
checkDeath :: Creature -> World -> World
|
||||||
|
checkDeath cr
|
||||||
|
| _crHP cr < 1 = creatures . at (_crID cr) .~ Nothing -- TODO add corpse
|
||||||
|
| otherwise = id
|
||||||
|
moveCrHammerUp :: Creature -> World -> World
|
||||||
|
moveCrHammerUp cr = creatures . ix (_crID cr) . crHammerPosition %~ moveHammerUp
|
||||||
|
|
||||||
|
stepReloading' :: Creature -> World -> World
|
||||||
|
stepReloading' cr = creatures . ix (_crID cr) %~ stepReloading
|
||||||
|
|
||||||
|
updateMovement' :: Creature -> World -> World
|
||||||
|
updateMovement' cr = creatures . ix (_crID cr) %~ updateMovement
|
||||||
|
|
||||||
stateUpdateDamage :: (Creature -> World -> World)
|
stateUpdateDamage :: (Creature -> World -> World)
|
||||||
-> (Creature -> World -> (World -> World, Creature))
|
-> (Creature -> World -> (World -> World, Creature))
|
||||||
-> Creature -> World -> World
|
-> Creature -> World -> World
|
||||||
stateUpdateDamage damageupdate u cr w = damageupdate cr $
|
stateUpdateDamage damageupdate u cr w = damageupdate cr
|
||||||
invSideEff upcr . movementSideEff cr . deathEff . f $ w
|
$ invSideEff upcr . movementSideEff cr . deathEff . f
|
||||||
|
$ w
|
||||||
& creatures . at (_crID cr) .~ (mvcrhammerup . stepReloading <$> crOrCorpse upcr)
|
& creatures . at (_crID cr) .~ (mvcrhammerup . stepReloading <$> crOrCorpse upcr)
|
||||||
where
|
where
|
||||||
(f,upcr) = u (updateMovement cr) w
|
(f,upcr) = u (updateMovement cr) w
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
module Dodge.Creature.SwarmCrit
|
module Dodge.Creature.SwarmCrit
|
||||||
( swarmCrit
|
( swarmCrit
|
||||||
)
|
) where
|
||||||
where
|
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
import Dodge.Creature.Picture
|
import Dodge.Creature.Picture
|
||||||
import Dodge.Creature.ChainUpdates
|
import Dodge.Creature.Update
|
||||||
|
--import Dodge.Creature.ChainUpdates
|
||||||
import Dodge.Creature.Boid
|
import Dodge.Creature.Boid
|
||||||
import Dodge.Creature.ReaderUpdate
|
import Dodge.Creature.ReaderUpdate
|
||||||
import Dodge.Creature.Perception
|
import Dodge.Creature.Perception
|
||||||
import Dodge.Creature.Impulse
|
--import Dodge.Creature.Impulse
|
||||||
import Dodge.Creature.State
|
--import Dodge.Creature.State
|
||||||
import Dodge.Picture.Layer
|
import Dodge.Picture.Layer
|
||||||
import Picture
|
import Picture
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ import Control.Lens
|
|||||||
|
|
||||||
swarmCrit :: Creature
|
swarmCrit :: Creature
|
||||||
swarmCrit = defaultCreature
|
swarmCrit = defaultCreature
|
||||||
{ _crUpdate = stateUpdate $ impulsiveAI $ chainCreatureUpdates
|
{ _crUpdate = defaultImpulsive
|
||||||
[ flockToPointUsing' (encircleDistP 100) (meleeHeadingMove 0.1 0.1 (pi/4) 3.9)
|
[ flockToPointUsing' (encircleDistP 100) (meleeHeadingMove 0.1 0.1 (pi/4) 3.9)
|
||||||
, const (crMeleeCooldown %~ max 0 . subtract 1)
|
, const (crMeleeCooldown %~ max 0 . subtract 1)
|
||||||
, perceptionUpdate [0]
|
, perceptionUpdate [0]
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
module Dodge.Creature.YourControl
|
module Dodge.Creature.YourControl
|
||||||
( yourControl
|
(-- yourControl
|
||||||
|
yourControl'
|
||||||
) where
|
) where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Creature.Impulse.Movement
|
import Dodge.Creature.Impulse.Movement
|
||||||
@@ -23,6 +24,12 @@ yourControl cr w =
|
|||||||
)
|
)
|
||||||
where
|
where
|
||||||
speed = _mvSpeed $ _crMvType cr
|
speed = _mvSpeed $ _crMvType cr
|
||||||
|
yourControl' :: Creature -> World -> World
|
||||||
|
yourControl' cr w = w
|
||||||
|
& updateUsingInput
|
||||||
|
& creatures . ix (_crID cr) %~ (mouseActionsCr (_mouseButtons w) . wasdWithAiming w speed 0)
|
||||||
|
where
|
||||||
|
speed = _mvSpeed $ _crMvType cr
|
||||||
|
|
||||||
{- | Turn key presses into creature movement. -}
|
{- | Turn key presses into creature movement. -}
|
||||||
wasdWithAiming
|
wasdWithAiming
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
module Dodge.Debug.Terminal
|
module Dodge.Debug.Terminal
|
||||||
where
|
where
|
||||||
import Dodge.Creature
|
import Dodge.Creature
|
||||||
import Dodge.Creature.State
|
import Dodge.Creature.Damage
|
||||||
import Dodge.Creature.YourControl
|
--import Dodge.Creature.State
|
||||||
|
--import Dodge.Creature.YourControl
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Menu.PushPop
|
import Dodge.Menu.PushPop
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
@@ -22,9 +23,8 @@ applyTerminalString "LOADME" = (uvWorld . creatures . ix 0 . crInv .~ stackedInv
|
|||||||
. (uvWorld . creatures . ix 0 . crInvCapacity .~ 50)
|
. (uvWorld . creatures . ix 0 . crInvCapacity .~ 50)
|
||||||
applyTerminalString "LA" = (uvWorld . creatures . ix 0 . crInv .~ inventoryA)
|
applyTerminalString "LA" = (uvWorld . creatures . ix 0 . crInv .~ inventoryA)
|
||||||
. (uvWorld . creatures . ix 0 . crInvCapacity .~ 50)
|
. (uvWorld . creatures . ix 0 . crInvCapacity .~ 50)
|
||||||
applyTerminalString "GODON" =
|
applyTerminalString "GODON" = uvWorld . creatures . ix 0 . crApplyDamage .~ applyNoDamage
|
||||||
uvWorld . creatures . ix 0 . crUpdate .~ stateUpdateDamage clearDamage yourControl
|
applyTerminalString "GODOFF" = uvWorld . creatures . ix 0 . crApplyDamage .~ defaultApplyDamage
|
||||||
applyTerminalString "GODOFF" = uvWorld . creatures . ix 0 . crUpdate .~ stateUpdate yourControl
|
|
||||||
applyTerminalString "LOADTEST" = (uvWorld . creatures . ix 0 . crInv .~ testInventory)
|
applyTerminalString "LOADTEST" = (uvWorld . creatures . ix 0 . crInv .~ testInventory)
|
||||||
. (uvWorld . creatures . ix 0 . crInvCapacity .~ 50)
|
. (uvWorld . creatures . ix 0 . crInvCapacity .~ 50)
|
||||||
applyTerminalString "LM" = applyTerminalString "LOADME"
|
applyTerminalString "LM" = applyTerminalString "LOADME"
|
||||||
|
|||||||
@@ -404,7 +404,7 @@ shootTeslaArc' :: ItemParams -> Point2 -> Float -> World -> (World,ItemParams)
|
|||||||
shootTeslaArc' ip pos dir w =
|
shootTeslaArc' ip pos dir w =
|
||||||
(w & randGen .~ g
|
(w & randGen .~ g
|
||||||
& instantParticles .:~ aTeslaArcAt col newarc
|
& instantParticles .:~ aTeslaArcAt col newarc
|
||||||
, ip & currentArc .~ Just newarc
|
, ip & currentArc ?~ newarc
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
(col,g) = takeOne [white,azure,blue,cyan] & runState $ _randGen w
|
(col,g) = takeOne [white,azure,blue,cyan] & runState $ _randGen w
|
||||||
@@ -487,6 +487,7 @@ shootLaser it cr = instantParticles .:~ lasRayAt (_lasColor $ _itParams it) dam
|
|||||||
phasev = _phaseV . _itParams $ _crInv cr IM.! _crInvSel cr
|
phasev = _phaseV . _itParams $ _crInv cr IM.! _crInvSel cr
|
||||||
dam = _lasDamage $ _itParams it
|
dam = _lasDamage $ _itParams it
|
||||||
|
|
||||||
|
|
||||||
shootDualLaser :: Item -> Creature -> World -> World
|
shootDualLaser :: Item -> Creature -> World -> World
|
||||||
shootDualLaser it cr w = w'
|
shootDualLaser it cr w = w'
|
||||||
& newBeams . positronBeams .:~ dualRayAt (_lasBeam $ _itParams it) itid w (_lasColor $ _itParams it) dam phasev posl dirl
|
& newBeams . positronBeams .:~ dualRayAt (_lasBeam $ _itParams it) itid w (_lasColor $ _itParams it) dam phasev posl dirl
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import Color
|
|||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
--import Dodge.Reloading
|
--import Dodge.Reloading
|
||||||
import Dodge.Creature.State
|
import Dodge.Creature.State
|
||||||
|
import Dodge.Creature.Damage
|
||||||
import Dodge.Creature.Impulse
|
import Dodge.Creature.Impulse
|
||||||
import Dodge.Creature.Picture
|
import Dodge.Creature.Picture
|
||||||
import Dodge.LevelGen.Data
|
import Dodge.LevelGen.Data
|
||||||
@@ -76,8 +77,9 @@ updateTurret rotSpeed mc w
|
|||||||
& crRad .~ 1
|
& crRad .~ 1
|
||||||
& crDir .~ mcdir
|
& crDir .~ mcdir
|
||||||
& crPict .~ (\cr _ _ -> drawCrEquipment cr)
|
& crPict .~ (\cr _ _ -> drawCrEquipment cr)
|
||||||
& crUpdate .~ stateUpdateDamage clearDamage (flip followThenClearImpulses)
|
& crUpdate .~ stateUpdate' followThenClearImpulses'
|
||||||
& crStance . posture .~ Aiming
|
& crStance . posture .~ Aiming
|
||||||
|
& crApplyDamage .~ applyNoDamage
|
||||||
Just cid -> w'
|
Just cid -> w'
|
||||||
& creatures . ix cid . crPos .~ mcpos
|
& creatures . ix cid . crPos .~ mcpos
|
||||||
& creatures . ix cid . crDir .~ mcdir
|
& creatures . ix cid . crDir .~ mcdir
|
||||||
|
|||||||
Reference in New Issue
Block a user