Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
81 lines (56 sloc) 1.8 KB
{-# LANGUAGE TypeOperators #-}
module Utils where
import Types
import Data.Label.Pure
import Data.Monoid
import Data.Set (Set)
import qualified Data.Set as Set
object :: Timestamp -> Ref Player -> Zone -> Object
object ts rOwner zone = Object
{ _name = Nothing
, _colors = mempty
, _types = mempty
, _zone = zone
, _owner = rOwner
, _controller = rOwner
, _timestamp = ts
, _counters = mempty
, _tapStatus = Nothing
, _power = Nothing
, _toughness = Nothing
, _damage = Nothing
, _play = Nothing
, _staticKeywordAbilities = []
, _continuousEffects = []
, _activatedAbilities = []
, _triggeredAbilities = []
, _replacementEffects = []
}
basicType :: ObjectTypes
basicType = mempty { _supertypes = Set.singleton Basic }
legendaryType :: ObjectTypes
legendaryType = mempty { _supertypes = Set.singleton Legendary }
artifactType :: ObjectTypes
artifactType = mempty { _artifactTypes = Just mempty }
enchantmentType :: ObjectTypes
enchantmentType = mempty { _enchantmentTypes = Just mempty }
instantType :: ObjectTypes
instantType = mempty { _instantTypes = Just mempty }
landType :: ObjectTypes
landType = mempty { _landTypes = Just mempty }
sorceryType :: ObjectTypes
sorceryType = mempty { _sorceryTypes = Just mempty }
class ObjectType a where
objectTypeLabel :: ObjectTypes :-> Maybe (Set a)
instance ObjectType ArtifactType where
objectTypeLabel = artifactTypes
instance ObjectType CreatureType where
objectTypeLabel = creatureTypes
instance ObjectType EnchantmentType where
objectTypeLabel = enchantmentTypes
instance ObjectType LandType where
objectTypeLabel = landTypes
instance ObjectType PlaneswalkerType where
objectTypeLabel = planeswalkerTypes
objectType :: ObjectType a => a -> ObjectTypes
objectType ty = set objectTypeLabel (Just (Set.singleton ty)) mempty
Something went wrong with that request. Please try again.