diff --git a/Mage.Sets/src/mage/cards/i/InterplanarBeacon.java b/Mage.Sets/src/mage/cards/i/InterplanarBeacon.java index 7b7d1e3fee..465be4256b 100644 --- a/Mage.Sets/src/mage/cards/i/InterplanarBeacon.java +++ b/Mage.Sets/src/mage/cards/i/InterplanarBeacon.java @@ -10,7 +10,6 @@ import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.mana.ColorlessManaAbility; -import mage.abilities.mana.ConditionalAnyColorManaAbility; import mage.abilities.mana.builder.ConditionalManaBuilder; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -18,8 +17,8 @@ import mage.constants.CardType; import mage.filter.FilterSpell; import mage.game.Game; import mage.game.stack.Spell; - import java.util.UUID; +import mage.abilities.mana.conditional.ConditionalAddManaOfTwoDifferentColorsAbility; /** * @author TheElk801 @@ -44,8 +43,8 @@ public final class InterplanarBeacon extends CardImpl { this.addAbility(new ColorlessManaAbility()); // {1}, {T}: Add two mana of different colors. Spend this mana only to cast planeswalker spells. - Ability ability = new ConditionalAnyColorManaAbility( - new GenericManaCost(1), 2, + Ability ability = new ConditionalAddManaOfTwoDifferentColorsAbility( + new GenericManaCost(1), new InterplanarBeaconManaBuilder() ); ability.addCost(new TapSourceCost()); @@ -80,7 +79,7 @@ class InterplanarBeaconConditionalMana extends ConditionalMana { InterplanarBeaconConditionalMana(Mana mana) { super(mana); this.staticText = "Spend this mana only to cast planeswalker spells"; - addCondition(new InterplanarBeaconManaCondition()); + this.addCondition(new InterplanarBeaconManaCondition()); } } @@ -89,6 +88,7 @@ class InterplanarBeaconManaCondition implements Condition { @Override public boolean apply(Game game, Ability source) { MageObject object = source.getSourceObject(game); - return object instanceof Spell && object.isPlaneswalker(); + return object instanceof Spell + && object.isPlaneswalker(); } -} \ No newline at end of file +} diff --git a/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalManaOfTwoDifferentColorsEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalManaOfTwoDifferentColorsEffect.java new file mode 100644 index 0000000000..a2627e1135 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalManaOfTwoDifferentColorsEffect.java @@ -0,0 +1,58 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.abilities.effects.mana; + +import java.util.ArrayList; +import java.util.List; +import mage.ConditionalMana; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.effects.common.ManaEffect; +import mage.abilities.mana.builder.ConditionalManaBuilder; +import mage.choices.ManaChoice; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author jeffwadsworth + */ +public class AddConditionalManaOfTwoDifferentColorsEffect extends ManaEffect { + + private final ConditionalManaBuilder manaBuilder; + + public AddConditionalManaOfTwoDifferentColorsEffect(ConditionalManaBuilder manaBuilder) { + super(); + this.manaBuilder = manaBuilder; + staticText = "Add two mana of different colors. " + manaBuilder.getRule(); + } + + private AddConditionalManaOfTwoDifferentColorsEffect(final AddConditionalManaOfTwoDifferentColorsEffect effect) { + super(effect); + this.manaBuilder = effect.manaBuilder; + } + + @Override + public List getNetMana(Game game, Ability source) { + ArrayList netMana = new ArrayList<>(); + netMana.add(Mana.AnyMana(2)); + return netMana; + } + + @Override + public Mana produceMana(Game game, Ability source) { + Player player = getPlayer(game, source); + Mana mana = new ConditionalMana(manaBuilder.setMana( + ManaChoice.chooseTwoDifferentColors( + player, game), source, game).build()); + return mana; + } + + @Override + public AddConditionalManaOfTwoDifferentColorsEffect copy() { + return new AddConditionalManaOfTwoDifferentColorsEffect(this); + } +} diff --git a/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalAddManaOfTwoDifferentColorsAbility.java b/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalAddManaOfTwoDifferentColorsAbility.java new file mode 100644 index 0000000000..e700aeb612 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalAddManaOfTwoDifferentColorsAbility.java @@ -0,0 +1,37 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.abilities.mana.conditional; + +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.mana.AddConditionalManaOfTwoDifferentColorsEffect; +import mage.abilities.mana.ActivatedManaAbilityImpl; +import mage.abilities.mana.builder.ConditionalManaBuilder; +import mage.constants.Zone; + +/** + * + * @author jeffwadsworth + */ +public class ConditionalAddManaOfTwoDifferentColorsAbility extends ActivatedManaAbilityImpl { + + public ConditionalAddManaOfTwoDifferentColorsAbility(ConditionalManaBuilder manaBuilder) { + this(new TapSourceCost(), manaBuilder); + } + + public ConditionalAddManaOfTwoDifferentColorsAbility(Cost cost, ConditionalManaBuilder manaBuilder) { + super(Zone.BATTLEFIELD, new AddConditionalManaOfTwoDifferentColorsEffect(manaBuilder), cost); + } + + public ConditionalAddManaOfTwoDifferentColorsAbility(final ConditionalAddManaOfTwoDifferentColorsAbility ability) { + super(ability); + } + + @Override + public ConditionalAddManaOfTwoDifferentColorsAbility copy() { + return new ConditionalAddManaOfTwoDifferentColorsAbility(this); + } +}