Tweak chaseCrit melee striking
This commit is contained in:
@@ -36,9 +36,13 @@ overrideMeleeCloseTarget cr = maybe cr (tryMeleeAttack cr) (_targetCr $ _crInten
|
||||
tryMeleeAttack :: Creature -> Creature -> Creature
|
||||
tryMeleeAttack cr tcr
|
||||
| _crMeleeCooldown cr == 0
|
||||
&& Just (_crID tcr) == cr ^? crActionPlan . apStrategy . meleeTarget
|
||||
&& dist tpos cpos < _crRad cr + _crRad tcr + 5
|
||||
&& abs (_crDir cr - argV (tpos -.- cpos)) < pi / 4 =
|
||||
cr & crActionPlan . apImpulse .~ [Melee $ _crID tcr]
|
||||
& crActionPlan . apAction .~ [DoReplicate 10 NoAction `DoActionThen` DoImpulses
|
||||
[ChangeStrategy (CloseToMelee $ _crID tcr)] ]
|
||||
& crActionPlan . apStrategy .~ MeleeStrike
|
||||
| otherwise = cr
|
||||
where
|
||||
cpos = _crPos cr
|
||||
@@ -109,6 +113,7 @@ chaseCritMv :: World -> Creature -> Creature
|
||||
chaseCritMv w cr = case _apStrategy (_crActionPlan cr) of
|
||||
StrategyActions _ _ -> cr
|
||||
WarningCry -> cr
|
||||
MeleeStrike -> cr
|
||||
_ -> case cr ^? crIntention . mvToPoint . _Just of
|
||||
Just p
|
||||
| dist (_crPos cr) p > _crRad cr -> cr & crActionPlan . apAction .~ [PathTo p]
|
||||
@@ -136,7 +141,9 @@ viewTarget w cr = case cr ^? crIntention . viewPoint . _Just of
|
||||
-- ( TurnToPoint p
|
||||
-- )
|
||||
& crIntention . viewPoint .~ Nothing
|
||||
& crActionPlan . apStrategy .~ Investigate
|
||||
| otherwise -> cr & crActionPlan . apAction %~ replaceNullWith (PathTo p)
|
||||
& crActionPlan . apStrategy .~ Investigate
|
||||
Nothing -> cr
|
||||
|
||||
replaceNullWith :: a -> [a] -> [a]
|
||||
|
||||
Reference in New Issue
Block a user