From 3f7a259c2fae4f11af89ec57cc34e472e3e3b1aa Mon Sep 17 00:00:00 2001 From: Alex Vasile <48962821+Alex-Vasile@users.noreply.github.com> Date: Wed, 11 May 2022 19:32:11 -0600 Subject: [PATCH] Add fix --- .../AddManaOfTwoDifferentColorsEffect.java | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfTwoDifferentColorsEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfTwoDifferentColorsEffect.java index 5b0aaaadefd..834170cf946 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfTwoDifferentColorsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfTwoDifferentColorsEffect.java @@ -4,6 +4,7 @@ package mage.abilities.effects.mana; import mage.Mana; import mage.abilities.Ability; import mage.choices.ManaChoice; +import mage.constants.ManaType; import mage.game.Game; import mage.players.Player; @@ -12,6 +13,32 @@ import java.util.List; public class AddManaOfTwoDifferentColorsEffect extends ManaEffect { + // Performing this calculation here since it never changes and should not be recalcualted each time. + private static final List colorsToCycle = new ArrayList<>(); + private static final List netMana = new ArrayList<>(); + static { + // Add the colored mana in order to cycle through them + colorsToCycle.add(ManaType.WHITE); + colorsToCycle.add(ManaType.BLUE); + colorsToCycle.add(ManaType.BLACK); + colorsToCycle.add(ManaType.RED); + colorsToCycle.add(ManaType.GREEN); + + // Create the possible combinations of two mana + for (ManaType manaType1 : colorsToCycle) { + for (ManaType manaType2 : colorsToCycle) { + // Mana types must be different + if (manaType1 == manaType2) { + continue; + } + + Mana manaCombo = new Mana(manaType1); + manaCombo.increase(manaType2); + netMana.add(manaCombo); + } + } + } + public AddManaOfTwoDifferentColorsEffect() { super(); staticText = "Add two mana of different colors."; @@ -23,8 +50,6 @@ public class AddManaOfTwoDifferentColorsEffect extends ManaEffect { @Override public List getNetMana(Game game, Ability source) { - List netMana = new ArrayList<>(); - netMana.add(Mana.AnyMana(2)); return netMana; }