Remove Reader from launcherCrit
This commit is contained in:
@@ -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