* Fixed Wirewood Channeler and Harabaz Druid allowing any combinations of Colors instead if any one color.

This commit is contained in:
LevelX2 2015-04-04 14:58:47 +02:00
parent 2723bf6cb7
commit 03b8a22c43
4 changed files with 35 additions and 9 deletions

View file

@ -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);
}

View file

@ -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) {

View file

@ -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();
}
}
}
}

View file

@ -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;