{-# LANGUAGE LambdaCase #-} module Dodge.Creature.Vocalization ( crWarningSounds, crDeathSounds, crVocalizationSound, resetCrVocCoolDown, ) where import Dodge.Material.Sound import Control.Lens import Dodge.Data.World import Dodge.SoundLogic.ExternallyGeneratedSounds import Sound.Data import System.Random crVocalizationSound :: Creature -> Maybe SoundID crVocalizationSound cr = case cr ^. crType of Avatar{} -> Nothing ChaseCrit{} -> Just seagullChatterS HoverCrit{} -> Just beep3QuickS SwarmCrit -> Nothing AutoCrit -> Nothing BarrelCrit{} -> Nothing LampCrit{} -> Nothing crWarningSounds :: Creature -> [SoundID] crWarningSounds cr = case cr ^. crType of Avatar{} -> mempty ChaseCrit{} -> [ seagullBarkS , seagullChatterS , seagullChatter1S , seagullWhistleS , seagullWhistle1S , seagullCryS , seagullCry1S , seagullCry2S ] HoverCrit {} -> mempty SwarmCrit -> mempty AutoCrit -> mempty BarrelCrit{} -> mempty LampCrit{} -> mempty crDeathSounds :: Creature -> DeathType -> [SoundID] crDeathSounds cr dt = case cr ^. crType of Avatar{} -> mempty ChaseCrit{} -> defaultDeathSounds dt HoverCrit{} -> metalDeathSounds dt SwarmCrit -> mempty AutoCrit -> mempty BarrelCrit{} -> mempty LampCrit{} -> mempty defaultDeathSounds :: DeathType -> [SoundID] defaultDeathSounds = \case CookDeath -> mempty PoisonDeath -> mempty PlainDeath -> mempty GibsDeath -> destroyMatS Electronics metalDeathSounds :: DeathType -> [SoundID] metalDeathSounds = \case CookDeath -> mempty PoisonDeath -> mempty PlainDeath -> mempty GibsDeath -> [gut1S, gut2S, gut3S, gut4S, gut5S, gut6S] crVocalResetTime :: Creature -> StdGen -> Int crVocalResetTime _ = fst . randomR (50,100) -- this should update the randgen as well resetCrVocCoolDown :: World -> Creature -> Creature resetCrVocCoolDown w cr = cr & crVocalization .~ VocTimer 0 (crVocalResetTime cr (w ^. randGen))