{-# LANGUAGE LambdaCase #-} module Dodge.Creature.Vocalization ( crWarningSounds, crDeathSounds, resetCrVocCoolDown, ) where import Dodge.Material.Sound import Control.Lens import Dodge.Data.World import Dodge.SoundLogic.ExternallyGeneratedSounds import Sound.Data import System.Random crWarningSounds :: Creature -> [SoundID] crWarningSounds cr = case cr ^. crType of Avatar{} -> mempty ChaseCrit{} -> [ seagullBarkS , seagullChatterS , seagullChatter1S , seagullWhistleS , seagullWhistle1S , seagullCryS , seagullCry1S , seagullCry2S ] SlinkCrit{} -> mempty SlimeCrit{} -> mempty CrabCrit {} -> mempty HoverCrit {} -> mempty SwarmCrit -> mempty AutoCrit -> mempty BarrelCrit{} -> mempty LampCrit{} -> mempty BeeCrit{} -> mempty HiveCrit{} -> mempty crDeathSounds :: Creature -> DeathType -> [SoundID] crDeathSounds cr dt = case cr ^. crType of Avatar{} -> mempty ChaseCrit{} -> defaultDeathSounds dt CrabCrit{} -> defaultDeathSounds dt HoverCrit{} -> hoverDeathSounds dt SlinkCrit{} -> defaultDeathSounds dt SlimeCrit{} -> defaultDeathSounds dt SwarmCrit -> mempty AutoCrit -> mempty BarrelCrit{} -> mempty LampCrit{} -> mempty BeeCrit{} -> defaultDeathSounds dt HiveCrit{} -> defaultDeathSounds dt defaultDeathSounds :: DeathType -> [SoundID] defaultDeathSounds = \case CookDeath -> mempty PoisonDeath -> mempty PlainDeath -> mempty GibsDeath -> [gut1S, gut2S, gut3S, gut4S, gut5S, gut6S] hoverDeathSounds :: DeathType -> [SoundID] hoverDeathSounds = \case CookDeath -> mempty PoisonDeath -> mempty PlainDeath -> [clangS] GibsDeath -> destroyMatS Electronics 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))