Permalink
Browse files

Implemented other basic lands

  • Loading branch information...
1 parent 3be2ed6 commit 120d53fc54beaa5e7c1cbba2d0f6ab02434fcd77 @MedeaMelana committed Aug 31, 2012
Showing with 23 additions and 19 deletions.
  1. +23 −19 BasicLands.hs
View
@@ -5,23 +5,32 @@ module BasicLands where
import Types
import Predicates
+import Control.Applicative
import Data.Boolean
+import Data.Label.PureM
import Data.Monoid
import Data.Set as Set
-import Data.Label.PureM
+import Data.String
-plains :: Card
-plains = Card $ \ts rOwner ->
+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 = Card $ \ts rOwner ->
Object
- { _name = Just "Plains"
+ { _name = Just (fromString (show ty))
, _colors = mempty
, _group = Permanent
{ _supertypes = Set.singleton Basic
, _artifactTypes = Nothing
, _creatureTypes = Nothing
, _enchantmentTypes = Nothing
- , _landTypes = Just (Set.singleton Plains)
+ , _landTypes = Just (Set.singleton ty)
, _planeswalkerTypes = Nothing
}
, _zone = Library
@@ -36,34 +45,29 @@ plains = Card $ \ts rOwner ->
, _toughness = Nothing
, _damage = Nothing
- , _play = defaultPlay
+ , _play = defaultSpecialPlay
, _staticKeywordAbilities = []
, _continuousEffects = []
- , _activatedAbilities = [tapToAddMana (Just White)]
+ , _activatedAbilities = [tapToAddMana (Just color)]
, _triggeredAbilities = []
, _replacementEffects = []
}
-defaultPlay :: Ability
-defaultPlay rSource rActivator = ClosedAbility
- { _available = do
- os <- asks objects
- let source = os ! rSource
- let ok = (isControlledBy rActivator &&* isInZone Hand) source
- return ok
+defaultSpecialPlay :: Ability
+defaultSpecialPlay rSource rActivator = ClosedAbility
+ { _available = checkObject rSource (isControlledBy rActivator &&* isInZone Hand)
, _manaCost = mempty
, _additionalCosts = []
, _effect = SpecialAction (return [MoveObject rSource Library Battlefield])
}
tapToAddMana :: Maybe Color -> Ability
tapToAddMana mc rSource rActivator = ClosedAbility
- { _available = do
- os <- asks objects
- let source = os ! rSource
- let ok = (isControlledBy rActivator &&* isInZone Battlefield) source
- return ok
+ { _available = checkObject rSource (isControlledBy rActivator &&* isInZone Battlefield)
, _manaCost = mempty
, _additionalCosts = []
, _effect = SpecialAction (return [AddToManaPool rActivator mc])
}
+
+checkObject :: Ref Object -> (Object -> Bool) -> View Bool
+checkObject ref ok = ok . (! ref) <$> asks objects

0 comments on commit 120d53f

Please sign in to comment.