Add extra warning cries to chaseCrits

This commit is contained in:
2023-05-01 14:01:27 +01:00
parent b34a9f5b09
commit 60e5e6ecae
14 changed files with 39 additions and 24 deletions
+7 -4
View File
@@ -1,15 +1,18 @@
module Dodge.Creature.Vocalization where
import Control.Lens
import Dodge.Data.Creature
import Dodge.Data.World
import Sound.Data
import System.Random
vocalizationTest :: Creature -> Maybe SoundID
vocalizationTest cr = case cr ^? crVocalization . vcCoolDown of
Just 0 -> Just $ _vcSound $ _crVocalization cr
_ -> Nothing
resetCrVocCoolDown :: Creature -> Creature
resetCrVocCoolDown cr = case cr ^? crVocalization . vcMaxCoolDown of
Just i -> cr & crVocalization . vcCoolDown .~ i
resetCrVocCoolDown :: World -> Creature -> Creature
resetCrVocCoolDown w cr = case cr ^? crVocalization . vcMaxCoolDown of
Just (i,j) -> cr & crVocalization . vcCoolDown .~ x
where
x = fst $ randomR (i,j) (_randGen w)
Nothing -> cr