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
+1
View File
@@ -39,6 +39,7 @@ chaseCrit = defaultCreature
, chaseCritMv
, chaseCritPerceptionUpdate [0]
, targetYouWhenCognizant
, const turnIfDamaged
, const (crMeleeCooldown %~ max 0 . subtract 1)
]
, _crName = "chaseCrit"
+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
+1
View File
@@ -1171,6 +1171,7 @@ data Strategy
| FollowImpulses
| WatchAndWait
| WarningCry
| LookAround
| CloseToMelee Int
| StrategyActions Strategy [Action]
| GetTo Point2