Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: aa18ed1a80
Fetching contributors…

Cannot retrieve contributors at this time

54 lines (44 sloc) 1.579 kB
{-# LANGUAGE OverloadedStrings #-}
module BasicLands where
import Labels
import Predicates
import Types
import Utils
import Control.Applicative
import Data.Label.PureM
import Data.Monoid
import Data.String
plains, island, swamp, mountain, forest :: Card
plains = mkBasicLandCard Plains White
island = mkBasicLandCard Island Blue
swamp = mkBasicLandCard Swamp Black
mountain = mkBasicLandCard Mountain Red
forest = mkBasicLandCard Forest Green
mkBasicLandCard :: LandType -> Color -> Card
mkBasicLandCard ty color = mkCard $ do
name =: Just (fromString (show ty))
types =: basicType <> objectType ty
play =: Just playLand
activatedAbilities =: [tapToAddMana (Just color)]
playLand :: Ability
playLand rSource rActivator = ClosedAbility
{ _available =
case rSource of
(Hand _, _) -> checkObject rSource (isControlledBy rActivator)
_ -> return False
, _manaCost = mempty
, _additionalCosts = []
, _effect = SpecialAction (return [MoveObject rSource Battlefield])
}
tapToAddMana :: Maybe Color -> Ability
tapToAddMana mc rSource rActivator = ClosedAbility
{ _available =
case rSource of
(Battlefield, _) -> checkObject rSource (isControlledBy rActivator)
_ -> return False
, _manaCost = mempty
, _additionalCosts = []
, _effect = SpecialAction (return [AddToManaPool rActivator mc])
}
checkObject :: ObjectRef -> (Object -> Bool) -> View Bool
checkObject (rZone, i) ok = ok <$> asks (compileZoneRef rZone .^ listEl i)
Jump to Line
Something went wrong with that request. Please try again.