mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Fixed a bug in CreatureCastManaCondition leading to an endless loop. Improved ConditionalAnyColorManaAbility to use also with one choice but X mana.
This commit is contained in:
parent
073e4f7748
commit
3a90fbb49c
2 changed files with 14 additions and 4 deletions
|
@ -47,8 +47,19 @@ public class ConditionalAnyColorManaAbility extends ManaAbility<ConditionalAnyCo
|
|||
}
|
||||
|
||||
public ConditionalAnyColorManaAbility(Cost cost, int amount, ConditionalManaBuilder manaBuilder) {
|
||||
super(Constants.Zone.BATTLEFIELD, new AddConditionalManaOfAnyColorEffect(amount, manaBuilder), cost);
|
||||
for (int i = 0; i < amount; i++) {
|
||||
this(cost, amount, manaBuilder, false);
|
||||
}
|
||||
|
||||
public ConditionalAnyColorManaAbility(Cost cost, int amount, ConditionalManaBuilder manaBuilder, boolean oneChoice) {
|
||||
super(Constants.Zone.BATTLEFIELD, new AddConditionalManaOfAnyColorEffect(oneChoice ? 1 :amount, manaBuilder), cost);
|
||||
int choices = amount;
|
||||
if (oneChoice) {
|
||||
for (int i = 1; i < amount; i++) {
|
||||
this.addEffect(new AddConditionalManaOfAnyColorEffect(1 , manaBuilder));
|
||||
}
|
||||
choices = 1;
|
||||
}
|
||||
for (int i = 0; i < choices; i++) {
|
||||
this.addChoice(new ChoiceColor());
|
||||
}
|
||||
this.netMana.setAny(amount);
|
||||
|
@ -63,4 +74,3 @@ public class ConditionalAnyColorManaAbility extends ManaAbility<ConditionalAnyCo
|
|||
return new ConditionalAnyColorManaAbility(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,6 @@ public class CreatureCastManaCondition extends ManaCondition implements Conditio
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, UUID originalId) {
|
||||
return apply(game, source, null);
|
||||
return apply(game, source);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue