game/src/Item.hs

42 lines
841 B
Haskell

{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedLists #-}
module Item (
Item(..)
, Group(..)
, Key
, Type(..)
, dex
) where
import Data.Aeson (ToJSON(..), FromJSON(..), genericToEncoding, defaultOptions)
import Data.Vector (Vector)
import GHC.Generics (Generic)
import Pokemon (Pokemon)
data Type = Hold | Transform (Pokemon -> Pokemon) | Special
data Item = Item {
name :: String
, skin :: FilePath
, type_ :: Type
, inBattle :: Bool
}
newtype Key = Key Int deriving (Generic)
instance ToJSON Key where
toEncoding = genericToEncoding defaultOptions
instance FromJSON Key
data Group = Group {
item :: Key
, count :: Int
} deriving (Generic)
instance ToJSON Group where
toEncoding = genericToEncoding defaultOptions
instance FromJSON Group
dex :: Vector Item
dex = []