1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-13 01:01:11 -09:00

* 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
Mage.Sets/src/mage/sets
Mage/src/mage/abilities

View file

@ -30,6 +30,7 @@ package mage.sets.legions;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.Mana; import mage.Mana;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.mana.DynamicManaAbility; import mage.abilities.mana.DynamicManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -61,8 +62,8 @@ public class WirewoodChanneler extends CardImpl {
this.toughness = new MageInt(2); 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. // {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), 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"); "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); this.addAbility(ability);
} }

View file

@ -30,6 +30,7 @@ package mage.sets.worldwake;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.Mana; import mage.Mana;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.mana.DynamicManaAbility; import mage.abilities.mana.DynamicManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -61,8 +62,8 @@ public class HarabazDruid extends CardImpl {
this.toughness = new MageInt(1); 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. // {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), 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")); "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) { public HarabazDruid(final HarabazDruid card) {

View file

@ -45,6 +45,7 @@ public class DynamicManaEffect extends BasicManaEffect {
private final Mana computedMana; private final Mana computedMana;
private final DynamicValue amount; private final DynamicValue amount;
private String text = null; private String text = null;
private boolean oneChoice;
public DynamicManaEffect(Mana mana, DynamicValue amount) { public DynamicManaEffect(Mana mana, DynamicValue amount) {
super(mana); super(mana);
@ -53,10 +54,22 @@ public class DynamicManaEffect extends BasicManaEffect {
} }
public DynamicManaEffect(Mana mana, DynamicValue amount, String text) { 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); super(mana);
this.amount = amount; this.amount = amount;
computedMana = new Mana(); computedMana = new Mana();
this.text = text; this.text = text;
this.oneChoice = oneChoice;
} }
public DynamicManaEffect(final DynamicManaEffect effect) { public DynamicManaEffect(final DynamicManaEffect effect) {
@ -64,6 +77,7 @@ public class DynamicManaEffect extends BasicManaEffect {
this.computedMana = effect.computedMana.copy(); this.computedMana = effect.computedMana.copy();
this.amount = effect.amount.copy(); this.amount = effect.amount.copy();
this.text = effect.text; this.text = effect.text;
this.oneChoice = effect.oneChoice;
} }
@Override @Override
@ -111,11 +125,13 @@ public class DynamicManaEffect extends BasicManaEffect {
} else { } else {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
ChoiceColor choiceColor = new ChoiceColor();
for(int i = 0; i < count; i++){ for(int i = 0; i < count; i++){
ChoiceColor choiceColor = new ChoiceColor(); if (!choiceColor.isChosen()) {
while (!controller.choose(Outcome.Benefit, choiceColor, game)) { while (!controller.choose(Outcome.Benefit, choiceColor, game)) {
if (!controller.isInGame()) { if (!controller.isInGame()) {
return computedMana; return computedMana;
}
} }
} }
if (choiceColor.getColor().isBlack()) { if (choiceColor.getColor().isBlack()) {
@ -129,6 +145,9 @@ public class DynamicManaEffect extends BasicManaEffect {
} else if (choiceColor.getColor().isWhite()) { } else if (choiceColor.getColor().isWhite()) {
computedMana.addWhite(); 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) { 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); manaEffect = (DynamicManaEffect) this.getEffects().get(0);
} }
public DynamicManaAbility(final DynamicManaAbility ability) { public DynamicManaAbility(final DynamicManaAbility ability) {
super(ability); super(ability);
manaEffect = ability.manaEffect; manaEffect = ability.manaEffect;