Improve chase crit responsiveness

This commit is contained in:
2022-05-20 23:49:47 +01:00
parent 6ea8e5fa98
commit 84fc37a5a6
3 changed files with 11 additions and 0 deletions
+9
View File
@@ -7,6 +7,7 @@ module Dodge.Creature.ReaderUpdate
, watchUpdateStrat
, reloadOverride
, overrideInternal
, turnIfDamaged
, goToTarget
, flockACC
, chaseCritMv
@@ -162,3 +163,11 @@ targetYouWhenCognizant w cr = case cr ^? crPerception . crAwarenessLevel . ix 0
-- consider changing targeted creature to be just an index
Just (Cognizant _) -> _creatures w IM.! 0 `seq` cr & crIntention . targetCr ?~ _creatures w IM.! 0
_ -> cr & crIntention . targetCr .~ Nothing
turnIfDamaged :: Creature -> Creature
turnIfDamaged cr
| _crPastDamage cr > 0 = case _crStrategy (_crActionPlan cr) of
WatchAndWait -> cr & crPerception . crAwakeLevel .~ Vigilant
& crActionPlan . crStrategy .~ StrategyActions LookAround [TurnToA (_crPos cr -.- unitVectorAtAngle (_crDir cr))]
_ -> cr
| otherwise = cr