Add Store instances

This commit is contained in:
2022-08-21 12:21:05 +01:00
parent 1ce7d4a72d
commit dd62e30026
92 changed files with 465 additions and 255 deletions
+7 -5
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Creature.State where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Color
@@ -21,20 +23,17 @@ data CreatureState = CrSt
, _csDropsOnDeath :: CreatureDropType
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CreatureState
data CreatureDropType
= DropAll
| DropAmount Int
| DropSpecific [Int]
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CreatureDropType
data CrSpState
= Barrel {_piercedPoints :: [Point2]}
| GenCr
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CrSpState
data Faction
= GenericFaction Int
@@ -46,7 +45,6 @@ data Faction
| ColorFaction Color
| PlayerFaction
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Faction
data CrGroup
= LoneWolf
@@ -57,7 +55,6 @@ data CrGroup
| CrGroupID {_crGroupID :: Int}
| ShieldGroup
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CrGroup
makeLenses ''CreatureState
makeLenses ''CrSpState
@@ -67,3 +64,8 @@ deriveJSON defaultOptions ''CreatureDropType
deriveJSON defaultOptions ''CrSpState
deriveJSON defaultOptions ''Faction
deriveJSON defaultOptions ''CrGroup
$($(derive [d| instance Deriving (Store CreatureState ) |]))
$($(derive [d| instance Deriving (Store CreatureDropType) |]))
$($(derive [d| instance Deriving (Store CrSpState) |]))
$($(derive [d| instance Deriving (Store Faction) |]))
$($(derive [d| instance Deriving (Store CrGroup) |]))