Skip to content

Commit

Permalink
Created helper record defaultActivation
Browse files Browse the repository at this point in the history
  • Loading branch information
MedeaMelana committed May 10, 2014
1 parent aa44724 commit 3cc8150
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
11 changes: 4 additions & 7 deletions Magic-Cards/src/Magic/BasicLands.hs
Expand Up @@ -28,15 +28,12 @@ mkBasicLandCard ty color = mkCard $ do

tapToAddMana :: Maybe Color -> ActivatedAbility
tapToAddMana mc = ActivatedAbility
{ abilityActivation = Activation
{ timing = instantSpeed
, available = availableFromBattlefield
, manaCost = mempty
, effect = \_rSource you ->
{ abilityType = ManaAb
, tapCost = TapCost
, abilityActivation = defaultActivation
{ effect = \_rSource you ->
void (executeEffect (Will (AddToManaPool you [mc])))
}
, abilityType = ManaAb
, tapCost = TapCost
}

checkObject :: SomeObjectRef -> (Object -> Bool) -> View Bool
Expand Down
21 changes: 6 additions & 15 deletions Magic-Cards/src/Magic/M13.hs
Expand Up @@ -268,11 +268,8 @@ arborElf = mkCard $ do
untapTargetForest = ActivatedAbility
{ abilityType = ActivatedAb
, tapCost = TapCost
, abilityActivation = Activation
{ timing = instantSpeed
, available = availableFromBattlefield
, manaCost = Just []
, effect = \_ you -> do
, abilityActivation = defaultActivation
{ effect = \_ you -> do
ts <- askTarget you $ checkPermanent
(hasTypes (landTypes [Forest])) <?> targetPermanent
mkTargetAbility you ts $ \rForest ->
Expand Down Expand Up @@ -343,11 +340,8 @@ chronomaton = mkCard $ do
addCounter = ActivatedAbility
{ abilityType = ActivatedAb
, tapCost = TapCost
, abilityActivation = Activation
{ timing = instantSpeed
, available = availableFromBattlefield
, manaCost = Just []
, effect = \rSelf you ->
, abilityActivation = defaultActivation
{ effect = \rSelf you ->
mkTrigger you $ will (AddCounter rSelf Plus1Plus1)
}
}
Expand All @@ -362,11 +356,8 @@ tormod'sCrypt = mkCard $ do
tapToExile = ActivatedAbility
{ abilityType = ActivatedAb
, tapCost = TapCost
, abilityActivation = Activation
{ timing = instantSpeed
, available = availableFromBattlefield
, manaCost = Just []
, effect = \(Some Battlefield, i) you -> do
, abilityActivation = defaultActivation
{ effect = \(Some Battlefield, i) you -> do
tp <- askTarget you targetPlayer
will (Sacrifice (Battlefield, i))
mkTargetTrigger you tp $ \p -> do
Expand Down
10 changes: 10 additions & 0 deletions Magic/src/Magic/Abilities.hs
Expand Up @@ -24,6 +24,7 @@ module Magic.Abilities (

-- * Activated abilities
loyaltyAbility, mkTargetAbility, mkAbility,
defaultActivation,

-- * Creating effects on the stack
stackSelf, stackTargetSelf,
Expand Down Expand Up @@ -209,6 +210,15 @@ mkTargetAbility = mkTargetTrigger
mkAbility :: PlayerRef -> Magic() -> Magic ()
mkAbility = mkTrigger

-- | Default activation of an activated ability, 'instantSpeed', 'availableFromBattlefield', a mana cost of 'Just' @[]@ and no effect.
defaultActivation :: Activation
defaultActivation = Activation
{ timing = instantSpeed
, available = availableFromBattlefield
, manaCost = Just []
, effect = \_ _ -> return ()
}



-- CREATING EFFECTS ON THE STACK
Expand Down

0 comments on commit 3cc8150

Please sign in to comment.