diff --git a/Mage.Sets/src/mage/sets/legions/WirewoodChanneler.java b/Mage.Sets/src/mage/sets/legions/WirewoodChanneler.java index b3af010a320..f2028e62ad8 100644 --- a/Mage.Sets/src/mage/sets/legions/WirewoodChanneler.java +++ b/Mage.Sets/src/mage/sets/legions/WirewoodChanneler.java @@ -30,6 +30,7 @@ package mage.sets.legions; import java.util.UUID; import mage.MageInt; import mage.Mana; +import mage.abilities.costs.common.TapSourceCost; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.mana.DynamicManaAbility; import mage.cards.CardImpl; @@ -61,8 +62,8 @@ public class WirewoodChanneler extends CardImpl { this.toughness = new MageInt(2); // {T}: Add X mana of any one color to your mana pool, where X is the number of Elves on the battlefield. - DynamicManaAbility ability = new DynamicManaAbility(new Mana(0,0,0,0,0,0,1), new PermanentsOnBattlefieldCount(filter), - "Add X mana of any one color to your mana pool, where X is the number of Elves on the battlefield"); + DynamicManaAbility ability = new DynamicManaAbility(new Mana(0,0,0,0,0,0,1), new PermanentsOnBattlefieldCount(filter), new TapSourceCost(), + "Add X mana of any one color to your mana pool, where X is the number of Elves on the battlefield", true); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/worldwake/HarabazDruid.java b/Mage.Sets/src/mage/sets/worldwake/HarabazDruid.java index 0905f4d8150..6150dcd02b7 100644 --- a/Mage.Sets/src/mage/sets/worldwake/HarabazDruid.java +++ b/Mage.Sets/src/mage/sets/worldwake/HarabazDruid.java @@ -30,6 +30,7 @@ package mage.sets.worldwake; import java.util.UUID; import mage.MageInt; import mage.Mana; +import mage.abilities.costs.common.TapSourceCost; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.mana.DynamicManaAbility; import mage.cards.CardImpl; @@ -61,8 +62,8 @@ public class HarabazDruid extends CardImpl { this.toughness = new MageInt(1); // {T}: Add X mana of any one color to your mana pool, where X is the number of Allies you control. - this.addAbility(new DynamicManaAbility(new Mana(0,0,0,0,0,0,1), new PermanentsOnBattlefieldCount(filter), - "Add X mana of any one color to your mana pool, where X is the number of Allies you control")); + this.addAbility(new DynamicManaAbility(new Mana(0,0,0,0,0,0,1), new PermanentsOnBattlefieldCount(filter), new TapSourceCost(), + "Add X mana of any one color to your mana pool, where X is the number of Allies you control", true)); } public HarabazDruid(final HarabazDruid card) { diff --git a/Mage/src/mage/abilities/effects/common/DynamicManaEffect.java b/Mage/src/mage/abilities/effects/common/DynamicManaEffect.java index 14fb26fce33..7747f360756 100644 --- a/Mage/src/mage/abilities/effects/common/DynamicManaEffect.java +++ b/Mage/src/mage/abilities/effects/common/DynamicManaEffect.java @@ -45,6 +45,7 @@ public class DynamicManaEffect extends BasicManaEffect { private final Mana computedMana; private final DynamicValue amount; private String text = null; + private boolean oneChoice; public DynamicManaEffect(Mana mana, DynamicValue amount) { super(mana); @@ -53,10 +54,22 @@ public class DynamicManaEffect extends BasicManaEffect { } public DynamicManaEffect(Mana mana, DynamicValue amount, String text) { + this(mana, amount, text, false); + } + + /** + * + * @param mana + * @param amount + * @param text + * @param oneChoice is all mana from the same colour or if false the player can choose different colours + */ + public DynamicManaEffect(Mana mana, DynamicValue amount, String text, boolean oneChoice) { super(mana); this.amount = amount; computedMana = new Mana(); this.text = text; + this.oneChoice = oneChoice; } public DynamicManaEffect(final DynamicManaEffect effect) { @@ -64,6 +77,7 @@ public class DynamicManaEffect extends BasicManaEffect { this.computedMana = effect.computedMana.copy(); this.amount = effect.amount.copy(); this.text = effect.text; + this.oneChoice = effect.oneChoice; } @Override @@ -111,11 +125,13 @@ public class DynamicManaEffect extends BasicManaEffect { } else { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { + ChoiceColor choiceColor = new ChoiceColor(); for(int i = 0; i < count; i++){ - ChoiceColor choiceColor = new ChoiceColor(); - while (!controller.choose(Outcome.Benefit, choiceColor, game)) { - if (!controller.isInGame()) { - return computedMana; + if (!choiceColor.isChosen()) { + while (!controller.choose(Outcome.Benefit, choiceColor, game)) { + if (!controller.isInGame()) { + return computedMana; + } } } if (choiceColor.getColor().isBlack()) { @@ -129,6 +145,9 @@ public class DynamicManaEffect extends BasicManaEffect { } else if (choiceColor.getColor().isWhite()) { computedMana.addWhite(); } + if (!oneChoice) { + choiceColor.clearChoice(); + } } } } diff --git a/Mage/src/mage/abilities/mana/DynamicManaAbility.java b/Mage/src/mage/abilities/mana/DynamicManaAbility.java index f421fa8a233..72336b74e08 100644 --- a/Mage/src/mage/abilities/mana/DynamicManaAbility.java +++ b/Mage/src/mage/abilities/mana/DynamicManaAbility.java @@ -70,10 +70,15 @@ public class DynamicManaAbility extends ManaAbility { } public DynamicManaAbility(Mana mana, DynamicValue amount, Cost cost, String text) { - super(Zone.BATTLEFIELD, new DynamicManaEffect(mana, amount, text), cost); + this(mana, amount, cost, text, false); + } + + public DynamicManaAbility(Mana mana, DynamicValue amount, Cost cost, String text, boolean oneChoice) { + super(Zone.BATTLEFIELD, new DynamicManaEffect(mana, amount, text, oneChoice), cost); manaEffect = (DynamicManaEffect) this.getEffects().get(0); } + public DynamicManaAbility(final DynamicManaAbility ability) { super(ability); manaEffect = ability.manaEffect;