Permalink
Browse files

Utility function for the empty object; play ability is now optional

  • Loading branch information...
1 parent 25d1bfc commit 8dbb21f94377f02cc1d01d24a72d447ecfa968e1 @MedeaMelana committed Aug 31, 2012
Showing with 32 additions and 24 deletions.
  1. +4 −22 BasicLands.hs
  2. +2 −2 Types.hs
  3. +26 −0 Utils.hs
View
@@ -22,29 +22,11 @@ mountain = mkBasicLandCard Mountain Red
forest = mkBasicLandCard Forest Green
mkBasicLandCard :: LandType -> Color -> Card
-mkBasicLandCard ty color = Card $ \ts rOwner ->
- Object
- { _name = Just (fromString (show ty))
- , _colors = mempty
- , _types = basicType <> objectType ty
- , _zone = Library
- , _owner = rOwner
- , _controller = rOwner
- , _timestamp = ts
- , _counters = []
-
- , _tapStatus = Nothing
-
- , _power = Nothing
- , _toughness = Nothing
- , _damage = Nothing
-
- , _play = playLand
- , _staticKeywordAbilities = []
- , _continuousEffects = []
+mkBasicLandCard ty color = Card $ \ts rOwner zone -> (object ts rOwner zone)
+ { _name = Just (fromString (show ty))
+ , _types = basicType <> objectType ty
+ , _play = Just playLand
, _activatedAbilities = [tapToAddMana (Just color)]
- , _triggeredAbilities = []
- , _replacementEffects = []
}
playLand :: Ability
View
@@ -84,7 +84,7 @@ data Player = Player
data Card = Card
-- timestamp, owner (and controller)
- { enterWorld :: Timestamp -> Ref Player -> Object
+ { enterWorld :: Timestamp -> Ref Player -> Zone -> Object
}
data Object = Object
@@ -112,7 +112,7 @@ data Object = Object
--, _indestructible :: Bool
- , _play :: Ability
+ , _play :: Maybe Ability
, _staticKeywordAbilities :: Bag StaticKeywordAbility
, _continuousEffects :: [ContinuousEffect] -- special form of static ability
, _activatedAbilities :: [Ability]
View
@@ -10,6 +10,32 @@ 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 }

0 comments on commit 8dbb21f

Please sign in to comment.