100 lines
2.5 KiB
Haskell
100 lines
2.5 KiB
Haskell
{-# LANGUAGE ScopedTypeVariables #-}
|
|
{-# LANGUAGE StrictData #-}
|
|
{-# LANGUAGE TemplateHaskell #-}
|
|
|
|
module Dodge.Data.Creature (
|
|
module Dodge.Data.Creature,
|
|
module Dodge.Data.Creature.Misc,
|
|
module Dodge.Data.Creature.State,
|
|
module Dodge.Data.Creature.Perception,
|
|
module Dodge.Data.Creature.Stance,
|
|
module Dodge.Data.ActionPlan,
|
|
module Dodge.Data.Item,
|
|
module Dodge.Data.Material,
|
|
module Dodge.Data.Item.Use.Consumption.LoadAction,
|
|
) where
|
|
|
|
import ShapePicture.Data
|
|
import NewInt
|
|
import Dodge.Data.Item.Use.Consumption.LoadAction
|
|
import Dodge.Data.Equipment.Misc
|
|
import Control.Lens
|
|
import Data.Aeson
|
|
import Data.Aeson.TH
|
|
import qualified Data.Map.Strict as M
|
|
import qualified Data.IntMap.Strict as IM
|
|
import Dodge.Data.ActionPlan
|
|
import Dodge.Data.Creature.Misc
|
|
import Dodge.Data.Creature.Perception
|
|
import Dodge.Data.Creature.Stance
|
|
import Dodge.Data.Creature.State
|
|
import Dodge.Data.Item
|
|
import Dodge.Data.Material
|
|
import Geometry.Data
|
|
|
|
data Creature = Creature
|
|
{ _crPos :: Point3
|
|
, _crOldPos :: Point3
|
|
, _crOldOldPos :: Point3
|
|
, _crDir :: Float
|
|
, _crMvDir :: Float
|
|
, _crType :: CreatureType
|
|
, _crID :: Int
|
|
, _crHP :: CrHP
|
|
, _crInv :: NewIntMap InvInt Int
|
|
, _crManipulation :: Manipulation
|
|
, _crEquipment :: M.Map EquipSite (NewInt ItmInt)
|
|
, _crDamage :: [Damage]
|
|
, _crPain :: Int
|
|
, _crStance :: Stance
|
|
, _crActionPlan :: ActionPlan
|
|
, _crPerception :: Perception
|
|
, _crMemory :: Memory
|
|
, _crVocalization :: Vocalization
|
|
, _crFaction :: Faction
|
|
, _crGroup :: CrGroup
|
|
, _crIntention :: Intention
|
|
, _crName :: String
|
|
, _crDeathTimer :: Maybe Int
|
|
, _crWallTouch :: IM.IntMap Point2
|
|
}
|
|
|
|
-- Prisms, not lenses
|
|
data CrHP
|
|
= HP Int
|
|
| CrIsCorpse SPic
|
|
| CrDestroyed CrDestructionType
|
|
|
|
data CrDestructionType = Gibbed | Pitted | Swallowed
|
|
|
|
data DeathType = CookDeath | PoisonDeath | PlainDeath | GibsDeath
|
|
|
|
data Intention = Intention
|
|
{ _targetCr :: Maybe Int
|
|
, _mvToPoint :: Maybe Point2
|
|
, _viewPoint :: Maybe Point2
|
|
}
|
|
deriving (Show)
|
|
|
|
data Memory = Memory
|
|
{ _soundsToInvestigate :: [Point2]
|
|
, _nodesSearched :: [Int]
|
|
}
|
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
|
|
makeLenses ''Memory
|
|
|
|
makeLenses ''Creature
|
|
makeLenses ''Intention
|
|
makePrisms ''CrHP
|
|
|
|
deriveJSON defaultOptions ''Memory
|
|
concat
|
|
<$> mapM
|
|
(deriveJSON defaultOptions)
|
|
[ ''Creature
|
|
, ''Intention
|
|
, ''CrHP
|
|
, ''CrDestructionType
|
|
]
|