Remove Reader from launcherCrit
This commit is contained in:
@@ -27,7 +27,7 @@ armourChaseCrit = defaultCreature
|
||||
, Left $ setTargetMv (\_ -> _targetCr . _crIntention)
|
||||
, Left flockACC
|
||||
, Left $ perceptionUpdate' [0]
|
||||
, Left goToTarget'
|
||||
, Left goToTarget
|
||||
, Right overrideMeleeCloseTarget
|
||||
, Right (crMeleeCooldown %~ max 0 . subtract 1)
|
||||
]
|
||||
|
||||
@@ -37,9 +37,9 @@ chaseCrit = defaultCreature
|
||||
[ Right doStrategyActions
|
||||
, Left performActions
|
||||
, Right overrideMeleeCloseTarget
|
||||
, Right setViewPos'
|
||||
, Right setMvPos'
|
||||
, Left goToTarget'
|
||||
, Right setViewPos
|
||||
, Right setMvPos
|
||||
, Left goToTarget
|
||||
, Left $ perceptionUpdate' [0]
|
||||
, Left targetYouWhenCognizant
|
||||
, Right (crMeleeCooldown %~ max 0 . subtract 1)
|
||||
|
||||
@@ -5,6 +5,7 @@ module Dodge.Creature.LauncherCrit
|
||||
import Dodge.Data
|
||||
import Dodge.Default
|
||||
import Dodge.Creature.Picture
|
||||
import Dodge.Creature.ChainUpdates
|
||||
import Dodge.Creature.Test
|
||||
import Dodge.Creature.Volition
|
||||
import Dodge.Creature.Strategy
|
||||
@@ -19,24 +20,24 @@ import Picture
|
||||
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import Control.Lens
|
||||
import Control.Monad.Reader
|
||||
|
||||
launcherCrit :: Creature
|
||||
launcherCrit = defaultCreature
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate $ impulsiveAIR $
|
||||
performActionsR
|
||||
>=> watchUpdateStratR
|
||||
, _crUpdate = stateUpdate' $ impulsiveAI $ chainCreatureUpdatesLR
|
||||
[ Left performActions
|
||||
, Left $ watchUpdateStrat
|
||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0) [retreatFire])
|
||||
, (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 = []
|
||||
|
||||
@@ -14,13 +14,10 @@ module Dodge.Creature.ReaderUpdate
|
||||
, overrideInternalRRR
|
||||
, overrideInternal
|
||||
, goToTarget
|
||||
, goToTarget'
|
||||
, flockACCR
|
||||
, flockACC
|
||||
, setMvPos
|
||||
, setMvPos'
|
||||
, setViewPos
|
||||
, setViewPos'
|
||||
)
|
||||
where
|
||||
import Dodge.Data
|
||||
@@ -56,29 +53,16 @@ tryMeleeAttack cr tcr
|
||||
where
|
||||
cpos = _crPos cr
|
||||
|
||||
setMvPos :: Creature -> Reader World Creature
|
||||
setMvPos cr = pure $ cr & crIntention . mvToPoint .~ mpos
|
||||
where
|
||||
int = _crIntention cr
|
||||
mpos = (_crPos <$> _targetCr int)
|
||||
<|> _mvToPoint int
|
||||
-- <|> listToMaybe (_soundsToInvestigate $ _crMemory cr)
|
||||
--
|
||||
setMvPos' :: Creature -> Creature
|
||||
setMvPos' cr = cr & crIntention . mvToPoint .~ mpos
|
||||
setMvPos :: Creature -> Creature
|
||||
setMvPos cr = cr & crIntention . mvToPoint .~ mpos
|
||||
where
|
||||
int = _crIntention cr
|
||||
mpos = (_crPos <$> _targetCr int)
|
||||
<|> _mvToPoint int
|
||||
-- <|> listToMaybe (_soundsToInvestigate $ _crMemory cr)
|
||||
|
||||
setViewPos :: Creature -> Reader World Creature
|
||||
setViewPos cr = pure $ cr & crIntention . viewPoint %~ (<|> mpos)
|
||||
where
|
||||
mpos = listToMaybe (_soundsToInvestigate $ _crMemory cr)
|
||||
|
||||
setViewPos' :: Creature -> Creature
|
||||
setViewPos' cr = cr & crIntention . viewPoint %~ (<|> mpos)
|
||||
setViewPos :: Creature -> Creature
|
||||
setViewPos cr = cr & crIntention . viewPoint %~ (<|> mpos)
|
||||
where
|
||||
mpos = listToMaybe (_soundsToInvestigate $ _crMemory cr)
|
||||
|
||||
@@ -134,20 +118,14 @@ flockACC w cr = case cr ^? crIntention . targetCr . _Just of
|
||||
else negate r *.* horDir
|
||||
in cr & crIntention . mvToPoint ?~ tpos +.+ horShift
|
||||
|
||||
goToTarget :: Creature -> Reader World Creature
|
||||
goToTarget cr = do
|
||||
case cr ^? crIntention . mvToPoint . _Just of
|
||||
Just p -> pure $ cr & crActionPlan . crAction .~ [PathTo p]
|
||||
_ -> viewTarget cr
|
||||
|
||||
goToTarget' :: World -> Creature -> Creature
|
||||
goToTarget' w cr =
|
||||
goToTarget :: World -> Creature -> Creature
|
||||
goToTarget w cr =
|
||||
case cr ^? crIntention . mvToPoint . _Just of
|
||||
Just p -> cr & crActionPlan . crAction .~ [PathTo p]
|
||||
_ -> viewTarget' w cr
|
||||
_ -> viewTarget w cr
|
||||
|
||||
viewTarget' :: World -> Creature -> Creature
|
||||
viewTarget' w cr = do
|
||||
viewTarget :: World -> Creature -> Creature
|
||||
viewTarget w cr = do
|
||||
case cr ^? crIntention . viewPoint . _Just of
|
||||
Just p | hasLOSIndirect p (_crPos cr) w -> cr'
|
||||
& crActionPlan . crAction %~ replaceNullWith (TurnToA p)
|
||||
@@ -157,18 +135,6 @@ viewTarget' w cr = do
|
||||
where
|
||||
cr' = cr & crPerception . crAwakeLevel .~ Vigilant
|
||||
|
||||
viewTarget :: Creature -> Reader World Creature
|
||||
viewTarget cr = do
|
||||
w <- ask
|
||||
case cr ^? crIntention . viewPoint . _Just of
|
||||
Just p | hasLOSIndirect p (_crPos cr) w -> pure $ cr'
|
||||
& crActionPlan . crAction %~ replaceNullWith (TurnToA p)
|
||||
& crIntention . viewPoint .~ Nothing
|
||||
| otherwise -> pure $ cr' & crActionPlan . crAction %~ replaceNullWith (PathTo p)
|
||||
Nothing -> pure $ cr & crPerception . crAwakeLevel .~ Lethargic
|
||||
where
|
||||
cr' = cr & crPerception . crAwakeLevel .~ Vigilant
|
||||
|
||||
replaceNullWith :: a -> [a] -> [a]
|
||||
replaceNullWith x [] = [x]
|
||||
replaceNullWith _ xs = xs
|
||||
|
||||
Reference in New Issue
Block a user