Refactor bullet particles
This commit is contained in:
+37
-61
@@ -6,20 +6,25 @@ module Dodge.Creature
|
||||
, ltAutoCrit
|
||||
, spreadGunCrit
|
||||
, autoCrit
|
||||
, chaseCrit
|
||||
, smallChaseCrit
|
||||
)
|
||||
where
|
||||
--import Dodge.Creature.Stance.Data
|
||||
import Dodge.Creature.State.Data
|
||||
import Dodge.Creature.ImpulseRat
|
||||
import Dodge.Creature.ActionRat
|
||||
import Dodge.Creature.AlertLevel
|
||||
import Dodge.Creature.SetTarget
|
||||
--import Dodge.Creature.ReaderUpdate
|
||||
--import Dodge.Creature.AlertLevel
|
||||
--import Dodge.Creature.SetTarget
|
||||
import Dodge.Creature.Volition
|
||||
import Dodge.Creature.Test
|
||||
import Dodge.Creature.SentinelAI
|
||||
import Dodge.Creature.LauncherCrit
|
||||
import Dodge.Creature.PistolCrit
|
||||
import Dodge.Creature.LtAutoCrit
|
||||
import Dodge.Creature.SpreadGunCrit
|
||||
import Dodge.Creature.AutoCrit
|
||||
import Dodge.Creature.ChaseCrit
|
||||
import Dodge.Data
|
||||
import Dodge.Default
|
||||
import Dodge.Base
|
||||
@@ -43,7 +48,7 @@ import Picture
|
||||
--import Data.Maybe
|
||||
--import Data.Function
|
||||
import Control.Lens
|
||||
import Control.Monad.State
|
||||
--import Control.Monad.Reader
|
||||
--import System.Random
|
||||
--import qualified Data.Set as S
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
@@ -56,32 +61,6 @@ spawnerCrit = defaultCreature
|
||||
, _crPict = basicCrPict blue
|
||||
, _crInv = IM.empty -- IM.fromList [(0,frontArmour)]
|
||||
}
|
||||
smallChaseCrit :: Creature
|
||||
smallChaseCrit = defaultCreature
|
||||
{ _crUpdate = stateUpdate $ meleeCooldown $ impulsiveAI $ chaseTarget targetYouLOS
|
||||
, _crHP = 1
|
||||
, _crRad = 4
|
||||
, _crPict = basicCrPict yellow
|
||||
, _crInv = IM.empty -- IM.fromList [(0,frontArmour)]
|
||||
, _crCorpse = onLayer CorpseLayer $ color (greyN 0.5) $ circleSolid 4
|
||||
, _crFaction = ColorFaction green
|
||||
}
|
||||
chaseCrit :: Creature
|
||||
chaseCrit = defaultCreature
|
||||
{ _crUpdate = stateUpdate $ impulsiveAIR $
|
||||
doStrategyActionsR >=>
|
||||
performActionsR >=>
|
||||
overrideMeleeCloseTargetR >=>
|
||||
chaseTargetR targetYouLOS >=>
|
||||
basicPerceptionUpdateR [0] >=>
|
||||
targetYouWhenCognizantR >=>
|
||||
return . (crMeleeCooldown . _Just %~ (max 0 . subtract 1))
|
||||
, _crHP = 300
|
||||
, _crPict = basicCrPict green
|
||||
, _crInv = IM.empty
|
||||
, _crMeleeCooldown = Just 0
|
||||
, _crFaction = ColorFaction green
|
||||
}
|
||||
armourChaseCrit :: Creature
|
||||
armourChaseCrit = defaultCreature
|
||||
{ _crUpdate = stateUpdate $ meleeCooldown $ impulsiveAI $ chaseTarget targetYouLOS
|
||||
@@ -95,11 +74,14 @@ armourChaseCrit = defaultCreature
|
||||
miniGunCrit :: Creature
|
||||
miniGunCrit = defaultCreature
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate $ impulsiveAI $ composeInternalAIs
|
||||
[ performActions
|
||||
, shootTargetWithStrat targetYouCognizant suppress
|
||||
, basicPerceptionUpdate [0]
|
||||
]
|
||||
, _crUpdate = stateUpdate $ impulsiveAIR $
|
||||
sentinelFireType (const shootTillEmpty)
|
||||
, _crActionPlan = ActionPlan
|
||||
{ _crImpulse = []
|
||||
, _crAction = []
|
||||
, _crStrategy = StrategyActions WatchAndWait [StartSentinelPost]
|
||||
, _crGoal = []
|
||||
}
|
||||
, _crInv = IM.fromList [(0,miniGun)]
|
||||
, _crInvSel = 0
|
||||
, _crRad = 10
|
||||
@@ -110,19 +92,7 @@ longCrit :: Creature
|
||||
longCrit = defaultCreature
|
||||
{ _crPict = basicCrPict red
|
||||
-- , _crUpdate = stateUpdate sniperAI
|
||||
, _crUpdate = stateUpdate $ impulsiveAI $ composeInternalAIs
|
||||
[ performActions
|
||||
, watchUpdateStrat
|
||||
[ (crHasTargetLOS, aimThenShootStrat 0)
|
||||
, (crAwayFromPost, goToPostStrat)
|
||||
]
|
||||
, basicPerceptionUpdate [0]
|
||||
, doStrategyActions
|
||||
, reloadOverrideNoHolster
|
||||
, targetYouWhenCognizant
|
||||
, overrideInternal (onBoth (&&) crHasTarget (crStratConMatches (GetTo (0,0))))
|
||||
$ \ _ -> crActionPlan . crStrategy .~ WatchAndWait
|
||||
]
|
||||
, _crUpdate = stateUpdate $ impulsiveAIR $ sentinelFireType $ const shootTillEmpty
|
||||
, _crActionPlan = ActionPlan
|
||||
{ _crImpulse = []
|
||||
, _crAction = []
|
||||
@@ -142,20 +112,19 @@ multGunCrit = defaultCreature
|
||||
, _crInvSel = 0
|
||||
, _crRad = 10
|
||||
, _crHP = 300
|
||||
, _crUpdate = stateUpdate $ impulsiveAI $ composeInternalAIs
|
||||
[ performActions
|
||||
, watchUpdateStrat
|
||||
[ (not . crSafeDistFromTarg 150 , fleeTime 5)
|
||||
, (crHasTargetLOS, shootFirstMiss 0)
|
||||
, (crAwayFromPost, goToPostStrat)
|
||||
, _crUpdate = stateUpdate $ impulsiveAIR $ sentinelExtraWatchUpdate
|
||||
[ ( not . crHasAmmo
|
||||
, \_ _ -> StrategyActions Reload reloadActions
|
||||
)
|
||||
, (not . crSafeDistFromTarg 150
|
||||
, \_ cr -> StrategyActions Flee
|
||||
[(not . crSafeDistFromTarg 150) `DoActionWhile` UseTarget (fleeFrom cr)
|
||||
`DoActionThen` DoImpulses [ChangeStrategy WatchAndWait] ]
|
||||
)
|
||||
, (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
|
||||
[ drawwp `DoActionThen` shootFirstMiss' `DoActionThen` DoImpulses [ChangeStrategy WatchAndWait] ]
|
||||
)
|
||||
]
|
||||
, basicPerceptionUpdate [0]
|
||||
, doStrategyActions
|
||||
, reloadOverride
|
||||
, targetYouWhenCognizant
|
||||
, overrideInternal (onBoth (&&) crHasTarget (crStratConMatches (GetTo (0,0))))
|
||||
$ \ _ -> crActionPlan . crStrategy .~ WatchAndWait
|
||||
]
|
||||
, _crActionPlan = ActionPlan
|
||||
{ _crImpulse = []
|
||||
, _crAction = []
|
||||
@@ -163,6 +132,13 @@ multGunCrit = defaultCreature
|
||||
, _crGoal = []
|
||||
}
|
||||
}
|
||||
where
|
||||
drawwp = DoActionIfElse NoAction crIsAiming (DoActionThen drawWeapon (WaitThen 50 NoAction))
|
||||
reloadActions =
|
||||
[ holsterWeapon
|
||||
, WaitThen 1 $ DoActionWhileInterrupt NoAction crIsReloading (DoImpulses [ChangeStrategy WatchAndWait])
|
||||
]
|
||||
|
||||
addArmour :: Creature -> Creature
|
||||
addArmour = over crInv insarmour
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user