mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Fixed spells with alternative casting costs.
This commit is contained in:
parent
4bd4ad3d8a
commit
02338d5e9e
16 changed files with 233 additions and 139 deletions
|
@ -29,10 +29,12 @@
|
|||
package mage.sets.alarareborn;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.common.EntersBattlefieldTappedAbility;
|
||||
import mage.abilities.costs.AlternativeCostImpl;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.CompositeCost;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.ReturnToHandTargetCost;
|
||||
|
@ -51,9 +53,7 @@ import mage.target.common.TargetControlledPermanent;
|
|||
*/
|
||||
public class FieldmistBorderpost extends CardImpl<FieldmistBorderpost> {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledLandPermanent("basic land");
|
||||
private static final String COST_DESCRIPTION = "pay {1} and return a basic land you control to its owner's hand";
|
||||
private static final String ALTERNATIVE_COST_DESCRIPTION = "You may pay {1} and return a basic land you control to its owner's hand rather than pay Fieldmist Borderpost's mana cost";
|
||||
private static final FilterControlledPermanent filter = new FilterControlledLandPermanent("a basic land");
|
||||
|
||||
static {
|
||||
filter.add(new SupertypePredicate("Basic"));
|
||||
|
@ -66,8 +66,9 @@ public class FieldmistBorderpost extends CardImpl<FieldmistBorderpost> {
|
|||
this.color.setBlue(true);
|
||||
|
||||
// You may pay {1} and return a basic land you control to its owner's hand rather than pay Fieldmist Borderpost's mana cost.
|
||||
Cost cost = new CompositeCost(new GenericManaCost(1), new ReturnToHandTargetCost(new TargetControlledPermanent(filter)), COST_DESCRIPTION);
|
||||
this.getSpellAbility().addAlternativeCost(new AlternativeCostImpl(ALTERNATIVE_COST_DESCRIPTION, cost));
|
||||
Ability ability = new AlternativeCostSourceAbility(new GenericManaCost(1));
|
||||
ability.addCost(new ReturnToHandTargetCost(new TargetControlledPermanent(filter)));
|
||||
this.addAbility(ability);
|
||||
|
||||
// Fieldmist Borderpost enters the battlefield tapped.
|
||||
this.addAbility(new EntersBattlefieldTappedAbility());
|
||||
|
|
|
@ -29,10 +29,12 @@
|
|||
package mage.sets.alarareborn;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.common.EntersBattlefieldTappedAbility;
|
||||
import mage.abilities.costs.AlternativeCostImpl;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.CompositeCost;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.ReturnToHandTargetCost;
|
||||
|
@ -51,9 +53,7 @@ import mage.target.common.TargetControlledPermanent;
|
|||
*/
|
||||
public class FirewildBorderpost extends CardImpl<FirewildBorderpost> {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledLandPermanent("basic land");
|
||||
private static final String COST_DESCRIPTION = "pay {1} and return a basic land you control to its owner's hand";
|
||||
private static final String ALTERNATIVE_COST_DESCRIPTION = "You may pay {1} and return a basic land you control to its owner's hand rather than pay Firewild Borderpost's mana cost";
|
||||
private static final FilterControlledPermanent filter = new FilterControlledLandPermanent("a basic land");
|
||||
|
||||
static {
|
||||
filter.add(new SupertypePredicate("Basic"));
|
||||
|
@ -66,8 +66,9 @@ public class FirewildBorderpost extends CardImpl<FirewildBorderpost> {
|
|||
this.color.setGreen(true);
|
||||
|
||||
// You may pay {1} and return a basic land you control to its owner's hand rather than pay Firewild Borderpost's mana cost.
|
||||
Cost cost = new CompositeCost(new GenericManaCost(1), new ReturnToHandTargetCost(new TargetControlledPermanent(filter)), COST_DESCRIPTION);
|
||||
this.getSpellAbility().addAlternativeCost(new AlternativeCostImpl(ALTERNATIVE_COST_DESCRIPTION, cost));
|
||||
Ability ability = new AlternativeCostSourceAbility(new GenericManaCost(1));
|
||||
ability.addCost(new ReturnToHandTargetCost(new TargetControlledPermanent(filter)));
|
||||
this.addAbility(ability);
|
||||
|
||||
// Veinfire Firewild enters the battlefield tapped.
|
||||
this.addAbility(new EntersBattlefieldTappedAbility());
|
||||
|
|
|
@ -29,10 +29,12 @@
|
|||
package mage.sets.alarareborn;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.common.EntersBattlefieldTappedAbility;
|
||||
import mage.abilities.costs.AlternativeCostImpl;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.CompositeCost;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.ReturnToHandTargetCost;
|
||||
|
@ -51,9 +53,7 @@ import mage.target.common.TargetControlledPermanent;
|
|||
*/
|
||||
public class MistveinBorderpost extends CardImpl<MistveinBorderpost> {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledLandPermanent("basic land");
|
||||
private static final String COST_DESCRIPTION = "pay {1} and return a basic land you control to its owner's hand";
|
||||
private static final String ALTERNATIVE_COST_DESCRIPTION = "You may pay {1} and return a basic land you control to its owner's hand rather than pay Mistvein Borderpos's mana cost";
|
||||
private static final FilterControlledPermanent filter = new FilterControlledLandPermanent("a basic land");
|
||||
|
||||
static {
|
||||
filter.add(new SupertypePredicate("Basic"));
|
||||
|
@ -66,8 +66,9 @@ public class MistveinBorderpost extends CardImpl<MistveinBorderpost> {
|
|||
this.color.setBlack(true);
|
||||
|
||||
// You may pay {1} and return a basic land you control to its owner's hand rather than pay Mistvein Borderpost's mana cost.
|
||||
Cost cost = new CompositeCost(new GenericManaCost(1), new ReturnToHandTargetCost(new TargetControlledPermanent(filter)), COST_DESCRIPTION);
|
||||
this.getSpellAbility().addAlternativeCost(new AlternativeCostImpl(ALTERNATIVE_COST_DESCRIPTION, cost));
|
||||
Ability ability = new AlternativeCostSourceAbility(new GenericManaCost(1));
|
||||
ability.addCost(new ReturnToHandTargetCost(new TargetControlledPermanent(filter)));
|
||||
this.addAbility(ability);
|
||||
|
||||
// Mistvein Borderpost enters the battlefield tapped.
|
||||
this.addAbility(new EntersBattlefieldTappedAbility());
|
||||
|
|
|
@ -29,10 +29,12 @@
|
|||
package mage.sets.alarareborn;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.common.EntersBattlefieldTappedAbility;
|
||||
import mage.abilities.costs.AlternativeCostImpl;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.CompositeCost;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.ReturnToHandTargetCost;
|
||||
|
@ -51,9 +53,7 @@ import mage.target.common.TargetControlledPermanent;
|
|||
*/
|
||||
public class VeinfireBorderpost extends CardImpl<VeinfireBorderpost> {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledLandPermanent("basic land");
|
||||
private static final String COST_DESCRIPTION = "pay {1} and return a basic land you control to its owner's hand";
|
||||
private static final String ALTERNATIVE_COST_DESCRIPTION = "You may pay {1} and return a basic land you control to its owner's hand rather than pay Veinfire Borderpost's mana cost";
|
||||
private static final FilterControlledPermanent filter = new FilterControlledLandPermanent("a basic land");
|
||||
|
||||
static {
|
||||
filter.add(new SupertypePredicate("Basic"));
|
||||
|
@ -66,8 +66,9 @@ public class VeinfireBorderpost extends CardImpl<VeinfireBorderpost> {
|
|||
this.color.setRed(true);
|
||||
|
||||
// You may pay {1} and return a basic land you control to its owner's hand rather than pay Veinfire Borderpost's mana cost.
|
||||
Cost cost = new CompositeCost(new GenericManaCost(1), new ReturnToHandTargetCost(new TargetControlledPermanent(filter)), COST_DESCRIPTION);
|
||||
this.getSpellAbility().addAlternativeCost(new AlternativeCostImpl(ALTERNATIVE_COST_DESCRIPTION, cost));
|
||||
Ability ability = new AlternativeCostSourceAbility(new GenericManaCost(1));
|
||||
ability.addCost(new ReturnToHandTargetCost(new TargetControlledPermanent(filter)));
|
||||
this.addAbility(ability);
|
||||
|
||||
// Veinfire Borderpost enters the battlefield tapped.
|
||||
this.addAbility(new EntersBattlefieldTappedAbility());
|
||||
|
|
|
@ -29,10 +29,12 @@
|
|||
package mage.sets.alarareborn;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.common.EntersBattlefieldTappedAbility;
|
||||
import mage.abilities.costs.AlternativeCostImpl;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.CompositeCost;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.ReturnToHandTargetCost;
|
||||
|
@ -51,9 +53,7 @@ import mage.target.common.TargetControlledPermanent;
|
|||
*/
|
||||
public class WildfieldBorderpost extends CardImpl<WildfieldBorderpost> {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledLandPermanent("basic land");
|
||||
private static final String COST_DESCRIPTION = "pay {1} and return a basic land you control to its owner's hand";
|
||||
private static final String ALTERNATIVE_COST_DESCRIPTION = "You may pay {1} and return a basic land you control to its owner's hand rather than pay Wildfield Borderpost's mana cost";
|
||||
private static final FilterControlledPermanent filter = new FilterControlledLandPermanent("a basic land");
|
||||
|
||||
static {
|
||||
filter.add(new SupertypePredicate("Basic"));
|
||||
|
@ -66,8 +66,9 @@ public class WildfieldBorderpost extends CardImpl<WildfieldBorderpost> {
|
|||
this.color.setWhite(true);
|
||||
|
||||
// You may pay {1} and return a basic land you control to its owner's hand rather than pay Wildfield Borderpost's mana cost.
|
||||
Cost cost = new CompositeCost(new GenericManaCost(1), new ReturnToHandTargetCost(new TargetControlledPermanent(filter)), COST_DESCRIPTION);
|
||||
this.getSpellAbility().addAlternativeCost(new AlternativeCostImpl(ALTERNATIVE_COST_DESCRIPTION, cost));
|
||||
Ability ability = new AlternativeCostSourceAbility(new GenericManaCost(1));
|
||||
ability.addCost(new ReturnToHandTargetCost(new TargetControlledPermanent(filter)));
|
||||
this.addAbility(ability);
|
||||
|
||||
// Wildfield Borderpost enters the battlefield tapped.
|
||||
this.addAbility(new EntersBattlefieldTappedAbility());
|
||||
|
|
|
@ -32,6 +32,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Rarity;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.costs.AlternativeCostImpl;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostsImpl;
|
||||
import mage.abilities.costs.common.ExileFromHandCost;
|
||||
|
@ -57,12 +58,10 @@ public class Pyrokinesis extends CardImpl<Pyrokinesis> {
|
|||
this.color.setRed(true);
|
||||
|
||||
// You may exile a red card from your hand rather than pay Pyrokinesis's mana cost.
|
||||
FilterOwnedCard filter = new FilterOwnedCard("red card from your hand");
|
||||
FilterOwnedCard filter = new FilterOwnedCard("a red card from your hand");
|
||||
filter.add(new ColorPredicate(ObjectColor.RED));
|
||||
filter.add(Predicates.not(new CardIdPredicate(this.getId()))); // the exile cost can never be paid with the card itself
|
||||
CostsImpl<Cost> costs = new CostsImpl<Cost>();
|
||||
costs.add(new ExileFromHandCost(new TargetCardInHand(filter)));
|
||||
this.getSpellAbility().addAlternativeCost(new AlternativeCostImpl("You may exile a red card from your hand rather than pay Pyrokinesis's mana cost", costs));
|
||||
this.addAbility(new AlternativeCostSourceAbility(new ExileFromHandCost(new TargetCardInHand(filter))));
|
||||
|
||||
// Pyrokinesis deals 4 damage divided as you choose among any number of target creatures.
|
||||
this.getSpellAbility().addEffect(new DamageMultiEffect(4));
|
||||
|
|
|
@ -28,16 +28,14 @@
|
|||
package mage.sets.mercadianmasques;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.AlternativeCostImpl;
|
||||
import mage.abilities.costs.CompositeCost;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.condition.common.CardsInHandCondition;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.common.FilterLandCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
@ -57,8 +55,9 @@ public class LandGrant extends CardImpl<LandGrant> {
|
|||
this.color.setGreen(true);
|
||||
|
||||
// If you have no land cards in hand, you may reveal your hand rather than pay Land Grant's mana cost.
|
||||
Cost cost = new CompositeCost(new GenericManaCost(0), new LandGrantCost(), "If you have no land cards in hand, you may reveal your hand");
|
||||
this.getSpellAbility().addAlternativeCost(new AlternativeCostImpl("If you have no land cards in hand, you may reveal your hand rather than pay Land Grant's mana cost", cost));
|
||||
this.addAbility(new AlternativeCostSourceAbility(new LandGrantReavealCost(), new CardsInHandCondition(CardsInHandCondition.CountType.EQUAL_TO, 0),
|
||||
"If you have no land cards in hand, you may reveal your hand rather than pay Land Grant's mana cost."));
|
||||
|
||||
// Search your library for a Forest card, reveal that card, and put it into your hand. Then shuffle your library.
|
||||
this.getSpellAbility().addEffect(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filter), true, true));
|
||||
}
|
||||
|
@ -73,13 +72,13 @@ public class LandGrant extends CardImpl<LandGrant> {
|
|||
}
|
||||
}
|
||||
|
||||
class LandGrantCost extends CostImpl<LandGrantCost> {
|
||||
class LandGrantReavealCost extends CostImpl<LandGrantReavealCost> {
|
||||
|
||||
public LandGrantCost() {
|
||||
this.text = "If you have no land cards in hand, you may reveal your hand";
|
||||
public LandGrantReavealCost() {
|
||||
this.text = "reveal your hand";
|
||||
}
|
||||
|
||||
public LandGrantCost(LandGrantCost cost) {
|
||||
public LandGrantReavealCost(LandGrantReavealCost cost) {
|
||||
super(cost);
|
||||
}
|
||||
|
||||
|
@ -95,16 +94,12 @@ class LandGrantCost extends CostImpl<LandGrantCost> {
|
|||
|
||||
@Override
|
||||
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
||||
Player player = game.getPlayer(controllerId);
|
||||
if (player != null && player.getHand().count(new FilterLandCard(), game) == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LandGrantCost copy() {
|
||||
return new LandGrantCost(this);
|
||||
public LandGrantReavealCost copy() {
|
||||
return new LandGrantReavealCost(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -32,7 +32,9 @@ import java.util.UUID;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.condition.common.CardsInHandCondition;
|
||||
import mage.abilities.costs.AlternativeCostImpl;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostsImpl;
|
||||
import mage.abilities.costs.common.ExileFromHandCost;
|
||||
|
@ -65,13 +67,12 @@ public class Misdirection extends CardImpl<Misdirection> {
|
|||
this.color.setBlue(true);
|
||||
|
||||
// You may exile a blue card from your hand rather than pay Misdirection's mana cost.
|
||||
FilterOwnedCard filterCardInHand = new FilterOwnedCard("blue card from your hand");
|
||||
FilterOwnedCard filterCardInHand = new FilterOwnedCard("a blue card from your hand");
|
||||
filterCardInHand.add(new ColorPredicate(ObjectColor.BLUE));
|
||||
// the exile cost can never be paid with the card itself
|
||||
filterCardInHand.add(Predicates.not(new CardIdPredicate(this.getId())));
|
||||
CostsImpl<Cost> costs = new CostsImpl<Cost>();
|
||||
costs.add(new ExileFromHandCost(new TargetCardInHand(filterCardInHand)));
|
||||
this.getSpellAbility().addAlternativeCost(new AlternativeCostImpl("You may exile a blue card from your hand rather than pay Misdirection's mana cost", costs));
|
||||
this.addAbility(new AlternativeCostSourceAbility(new ExileFromHandCost(new TargetCardInHand(filterCardInHand))));
|
||||
|
||||
// Change the target of target spell with a single target.
|
||||
this.getSpellAbility().addEffect(new ChooseNewTargetsTargetEffect(true, true));
|
||||
this.getSpellAbility().addTarget(new TargetSpell(filter2));
|
||||
|
|
|
@ -28,15 +28,13 @@
|
|||
package mage.sets.nemesis;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.costs.AlternativeCostImpl;
|
||||
import mage.abilities.costs.CompositeCost;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.common.ReturnToHandTargetCost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.common.CounterUnlessPaysEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
|
@ -49,9 +47,7 @@ import mage.target.common.TargetControlledPermanent;
|
|||
*/
|
||||
public class Daze extends CardImpl<Daze> {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("Island");
|
||||
private static final String COST_DESCRIPTION = "Return an island you control to its owner's hand";
|
||||
private static final String ALTERNATIVE_COST_DESCRIPTION = "You may return an island you control to its owner's hand rather than pay {this}'s mana cost";
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("an Island");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate("Island"));
|
||||
|
@ -65,8 +61,8 @@ public class Daze extends CardImpl<Daze> {
|
|||
this.color.setBlue(true);
|
||||
|
||||
// You may return an Island you control to its owner's hand rather than pay Daze's mana cost.
|
||||
Cost cost = new CompositeCost(new GenericManaCost(0), new ReturnToHandTargetCost(new TargetControlledPermanent(filter)), COST_DESCRIPTION);
|
||||
this.getSpellAbility().addAlternativeCost(new AlternativeCostImpl(ALTERNATIVE_COST_DESCRIPTION, cost));
|
||||
this.addAbility(new AlternativeCostSourceAbility(new ReturnToHandTargetCost(new TargetControlledPermanent(filter))));
|
||||
|
||||
// Counter target spell unless its controller pays {1}.
|
||||
this.getSpellAbility().addTarget(new TargetSpell());
|
||||
this.getSpellAbility().addEffect(new CounterUnlessPaysEffect(new GenericManaCost(1)));
|
||||
|
|
|
@ -28,18 +28,18 @@
|
|||
package mage.sets.nemesis;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.AlternativeCostImpl;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.condition.CompoundCondition;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.ControlsPermanentCondition;
|
||||
import mage.abilities.condition.common.OpponentControlsPermanentCondition;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.effects.common.continious.BoostAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.filter.common.FilterControlledLandPermanent;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -47,6 +47,14 @@ import mage.game.Game;
|
|||
*/
|
||||
public class Massacre extends CardImpl<Massacre> {
|
||||
|
||||
private static final FilterPermanent filterPlains = new FilterPermanent();
|
||||
private static final FilterPermanent filterSwamp = new FilterPermanent();
|
||||
|
||||
static {
|
||||
filterPlains.add(new SubtypePredicate(("Plains")));
|
||||
filterSwamp.add(new SubtypePredicate(("Swamp")));
|
||||
}
|
||||
|
||||
public Massacre(UUID ownerId) {
|
||||
super(ownerId, 58, "Massacre", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{B}{B}");
|
||||
this.expansionSetCode = "NMS";
|
||||
|
@ -54,7 +62,10 @@ public class Massacre extends CardImpl<Massacre> {
|
|||
this.color.setBlack(true);
|
||||
|
||||
// If an opponent controls a Plains and you control a Swamp, you may cast Massacre without paying its mana cost.
|
||||
this.getSpellAbility().addAlternativeCost(new AlternativeCostImpl("If an opponent controls a Plains and you control a Swamp, you may cast Massacre without paying its mana cost", new MassacreCost()));
|
||||
Condition condition = new CompoundCondition("If an opponent controls a Plains and you control a Swamp",
|
||||
new OpponentControlsPermanentCondition(filterPlains),
|
||||
new ControlsPermanentCondition(filterSwamp));
|
||||
this.addAbility(new AlternativeCostSourceAbility(null, condition));
|
||||
// All creatures get -2/-2 until end of turn.
|
||||
this.getSpellAbility().addEffect(new BoostAllEffect(-2, -2, Duration.EndOfTurn));
|
||||
}
|
||||
|
@ -68,44 +79,3 @@ public class Massacre extends CardImpl<Massacre> {
|
|||
return new Massacre(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MassacreCost extends CostImpl<MassacreCost> {
|
||||
|
||||
|
||||
|
||||
public MassacreCost() {
|
||||
this.text = "If an opponent controls a Plains and you control a Swamp, you may cast Massacre without paying its mana cost.";
|
||||
}
|
||||
|
||||
public MassacreCost(MassacreCost cost) {
|
||||
super(cost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
paid = canPay(sourceId, controllerId, game);
|
||||
return paid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
||||
FilterControlledLandPermanent filterSwamp = new FilterControlledLandPermanent("Swamp");
|
||||
filterSwamp.add(new SubtypePredicate("Swamp"));
|
||||
FilterControlledLandPermanent filterPlains = new FilterControlledLandPermanent("Plains");
|
||||
filterPlains.add(new SubtypePredicate("Plains"));
|
||||
if (game.getBattlefield().contains(filterSwamp, controllerId, 1, game)) {
|
||||
for(UUID uuid : game.getOpponents(controllerId)){
|
||||
if(game.getBattlefield().contains(filterPlains, uuid, 1, game)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MassacreCost copy() {
|
||||
return new MassacreCost(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -31,6 +31,7 @@ import java.util.UUID;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.costs.AlternativeCostImpl;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.common.DiscardTargetCost;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -62,9 +63,7 @@ public class Abolish extends CardImpl<Abolish> {
|
|||
this.color.setWhite(true);
|
||||
|
||||
// You may discard a Plains card rather than pay Abolish's mana cost.
|
||||
this.getSpellAbility().addAlternativeCost(
|
||||
new AlternativeCostImpl("You may discard a Plains card rather than pay Abolish's mana cost",
|
||||
new DiscardTargetCost(new TargetCardInHand(filterCost))));
|
||||
this.addAbility(new AlternativeCostSourceAbility(new DiscardTargetCost(new TargetCardInHand(filterCost))));
|
||||
|
||||
// Destroy target artifact or enchantment.
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect());
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
package mage.sets.riseoftheeldrazi;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.costs.AlternativeCostImpl;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.keyword.AnnihilatorAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
@ -45,8 +45,7 @@ import mage.target.common.TargetControlledPermanent;
|
|||
*/
|
||||
public class HandOfEmrakul extends CardImpl<HandOfEmrakul> {
|
||||
|
||||
private static final String ALTERNATIVE_COST_DESCRIPTION = "You may sacrifice four Eldrazi Spawn rather than pay Hand of Emrakul's mana cost";
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("Eldrazi Spawn");
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("four Eldrazi Spawn");
|
||||
|
||||
static {
|
||||
filter.add(new NamePredicate("Eldrazi Spawn"));
|
||||
|
@ -61,8 +60,8 @@ public class HandOfEmrakul extends CardImpl<HandOfEmrakul> {
|
|||
this.toughness = new MageInt(7);
|
||||
|
||||
// You may sacrifice four Eldrazi Spawn rather than pay Hand of Emrakul's mana cost.
|
||||
this.getSpellAbility().addAlternativeCost(new AlternativeCostImpl(ALTERNATIVE_COST_DESCRIPTION,
|
||||
new SacrificeTargetCost(new TargetControlledPermanent(4, 4, filter, true))));
|
||||
this.addAbility(new AlternativeCostSourceAbility(new SacrificeTargetCost(new TargetControlledPermanent(4, 4, filter, true))));
|
||||
// Annihilator 1
|
||||
this.addAbility(new AnnihilatorAbility(1));
|
||||
}
|
||||
|
||||
|
|
|
@ -28,17 +28,15 @@
|
|||
package mage.sets.shardsofalara;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.AlternativeCostImpl;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.common.ExileFromGraveCost;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.effects.common.ReturnSourceFromGraveyardToHandEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterArtifactCard;
|
||||
import mage.filter.common.FilterControlledArtifactPermanent;
|
||||
|
@ -53,7 +51,7 @@ import mage.target.common.TargetControlledPermanent;
|
|||
*/
|
||||
public class SalvageTitan extends CardImpl<SalvageTitan> {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("artifacts");
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("three artifacts");
|
||||
static{
|
||||
filter.add(new CardTypePredicate(CardType.ARTIFACT));
|
||||
}
|
||||
|
@ -68,8 +66,8 @@ public class SalvageTitan extends CardImpl<SalvageTitan> {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// You may sacrifice three artifacts rather than pay Salvage Titan's mana cost.
|
||||
Cost cost = new SacrificeTargetCost(new TargetControlledPermanent(3, 3, new FilterControlledArtifactPermanent(), true));
|
||||
this.getSpellAbility().addAlternativeCost(new AlternativeCostImpl("You may sacrifice three artifacts rather than pay {this}'s mana cost", cost));
|
||||
this.addAbility(new AlternativeCostSourceAbility(new SacrificeTargetCost(new TargetControlledPermanent(3, 3, new FilterControlledArtifactPermanent(), true))));
|
||||
|
||||
// Exile three artifact cards from your graveyard: Return Salvage Titan from your graveyard to your hand.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToHandEffect(), new ExileFromGraveCost(new TargetCardInYourGraveyard(3, new FilterArtifactCard()))));
|
||||
}
|
||||
|
|
|
@ -93,9 +93,6 @@ public class ControlsPermanentCondition implements Condition {
|
|||
this.condition = conditionToDecorate;
|
||||
}
|
||||
|
||||
/*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
boolean conditionApplies = false;
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class OpponentControlsPermanentCondition implements Condition {
|
||||
|
||||
public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO };
|
||||
private FilterPermanent filter;
|
||||
private Condition condition;
|
||||
private CountType type;
|
||||
private int count;
|
||||
|
||||
/**
|
||||
* Applies a filter and delegates creation to
|
||||
* {@link #ControlsPermanent(mage.filter.FilterPermanent, mage.abilities.condition.common.ControlsPermanent.CountType, int)}
|
||||
* with {@link CountType#MORE_THAN}, and 0.
|
||||
*
|
||||
* @param filter
|
||||
*/
|
||||
public OpponentControlsPermanentCondition(FilterPermanent filter) {
|
||||
this(filter, CountType.MORE_THAN, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies a filter, a {@link CountType}, and count to permanents on the
|
||||
* battlefield when checking the condition during the
|
||||
* {@link #apply(mage.game.Game, mage.abilities.Ability) apply} method invocation.
|
||||
*
|
||||
* @param filter
|
||||
* @param type
|
||||
* @param count
|
||||
*/
|
||||
public OpponentControlsPermanentCondition ( FilterPermanent filter, CountType type, int count ) {
|
||||
this.filter = filter;
|
||||
this.type = type;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies a filter, a {@link CountType}, and count to permanents on the
|
||||
* battlefield and calls the decorated condition to see if it
|
||||
* {@link #apply(mage.game.Game, mage.abilities.Ability) applies}
|
||||
* as well. This will force both conditions to apply for this to be true.
|
||||
*
|
||||
* @param filter
|
||||
* @param type
|
||||
* @param count
|
||||
* @param conditionToDecorate
|
||||
*/
|
||||
public OpponentControlsPermanentCondition ( FilterPermanent filter, CountType type, int count, Condition conditionToDecorate ) {
|
||||
this(filter, type, count);
|
||||
this.condition = conditionToDecorate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
boolean conditionApplies = false;
|
||||
|
||||
FilterPermanent localFilter = filter.copy();
|
||||
localFilter.add(new ControllerPredicate(TargetController.OPPONENT));
|
||||
|
||||
switch ( this.type ) {
|
||||
case FEWER_THAN:
|
||||
conditionApplies = game.getBattlefield().count(localFilter, source.getSourceId(), source.getControllerId(), game) < this.count;
|
||||
break;
|
||||
case MORE_THAN:
|
||||
conditionApplies = game.getBattlefield().count(localFilter, source.getSourceId(), source.getControllerId(), game) > this.count;
|
||||
break;
|
||||
case EQUAL_TO:
|
||||
conditionApplies = game.getBattlefield().count(localFilter, source.getSourceId(), source.getControllerId(), game) == this.count;
|
||||
break;
|
||||
}
|
||||
|
||||
//If a decorated condition exists, check it as well and apply them together.
|
||||
if ( this.condition != null ) {
|
||||
conditionApplies = conditionApplies && this.condition.apply(game, source);
|
||||
}
|
||||
|
||||
return conditionApplies;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return filter.getMessage();
|
||||
}
|
||||
}
|
|
@ -72,9 +72,11 @@ public class AlternativeCostSourceAbility extends StaticAbility<AlternativeCostS
|
|||
}
|
||||
|
||||
private void convertToAlternativeCostAndAdd(Cost cost) {
|
||||
if (cost != null) {
|
||||
AlternativeCost2 alternativeCost = new AlternativeCost2Impl(null, null, cost);
|
||||
this.alternateCosts.add(alternativeCost);
|
||||
}
|
||||
}
|
||||
|
||||
public AlternativeCostSourceAbility(final AlternativeCostSourceAbility ability) {
|
||||
super(ability);
|
||||
|
@ -141,7 +143,7 @@ public class AlternativeCostSourceAbility extends StaticAbility<AlternativeCostS
|
|||
if (rule != null) {
|
||||
return rule;
|
||||
}
|
||||
// If you control a Swamp, you may pay 4 life rather than pay Snuff Out's mana cost.
|
||||
// you may cast Massacre without paying its mana cost.
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (condition != null) {
|
||||
sb.append(condition.toString());
|
||||
|
@ -157,15 +159,24 @@ public class AlternativeCostSourceAbility extends StaticAbility<AlternativeCostS
|
|||
String remarkText = "";
|
||||
for (AlternativeCost2 alternativeCost : alternateCosts) {
|
||||
if (numberCosts == 0) {
|
||||
if (alternativeCost instanceof ManaCostsImpl) {
|
||||
sb.append("pay ");
|
||||
}
|
||||
sb.append(alternativeCost.getText(false));
|
||||
remarkText = alternativeCost.getReminderText();
|
||||
} else {
|
||||
sb.append(" and ").append(alternativeCost.getText(true));
|
||||
sb.append(" and ");
|
||||
if (alternativeCost instanceof ManaCostsImpl) {
|
||||
sb.append("pay ");
|
||||
}
|
||||
sb.append(alternativeCost.getText(true));
|
||||
}
|
||||
++numberCosts;
|
||||
}
|
||||
if (condition == null || alternateCosts.size() == 1) {
|
||||
sb.append(" rather than pay {source}'s mana cost");
|
||||
} else if (alternateCosts.isEmpty()) {
|
||||
sb.append("cast {this} without paying its mana cost");
|
||||
}
|
||||
sb.append(".");
|
||||
if (numberCosts == 1 && remarkText != null) {
|
||||
|
|
Loading…
Reference in a new issue