Add new chase crit sounds
This commit is contained in:
@@ -64,6 +64,7 @@ basicAwarenessUpdate cr = case _crAttentionDir $ _crPerception cr of
|
||||
Nothing -> id
|
||||
| otherwise = id
|
||||
|
||||
-- TODO fold in randgen update, requires that this is a world to world function
|
||||
chaseCritAwarenessUpdate :: World -> Creature -> Creature
|
||||
chaseCritAwarenessUpdate w cr = case _crAttentionDir $ _crPerception cr of
|
||||
Fixated i -> cr & crPerception . crAwarenessLevel
|
||||
@@ -76,23 +77,19 @@ chaseCritAwarenessUpdate w cr = case _crAttentionDir $ _crPerception cr of
|
||||
oldAwareness = _crAwarenessLevel $ _crPerception cr
|
||||
newAwareness = (IM.mapMaybe decreaseAwareness . IM.unionWith combineAwareness is) oldAwareness
|
||||
becomesCognizant = any isCognizant $ IM.unionWith cogRaised oldAwareness newAwareness
|
||||
randBool = takeOne [False,True] & evalState $ _randGen w
|
||||
--randBool = takeOne [False,True] & evalState $ _randGen w
|
||||
thejitter = do
|
||||
p <- randInCirc 2
|
||||
return $ Move p
|
||||
maybeBark
|
||||
| becomesCognizant && randBool = case vocalizationTest cr of
|
||||
Just soundid -> crActionPlan . crStrategy .~ StrategyActions WarningCry
|
||||
[ImpulsesList ([Bark soundid]: replicate 20 [RandomImpulse thejitter]++
|
||||
[[ChangeStrategy $ CloseToMelee 0] ])
|
||||
, AimAt 0 (_crPos $ _creatures w IM.! 0)
|
||||
]
|
||||
--[ImpulsesList [Bark soundid: replicate 20 (RandomImpulse thejitter)]
|
||||
-- `DoActionThen` 20
|
||||
-- `WaitThen` DoImpulses [ChangeStrategy $ CloseToMelee 0]
|
||||
--, AimAt 0 (_crPos $ _creatures w IM.! 0)
|
||||
--]
|
||||
Nothing -> id
|
||||
maybeBark
|
||||
| becomesCognizant -- && randBool
|
||||
&& cr ^? crVocalization . vcCoolDown == Just 0
|
||||
= let soundid = evalState (takeOne (_vcWarnings (_crVocalization cr))) (_randGen w)
|
||||
in crActionPlan . crStrategy .~ StrategyActions WarningCry
|
||||
[ImpulsesList ([Bark soundid]: replicate 20 [RandomImpulse thejitter]++
|
||||
[[ChangeStrategy $ CloseToMelee 0] ])
|
||||
, AimAt 0 (_crPos $ _creatures w IM.! 0)
|
||||
]
|
||||
| otherwise = id
|
||||
|
||||
cogRaised :: AwarenessLevel -> AwarenessLevel -> AwarenessLevel
|
||||
|
||||
Reference in New Issue
Block a user