Add extra warning cries to chaseCrits
This commit is contained in:
@@ -14,12 +14,13 @@ module Dodge.Creature.ReaderUpdate (
|
||||
setViewPos,
|
||||
) where
|
||||
|
||||
import RandomHelp
|
||||
import Dodge.Creature.Perception
|
||||
import qualified IntMapHelp as IM
|
||||
import Data.List (sortOn)
|
||||
import Control.Applicative
|
||||
import Control.Lens
|
||||
import Control.Monad
|
||||
import LensHelp
|
||||
--import Control.Monad
|
||||
import Data.Bifunctor
|
||||
import Data.Maybe
|
||||
import Dodge.Base
|
||||
@@ -114,11 +115,22 @@ chaseCritMv w cr = case _apStrategy (_crActionPlan cr) of
|
||||
StrategyActions _ _ -> cr
|
||||
WarningCry -> cr
|
||||
MeleeStrike -> cr
|
||||
CloseToMelee cid | Just 0 == (cr ^? crVocalization . vcCoolDown)
|
||||
-> cr & crActionPlan . apAction
|
||||
.:~ ImpulsesList ( [Bark soundid] : replicate numjits [RandomImpulse thejitter]
|
||||
++ [[ChangeStrategy (CloseToMelee cid)]])
|
||||
& crVocalization . vcCoolDown .~ 10
|
||||
& crActionPlan . apStrategy .~ WarningCry
|
||||
where
|
||||
thejitter = RandImpulseCircMove 3
|
||||
soundid = evalState (takeOne (_vcWarnings (_crVocalization cr))) (_randGen w)
|
||||
numjits = fst $ randomR (15, 25) (_randGen w)
|
||||
_ -> case cr ^? crIntention . mvToPoint . _Just of
|
||||
Just p
|
||||
| dist (_crPos cr) p > _crRad cr -> cr & crActionPlan . apAction .~ [PathTo p]
|
||||
| otherwise ->
|
||||
cr & crActionPlan . apAction .~ [bfsThenReturn 500]
|
||||
cr & crActionPlan . apAction .~ [bfsThenReturn 500 `DoActionThen` DoImpulses [ChangeStrategy WatchAndWait]]
|
||||
& crActionPlan . apStrategy .~ WatchAndWait
|
||||
& crIntention . mvToPoint .~ Nothing
|
||||
_ -> viewTarget w cr
|
||||
|
||||
|
||||
Reference in New Issue
Block a user