This commit is contained in:
2021-12-09 22:37:14 +00:00
parent 3c35a04531
commit e84b4a29e8
10 changed files with 154 additions and 43 deletions
+19 -11
View File
@@ -41,13 +41,21 @@ sentinelAI = sentinelExtraWatchUpdate
tcid cr = _crID <$> _targetCr (_crIntention cr)
lostest (w,cr) = maybe False (\cid -> canSee (_crID cr) cid w) (tcid cr)
chainCreatureUpdates :: [World -> Creature -> Creature] -> World -> Creature -> Creature
chainCreatureUpdates ls w cr = foldr (\f -> f w) cr ls
--chainCreatureUpdates :: [World -> Creature -> Creature] -> World -> Creature -> Creature
--chainCreatureUpdates ls w cr = foldr (\f -> f w) cr ls
chainCreatureUpdatesLR
:: [Either (World -> Creature -> Creature) (Creature -> Creature)]
-> World -> Creature -> Creature
chainCreatureUpdatesLR ls w cr = foldr unf cr ls
where
unf (Left g) = g w
unf (Right g) = g
sentinelFireType :: (Int -> Action) -> World -> Creature -> Creature
sentinelFireType f = chainCreatureUpdates
[ performActions
, watchUpdateStrat
sentinelFireType f = chainCreatureUpdatesLR
[ Left performActions
, Left $ watchUpdateStrat
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
[ drawwp `DoActionThen` f 0 `DoActionThen` DoImpulses [ChangeStrategy WatchAndWait]
, aiming
@@ -55,13 +63,13 @@ sentinelFireType f = chainCreatureUpdates
)
, (crAwayFromPost, goToPostStrat)
]
, perceptionUpdate' [0]
, doStrategyActions
, reloadOverride
, targetYouWhenCognizant
, overrideInternal
, Left $ perceptionUpdate' [0]
, Right doStrategyActions
, Right reloadOverride
, Left targetYouWhenCognizant
, Right $ overrideInternal
(\cr -> crHasTarget' cr && crStratConMatches' (GetTo (V2 0 0)) cr)
((crActionPlan . crStrategy .~ WatchAndWait))
(crActionPlan . crStrategy .~ WatchAndWait)
]
where
drawwp = DoActionIfElse NoAction crIsAiming (DoActionThen drawWeapon (WaitThen 50 NoAction))