* Some more fixes for ManaOptions #5023

This commit is contained in:
LevelX2 2018-06-24 18:11:17 +02:00
parent 2ec3ebde4c
commit 99cfd86533
6 changed files with 12 additions and 13 deletions

View file

@ -66,11 +66,11 @@ class NykthosShrineToNyxManaAbility extends ActivatedManaAbilityImpl {
@Override @Override
public List<Mana> getNetMana(Game game) { public List<Mana> getNetMana(Game game) {
netMana.clear(); ArrayList<Mana> netManaCopy = new ArrayList<>();
if (game != null) { if (game != null) {
netMana.addAll(((ManaEffect) this.getEffects().get(0)).getNetMana(game, this)); netManaCopy.addAll(((ManaEffect) this.getEffects().get(0)).getNetMana(game, this));
} }
return netMana; return netManaCopy;
} }
} }

View file

@ -1,6 +1,6 @@
package mage.abilities.mana; package mage.abilities.mana;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import mage.Mana; import mage.Mana;
@ -42,6 +42,7 @@ public class CommanderColorIdentityManaAbility extends ActivatedManaAbilityImpl
@Override @Override
public List<Mana> getNetMana(Game game) { public List<Mana> getNetMana(Game game) {
List<Mana> netManas = new ArrayList<>();
if (netMana.isEmpty() && game != null) { if (netMana.isEmpty() && game != null) {
Player controller = game.getPlayer(getControllerId()); Player controller = game.getPlayer(getControllerId());
if (controller != null) { if (controller != null) {
@ -68,7 +69,8 @@ public class CommanderColorIdentityManaAbility extends ActivatedManaAbilityImpl
} }
} }
} }
return netMana; netManas.addAll(netMana);
return netManas;
} }
@Override @Override

View file

@ -33,8 +33,6 @@ public class ConditionalManaAbility extends ActivatedManaAbilityImpl {
@Override @Override
public List<Mana> getNetMana(Game game) { public List<Mana> getNetMana(Game game) {
List<Mana> newNetMana = new ArrayList<>(); return new ArrayList<>(conditionalManaEffect.getNetMana(game, this));
newNetMana.addAll(conditionalManaEffect.getNetMana(game, this));
return newNetMana;
} }
} }

View file

@ -53,7 +53,7 @@ public class ManaOptions extends ArrayList<Mana> {
boolean hasTapCost = hasTapCost(abilities.get(0)); boolean hasTapCost = hasTapCost(abilities.get(0));
for (Mana netMana : netManas) { for (Mana netMana : netManas) {
for (Mana mana : copy) { for (Mana mana : copy) {
if (!hasTapCost || checkTappedForManaReplacement(abilities.get(0), game, netMana)) { if (!hasTapCost /* || checkTappedForManaReplacement(abilities.get(0), game, netMana) */) { // Seems to produce endless iterations so deactivated for now: https://github.com/magefree/mage/issues/5023
Mana newMana = new Mana(); Mana newMana = new Mana();
newMana.add(mana); newMana.add(mana);
newMana.add(netMana); newMana.add(netMana);

View file

@ -1,6 +1,6 @@
package mage.abilities.mana; package mage.abilities.mana;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import mage.Mana; import mage.Mana;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
@ -55,7 +55,7 @@ public class SimpleManaAbility extends ActivatedManaAbilityImpl {
if (predictable) { if (predictable) {
return super.getNetMana(game); return super.getNetMana(game);
} }
return netMana; return new ArrayList<Mana>(netMana);
} }
} }

View file

@ -1,4 +1,3 @@
package mage.abilities.mana; package mage.abilities.mana;
import java.util.ArrayList; import java.util.ArrayList;
@ -54,7 +53,7 @@ public abstract class TriggeredManaAbility extends TriggeredAbilityImpl implemen
} }
return newNetMana; return newNetMana;
} }
return netMana; return new ArrayList<Mana>(netMana);
} }
/** /**