diff --git a/Mage.Sets/src/mage/sets/alliances/Contagion.java b/Mage.Sets/src/mage/sets/alliances/Contagion.java index e501f04eba..f46fde2b15 100644 --- a/Mage.Sets/src/mage/sets/alliances/Contagion.java +++ b/Mage.Sets/src/mage/sets/alliances/Contagion.java @@ -32,9 +32,11 @@ import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.Mode; 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; +import mage.abilities.costs.common.GainLifeOpponentCost; import mage.abilities.costs.common.PayLifeCost; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; @@ -57,21 +59,21 @@ import mage.target.common.TargetCreaturePermanentAmount; * @author Plopman */ public class Contagion extends CardImpl { - + public Contagion(UUID ownerId) { super(ownerId, 4, "Contagion", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{3}{B}{B}"); this.expansionSetCode = "ALL"; this.color.setBlack(true); - // You may pay 1 life and exile a black card from your hand rather than pay Contagion's mana cost. FilterOwnedCard filter = new FilterOwnedCard("black card from your hand"); filter.add(new ColorPredicate(ObjectColor.BLACK)); filter.add(Predicates.not(new CardIdPredicate(this.getId()))); // the exile cost can never be paid with the card itself - CostsImpl costs = new CostsImpl(); - costs.add(new PayLifeCost(1)); - costs.add(new ExileFromHandCost(new TargetCardInHand(filter))); - this.getSpellAbility().addAlternativeCost(new AlternativeCostImpl("Pay 1 life and exile a black card from your hand rather than pay {source}'s mana cost", costs)); + + // You may pay 1 life and exile a black card from your hand rather than pay Contagion's mana cost. + AlternativeCostSourceAbility ability = new AlternativeCostSourceAbility(new PayLifeCost(1)); + ability.addCost(new ExileFromHandCost(new TargetCardInHand(filter))); + this.addAbility(ability); // Distribute two -2/-1 counters among one or two target creatures. this.getSpellAbility().addTarget(new TargetCreaturePermanentAmount(2)); diff --git a/Mage.Sets/src/mage/sets/alliances/ForceOfWill.java b/Mage.Sets/src/mage/sets/alliances/ForceOfWill.java index eca26f308c..73eb149eb0 100644 --- a/Mage.Sets/src/mage/sets/alliances/ForceOfWill.java +++ b/Mage.Sets/src/mage/sets/alliances/ForceOfWill.java @@ -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; @@ -61,11 +62,11 @@ public class ForceOfWill extends CardImpl { FilterOwnedCard filter = new FilterOwnedCard("blue card from your hand"); filter.add(new ColorPredicate(ObjectColor.BLUE)); filter.add(Predicates.not(new CardIdPredicate(this.getId()))); // the exile cost can never be paid with the card itself - CostsImpl costs = new CostsImpl(); - costs.add(new PayLifeCost(1)); - costs.add(new ExileFromHandCost(new TargetCardInHand(filter))); - this.getSpellAbility().addAlternativeCost(new AlternativeCostImpl("Pay 1 life and exile a blue card from your hand rather than pay Force of Will's mana cost", costs)); - + + AlternativeCostSourceAbility ability = new AlternativeCostSourceAbility(new PayLifeCost(1)); + ability.addCost(new ExileFromHandCost(new TargetCardInHand(filter))); + this.addAbility(ability); + // Counter target spell. this.getSpellAbility().addEffect(new CounterTargetEffect()); this.getSpellAbility().addTarget(new TargetSpell()); diff --git a/Mage/src/mage/abilities/costs/AlternativeCostSourceAbility.java b/Mage/src/mage/abilities/costs/AlternativeCostSourceAbility.java index 5fa747878b..fa0e9cb82e 100644 --- a/Mage/src/mage/abilities/costs/AlternativeCostSourceAbility.java +++ b/Mage/src/mage/abilities/costs/AlternativeCostSourceAbility.java @@ -47,7 +47,7 @@ import mage.players.Player; */ public class AlternativeCostSourceAbility extends StaticAbility implements AlternativeSourceCosts { - protected List alternateCosts = new LinkedList(); + protected List alternateCosts = new LinkedList<>(); protected Condition condition; protected String rule; @@ -66,6 +66,11 @@ public class AlternativeCostSourceAbility extends StaticAbility