78 lines
1.7 KiB
Haskell
78 lines
1.7 KiB
Haskell
{-# LANGUAGE StrictData #-}
|
|
{-# LANGUAGE TemplateHaskell #-}
|
|
|
|
module Dodge.Data.Creature.Perception (
|
|
Perception (..),
|
|
Vigilance (..),
|
|
Attention (..),
|
|
Awareness (..),
|
|
Vision (..),
|
|
Audition (..),
|
|
-- lenses
|
|
getAttentiveTo,
|
|
getFixated,
|
|
cpAttention,
|
|
cpVigilance,
|
|
cpAwareness,
|
|
cpVision,
|
|
cpAudition,
|
|
viFOV,
|
|
viDist,
|
|
auDist,
|
|
) where
|
|
|
|
import Control.Lens
|
|
import Data.Aeson
|
|
import Data.Aeson.TH
|
|
import Dodge.Data.FloatFunction
|
|
import qualified IntMapHelp as IM
|
|
|
|
data Perception = Perception
|
|
{ _cpVigilance :: Vigilance
|
|
, _cpAttention :: Attention
|
|
, _cpAwareness :: IM.IntMap Awareness
|
|
, _cpVision :: Vision
|
|
, _cpAudition :: Audition
|
|
}
|
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
|
|
data Vision = Eyes
|
|
{ _viFOV :: FloatFloat
|
|
, _viDist :: FloatFloat
|
|
}
|
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
|
|
newtype Audition = Ears
|
|
{ _auDist :: FloatFloat
|
|
}
|
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
|
|
data Vigilance
|
|
= Comatose
|
|
| Asleep
|
|
| Lethargic
|
|
| Vigilant
|
|
| Overstrung
|
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
|
|
data Attention
|
|
= AttentiveTo {_getAttentiveTo :: IM.IntMap Awareness}
|
|
| Fixated {_getFixated :: Int}
|
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
|
|
data Awareness
|
|
= Suspicious Float
|
|
| Cognizant Float
|
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
|
|
makeLenses ''Perception
|
|
makeLenses ''Vision
|
|
makeLenses ''Audition
|
|
makeLenses ''Attention
|
|
deriveJSON defaultOptions ''Vision
|
|
deriveJSON defaultOptions ''Audition
|
|
deriveJSON defaultOptions ''Vigilance
|
|
deriveJSON defaultOptions ''Awareness
|
|
deriveJSON defaultOptions ''Attention
|
|
deriveJSON defaultOptions ''Perception
|