Start moving creature properties out of records
This commit is contained in:
+145
-144
@@ -11,8 +11,8 @@ import RandomHelp
|
||||
|
||||
|
||||
updateHumanoid :: Creature -> World -> World
|
||||
updateHumanoid cr = case cr ^?! crType . humanoidAI of
|
||||
ChaseAI ->
|
||||
updateHumanoid cr = case cr ^?! crType of
|
||||
ChaseCrit ->
|
||||
humanoidAIList
|
||||
[ const doStrategyActions
|
||||
, performActions
|
||||
@@ -27,151 +27,152 @@ updateHumanoid cr = case cr ^?! crType . humanoidAI of
|
||||
, const (crVocalization . vcCoolDown %~ max 0 . subtract 1)
|
||||
]
|
||||
cr
|
||||
SpreadGunAI ->
|
||||
defaultImpulsive
|
||||
[ performActions
|
||||
, watchUpdateStrat
|
||||
[
|
||||
( crHasTargetLOS
|
||||
, \_ _ ->
|
||||
StrategyActions
|
||||
(ShootAt 0)
|
||||
[ DoActionIf (WdCrNegate $ WdCrBlfromCrBl CrIsAiming) drawWeapon
|
||||
, DoActionThen
|
||||
(DoActionWhile WdCrLOSTarget $ ArbitraryAction ChooseMovementSpreadGun)
|
||||
(DoImpulses [ChangeStrategy WatchAndWait])
|
||||
]
|
||||
)
|
||||
, (const crAwayFromPost, const goToPostStrat)
|
||||
]
|
||||
, perceptionUpdate [0]
|
||||
, const doStrategyActions
|
||||
, targetYouWhenCognizant
|
||||
, const $
|
||||
overrideInternal
|
||||
(\cr' -> crHasTarget cr' && crStratConMatches (GetTo (V2 0 0)) cr')
|
||||
(\cr' -> cr' & crActionPlan . apStrategy .~ WatchAndWait)
|
||||
]
|
||||
cr
|
||||
PistolAI ->
|
||||
defaultImpulsive
|
||||
[ performActions
|
||||
, watchUpdateStrat
|
||||
[
|
||||
( crHasTargetLOS
|
||||
, \w cr' ->
|
||||
StrategyActions
|
||||
(ShootAt 0)
|
||||
[DoActionIf (WdCrNegate $ WdCrBlfromCrBl CrIsAiming) drawWeapon, chooseMovementPistol cr' w]
|
||||
)
|
||||
, (const crAwayFromPost, const goToPostStrat)
|
||||
]
|
||||
, perceptionUpdate [0]
|
||||
, const doStrategyActions
|
||||
, targetYouWhenCognizant
|
||||
, const $
|
||||
overrideInternal
|
||||
(\cr' -> crHasTarget cr' && crStratConMatches (GetTo (V2 0 0)) cr')
|
||||
(crActionPlan . apStrategy .~ WatchAndWait)
|
||||
]
|
||||
cr
|
||||
LtAutoAI ->
|
||||
defaultImpulsive
|
||||
[ performActions
|
||||
, watchUpdateStrat
|
||||
[
|
||||
( crHasTargetLOS
|
||||
, \_ _ ->
|
||||
StrategyActions
|
||||
(ShootAt 0)
|
||||
[ DoActionIf (WdCrNegate $ WdCrBlfromCrBl CrIsAiming) drawWeapon
|
||||
, DoActionThen
|
||||
(DoActionWhile WdCrLOSTarget $ ArbitraryAction ChooseMovementLtAuto)
|
||||
(DoImpulses [ChangeStrategy WatchAndWait])
|
||||
]
|
||||
)
|
||||
, (const crAwayFromPost, const goToPostStrat)
|
||||
]
|
||||
, perceptionUpdate [0]
|
||||
, const doStrategyActions
|
||||
, targetYouWhenCognizant
|
||||
, const $
|
||||
overrideInternal
|
||||
(\cr' -> crHasTarget cr' && crStratConMatches (GetTo (V2 0 0)) cr')
|
||||
(crActionPlan . apStrategy .~ WatchAndWait)
|
||||
]
|
||||
cr
|
||||
LauncherAI ->
|
||||
defaultImpulsive
|
||||
[ performActions
|
||||
, watchUpdateStrat
|
||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0) [retreatFireLauncher])
|
||||
, (const crAwayFromPost, const goToPostStrat)
|
||||
]
|
||||
, perceptionUpdate [0]
|
||||
, const doStrategyActions
|
||||
, targetYouWhenCognizant
|
||||
, const $
|
||||
overrideInternal
|
||||
(\cr' -> crHasTarget cr' && crStratConMatches (GetTo (V2 0 0)) cr')
|
||||
(crActionPlan . apStrategy .~ WatchAndWait)
|
||||
]
|
||||
cr
|
||||
SwarmAI ->
|
||||
defaultImpulsive
|
||||
[ flockToPointUsing' (encircleDistP 100) (meleeHeadingMove 0.1 0.1 (pi / 4) 3.9)
|
||||
, const (crMeleeCooldown %~ max 0 . subtract 1)
|
||||
, perceptionUpdate [0]
|
||||
, const doStrategyActions
|
||||
, targetYouWhenCognizant
|
||||
]
|
||||
cr
|
||||
AutoAI -> defaultImpulsive [sentinelAI] cr
|
||||
FlockArmourChaseAI ->
|
||||
defaultImpulsive
|
||||
[ watchUpdateStrat []
|
||||
, const doStrategyActions
|
||||
, performActions
|
||||
, targetYouWhenCognizant
|
||||
, setTargetMv (\_ -> _targetCr . _crIntention)
|
||||
, flockACC
|
||||
, perceptionUpdate [0]
|
||||
, goToTarget
|
||||
, const overrideMeleeCloseTarget
|
||||
, const (crMeleeCooldown %~ max 0 . subtract 1)
|
||||
]
|
||||
cr
|
||||
MiniGunAI -> defaultImpulsive [sentinelFireType (const shootTillEmpty)] cr
|
||||
LongAI -> defaultImpulsive [sentinelFireType $ const shootTillEmpty] cr
|
||||
MultGunAI ->
|
||||
defaultImpulsive
|
||||
[ sentinelExtraWatchUpdate
|
||||
[
|
||||
-- ( const $ not . crWeaponReady
|
||||
-- , \_ _ -> StrategyActions Reload reloadActions
|
||||
_ -> id
|
||||
-- SpreadGunAI ->
|
||||
-- defaultImpulsive
|
||||
-- [ performActions
|
||||
-- , watchUpdateStrat
|
||||
-- [
|
||||
-- ( crHasTargetLOS
|
||||
-- , \_ _ ->
|
||||
-- StrategyActions
|
||||
-- (ShootAt 0)
|
||||
-- [ DoActionIf (WdCrNegate $ WdCrBlfromCrBl CrIsAiming) drawWeapon
|
||||
-- , DoActionThen
|
||||
-- (DoActionWhile WdCrLOSTarget $ ArbitraryAction ChooseMovementSpreadGun)
|
||||
-- (DoImpulses [ChangeStrategy WatchAndWait])
|
||||
-- ]
|
||||
-- )
|
||||
-- , (const crAwayFromPost, const goToPostStrat)
|
||||
-- ]
|
||||
-- , perceptionUpdate [0]
|
||||
-- , const doStrategyActions
|
||||
-- , targetYouWhenCognizant
|
||||
-- , const $
|
||||
-- overrideInternal
|
||||
-- (\cr' -> crHasTarget cr' && crStratConMatches (GetTo (V2 0 0)) cr')
|
||||
-- (\cr' -> cr' & crActionPlan . apStrategy .~ WatchAndWait)
|
||||
-- ]
|
||||
-- cr
|
||||
-- PistolAI ->
|
||||
-- defaultImpulsive
|
||||
-- [ performActions
|
||||
-- , watchUpdateStrat
|
||||
-- [
|
||||
-- ( crHasTargetLOS
|
||||
-- , \w cr' ->
|
||||
-- StrategyActions
|
||||
-- (ShootAt 0)
|
||||
-- [DoActionIf (WdCrNegate $ WdCrBlfromCrBl CrIsAiming) drawWeapon, chooseMovementPistol cr' w]
|
||||
-- )
|
||||
-- , (const crAwayFromPost, const goToPostStrat)
|
||||
-- ]
|
||||
-- , perceptionUpdate [0]
|
||||
-- , const doStrategyActions
|
||||
-- , targetYouWhenCognizant
|
||||
-- , const $
|
||||
-- overrideInternal
|
||||
-- (\cr' -> crHasTarget cr' && crStratConMatches (GetTo (V2 0 0)) cr')
|
||||
-- (crActionPlan . apStrategy .~ WatchAndWait)
|
||||
-- ]
|
||||
-- cr
|
||||
-- LtAutoAI ->
|
||||
-- defaultImpulsive
|
||||
-- [ performActions
|
||||
-- , watchUpdateStrat
|
||||
-- [
|
||||
-- ( crHasTargetLOS
|
||||
-- , \_ _ ->
|
||||
-- StrategyActions
|
||||
-- (ShootAt 0)
|
||||
-- [ DoActionIf (WdCrNegate $ WdCrBlfromCrBl CrIsAiming) drawWeapon
|
||||
-- , DoActionThen
|
||||
-- (DoActionWhile WdCrLOSTarget $ ArbitraryAction ChooseMovementLtAuto)
|
||||
-- (DoImpulses [ChangeStrategy WatchAndWait])
|
||||
-- ]
|
||||
-- )
|
||||
-- , (const crAwayFromPost, const goToPostStrat)
|
||||
-- ]
|
||||
-- , perceptionUpdate [0]
|
||||
-- , const doStrategyActions
|
||||
-- , targetYouWhenCognizant
|
||||
-- , const $
|
||||
-- overrideInternal
|
||||
-- (\cr' -> crHasTarget cr' && crStratConMatches (GetTo (V2 0 0)) cr')
|
||||
-- (crActionPlan . apStrategy .~ WatchAndWait)
|
||||
-- ]
|
||||
-- cr
|
||||
-- LauncherAI ->
|
||||
-- defaultImpulsive
|
||||
-- [ performActions
|
||||
-- , watchUpdateStrat
|
||||
-- [ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0) [retreatFireLauncher])
|
||||
-- , (const crAwayFromPost, const goToPostStrat)
|
||||
-- ]
|
||||
-- , perceptionUpdate [0]
|
||||
-- , const doStrategyActions
|
||||
-- , targetYouWhenCognizant
|
||||
-- , const $
|
||||
-- overrideInternal
|
||||
-- (\cr' -> crHasTarget cr' && crStratConMatches (GetTo (V2 0 0)) cr')
|
||||
-- (crActionPlan . apStrategy .~ WatchAndWait)
|
||||
-- ]
|
||||
-- cr
|
||||
-- SwarmAI ->
|
||||
-- defaultImpulsive
|
||||
-- [ flockToPointUsing' (encircleDistP 100) (meleeHeadingMove 0.1 0.1 (pi / 4) 3.9)
|
||||
-- , const (crMeleeCooldown %~ max 0 . subtract 1)
|
||||
-- , perceptionUpdate [0]
|
||||
-- , const doStrategyActions
|
||||
-- , targetYouWhenCognizant
|
||||
-- ]
|
||||
-- cr
|
||||
-- AutoAI -> defaultImpulsive [sentinelAI] cr
|
||||
-- FlockArmourChaseAI ->
|
||||
-- defaultImpulsive
|
||||
-- [ watchUpdateStrat []
|
||||
-- , const doStrategyActions
|
||||
-- , performActions
|
||||
-- , targetYouWhenCognizant
|
||||
-- , setTargetMv (\_ -> _targetCr . _crIntention)
|
||||
-- , flockACC
|
||||
-- , perceptionUpdate [0]
|
||||
-- , goToTarget
|
||||
-- , const overrideMeleeCloseTarget
|
||||
-- , const (crMeleeCooldown %~ max 0 . subtract 1)
|
||||
-- ]
|
||||
-- cr
|
||||
-- MiniGunAI -> defaultImpulsive [sentinelFireType (const shootTillEmpty)] cr
|
||||
-- LongAI -> defaultImpulsive [sentinelFireType $ const shootTillEmpty] cr
|
||||
-- MultGunAI ->
|
||||
-- defaultImpulsive
|
||||
-- [ sentinelExtraWatchUpdate
|
||||
-- [
|
||||
---- ( const $ not . crWeaponReady
|
||||
---- , \_ _ -> StrategyActions Reload reloadActions
|
||||
---- )
|
||||
---- ,
|
||||
-- ( const $ not . crSafeDistFromTarg 150
|
||||
-- , \_ _ ->
|
||||
-- StrategyActions
|
||||
-- Flee
|
||||
-- [ WdCrNegate (WdCrSafeDistFromTarget 150) `DoActionWhile` UseSelf CrFleeFromTarget -- (fleeFrom cr')
|
||||
-- `DoActionThen` DoImpulses [ChangeStrategy WatchAndWait]
|
||||
-- ]
|
||||
-- )
|
||||
-- ,
|
||||
( const $ not . crSafeDistFromTarg 150
|
||||
, \_ _ ->
|
||||
StrategyActions
|
||||
Flee
|
||||
[ WdCrNegate (WdCrSafeDistFromTarget 150) `DoActionWhile` UseSelf CrFleeFromTarget -- (fleeFrom cr')
|
||||
`DoActionThen` DoImpulses [ChangeStrategy WatchAndWait]
|
||||
]
|
||||
)
|
||||
,
|
||||
( crHasTargetLOS
|
||||
, \_ _ ->
|
||||
StrategyActions
|
||||
(ShootAt 0)
|
||||
[drawwp `DoActionThen` shootFirstMiss `DoActionThen` DoImpulses [ChangeStrategy WatchAndWait]]
|
||||
)
|
||||
]
|
||||
]
|
||||
cr
|
||||
InanimateAI -> id
|
||||
-- ( crHasTargetLOS
|
||||
-- , \_ _ ->
|
||||
-- StrategyActions
|
||||
-- (ShootAt 0)
|
||||
-- [drawwp `DoActionThen` shootFirstMiss `DoActionThen` DoImpulses [ChangeStrategy WatchAndWait]]
|
||||
-- )
|
||||
-- ]
|
||||
-- ]
|
||||
-- cr
|
||||
-- InanimateAI -> id
|
||||
where
|
||||
drawwp = DoActionIfElse NoAction (WdCrBlfromCrBl CrIsAiming) (DoActionThen drawWeapon (WaitThen 50 NoAction))
|
||||
-- drawwp = DoActionIfElse NoAction (WdCrBlfromCrBl CrIsAiming) (DoActionThen drawWeapon (WaitThen 50 NoAction))
|
||||
-- reloadActions =
|
||||
-- [ holsterWeapon
|
||||
-- --, WaitThen 1 $ DoActionWhileInterrupt NoAction (WdCrBlfromCrBl CrIsReloading) (DoImpulses [ChangeStrategy WatchAndWait])
|
||||
|
||||
Reference in New Issue
Block a user