* 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

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