Remove Reader monad from multiple creature ais

This commit is contained in:
2021-12-11 19:32:20 +00:00
parent 37b81c2967
commit c847955b7c
7 changed files with 78 additions and 131 deletions
+12 -11
View File
@@ -10,7 +10,7 @@ import Dodge.Creature.Action
import Dodge.Creature.Volition
import Dodge.Creature.Strategy
import Dodge.Creature.ReaderUpdate
--import Dodge.Creature.ChooseTarget
import Dodge.Creature.ChainUpdates
import Dodge.Creature.Perception
import Dodge.Creature.State
--import Dodge.Creature.State.Data
@@ -29,20 +29,21 @@ import Control.Monad.State
pistolCrit :: Creature
pistolCrit = defaultCreature
{ _crPict = basicCrPict red
, _crUpdate = stateUpdate $ impulsiveAIR $
performActionsR
>=> watchUpdateStratR
, _crUpdate = stateUpdate' $ impulsiveAI $ chainCreatureUpdatesLR
[Left performActions
,Left $ watchUpdateStrat
[ (crHasTargetLOS, \w cr -> StrategyActions (ShootAt 0)
[DoActionIf (not . crIsAiming) drawWeapon,chooseMovement cr w])
, (crAwayFromPost, goToPostStrat)
]
>=> perceptionUpdate [0]
>=> doStrategyActionsR
>=> reloadOverrideR
>=> targetYouWhenCognizantR
>=> overrideInternalRRR
(\cr -> (&&) <$> crHasTargetR cr <*> crStratConMatchesR (GetTo (V2 0 0)) cr)
(pure . (crActionPlan . crStrategy .~ WatchAndWait))
,Left $ perceptionUpdate' [0]
,Right $ doStrategyActions
,Right $ reloadOverride
,Left $ targetYouWhenCognizant
,Right $ overrideInternal
(\cr -> crHasTarget' cr && crStratConMatches' (GetTo (V2 0 0)) cr)
(crActionPlan . crStrategy .~ WatchAndWait)
]
, _crActionPlan = ActionPlan
{ _crImpulse = []
, _crAction = []