reworked mana text generation to fit canonical symbol order

This commit is contained in:
Evan Kranzler 2021-08-23 18:32:21 -04:00
parent b21d85826c
commit 8fe0467893
7 changed files with 165 additions and 127 deletions

View file

@ -87,7 +87,7 @@ public class SasayaOrochiAscendantTest extends CardTestPlayerBase {
Assert.assertEquals("mana variations don't fit", 3, manaOptions.size());
assertManaOptions("{C}{C}{C}{G}{G}", manaOptions);
assertManaOptions("{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{W}{W}{W}{G}{G}", manaOptions);
assertManaOptions("{G}{G}{W}{W}{W}", manaOptions);
}

View file

@ -86,59 +86,59 @@ public class DoublingCubeTest extends CardTestPlayerBase {
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
Assert.assertEquals("mana variations don't fit", 138, manaOptions.size());
assertManaOptions("{C}{C}{C}{C}{C}{C}{C}{C}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{C}{C}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{C}{C}{C}{C}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{C}{C}{C}{C}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{C}{C}{C}{C}{R}{R}{R}{R}{R}{R}{R}{R}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{C}{C}{C}{C}{R}{R}{R}{R}{R}{R}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{C}{C}{C}{C}{R}{R}{R}{R}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{C}{C}{C}{C}{R}{R}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{C}{C}{C}{C}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{R}{R}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{B}{B}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{R}{R}{R}{R}{R}{R}{R}{R}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{B}{B}{R}{R}{R}{R}{R}{R}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{B}{B}{R}{R}{R}{R}{R}{R}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{R}{R}{R}{R}{R}{R}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{R}{R}{R}{R}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{B}{B}{R}{R}{R}{R}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{B}{B}{R}{R}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{B}{B}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{U}{U}{R}{R}{R}{R}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{U}{U}{U}{U}{R}{R}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{U}{U}{R}{R}{R}{R}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{U}{U}{R}{R}{R}{R}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{U}{U}{U}{U}{R}{R}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{U}{U}{U}{U}{R}{R}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{U}{U}{R}{R}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{U}{U}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{U}{U}{U}{U}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{B}{B}{R}{R}{R}{R}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{B}{B}{B}{B}{R}{R}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{B}{B}{R}{R}{R}{R}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{B}{B}{R}{R}{R}{R}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{B}{B}{B}{B}{R}{R}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{B}{B}{B}{B}{R}{R}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{B}{B}{R}{R}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{B}{B}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{B}{B}{B}{B}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{U}{U}{B}{B}{R}{R}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{U}{U}{U}{U}{B}{B}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{U}{U}{B}{B}{B}{B}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{U}{U}{U}{U}{B}{B}{B}{B}{R}{R}", manaOptions);
assertManaOptions("{U}{U}{B}{B}{R}{R}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{U}{U}{B}{B}{R}{R}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{U}{U}{U}{U}{B}{B}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{U}{U}{U}{U}{B}{B}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{U}{U}{B}{B}{B}{B}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{U}{U}{B}{B}{B}{B}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{U}{U}{U}{U}{B}{B}{B}{B}{G}{G}", manaOptions);
assertManaOptions("{U}{U}{B}{B}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{U}{U}{U}{U}{U}{U}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{C}{C}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{C}{C}{C}{C}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{C}{C}{C}{C}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{C}{C}{C}{C}{R}{R}{R}{R}{R}{R}{R}{R}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{C}{C}{C}{C}{R}{R}{R}{R}{R}{R}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{C}{C}{C}{C}{R}{R}{R}{R}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{C}{C}{C}{C}{R}{R}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{C}{C}{C}{C}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{R}{R}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{B}{B}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{R}{R}{R}{R}{R}{R}{R}{R}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{R}{R}{R}{R}{R}{R}{R}{R}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{B}{B}{R}{R}{R}{R}{R}{R}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{B}{B}{R}{R}{R}{R}{R}{R}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{R}{R}{R}{R}{R}{R}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{R}{R}{R}{R}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{B}{B}{R}{R}{R}{R}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{B}{B}{R}{R}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{B}{B}{B}{B}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{U}{U}{R}{R}{R}{R}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{U}{U}{U}{U}{R}{R}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{G}{G}{U}{U}{R}{R}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{G}{G}{G}{G}{U}{U}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{G}{G}{U}{U}{U}{U}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{G}{G}{G}{G}{U}{U}{U}{U}{R}{R}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{G}{G}{G}{G}{G}{G}{U}{U}{R}{R}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{G}{G}{G}{G}{G}{G}{G}{G}{U}{U}", manaOptions);
assertManaOptions("{C}{C}{C}{C}{G}{G}{G}{G}{G}{G}{U}{U}{U}{U}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{B}{B}{R}{R}{R}{R}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{B}{B}{B}{B}{R}{R}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{B}{B}{R}{R}{R}{R}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{B}{B}{R}{R}{R}{R}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{B}{B}{B}{B}{R}{R}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{B}{B}{B}{B}{R}{R}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{B}{B}{R}{R}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{B}{B}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{B}{B}{B}{B}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{U}{U}{B}{B}{R}{R}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{U}{U}{U}{U}{B}{B}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{U}{U}{B}{B}{B}{B}{R}{R}{R}{R}", manaOptions);
assertManaOptions("{U}{U}{U}{U}{B}{B}{B}{B}{R}{R}", manaOptions);
assertManaOptions("{U}{U}{B}{B}{R}{R}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{U}{U}{B}{B}{R}{R}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{U}{U}{U}{U}{B}{B}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{B}{B}{G}{G}{G}{G}{U}{U}{U}{U}", manaOptions);
assertManaOptions("{U}{U}{B}{B}{B}{B}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{G}{G}{G}{G}{U}{U}", manaOptions);
assertManaOptions("{B}{B}{B}{B}{G}{G}{U}{U}{U}{U}", manaOptions);
assertManaOptions("{B}{B}{G}{G}{G}{G}{G}{G}{U}{U}", manaOptions);
assertManaOptions("{U}{U}{U}{U}{U}{U}", manaOptions);
}
}

View file

@ -224,15 +224,15 @@ public class NonTappingManaAbilitiesTest extends CardTestPlayerBase {
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
Assert.assertEquals("mana variations don't fit", 9, manaOptions.size());
assertManaOptions("{C}{U}{U}{U}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{C}{U}{U}{U}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{U}{U}{U}{R}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{U}{U}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{U}{U}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{C}{U}{U}{R}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{W}{U}{U}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{C}{W}{U}{U}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{W}{U}{U}{R}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{G}{G}{U}{U}{U}{R}{R}", manaOptions);
assertManaOptions("{C}{G}{G}{G}{G}{U}{U}{U}", manaOptions);
assertManaOptions("{C}{G}{G}{G}{U}{U}{U}{R}", manaOptions);
assertManaOptions("{C}{C}{G}{G}{U}{U}{R}{R}", manaOptions);
assertManaOptions("{C}{C}{G}{G}{G}{G}{U}{U}", manaOptions);
assertManaOptions("{C}{C}{G}{G}{G}{U}{U}{R}", manaOptions);
assertManaOptions("{C}{R}{R}{G}{G}{W}{U}{U}", manaOptions);
assertManaOptions("{C}{G}{G}{G}{G}{W}{U}{U}", manaOptions);
assertManaOptions("{C}{R}{G}{G}{G}{W}{U}{U}", manaOptions);
}
@Test

View file

@ -151,12 +151,12 @@ public class ReflectingPoolTest extends CardTestPlayerBase {
ManaOptions options = playerA.getAvailableManaTest(currentGame);
Assert.assertEquals("Player A should be able to create only 3 different mana options", 3, options.size());
assertManaOptions("{G}{G}{G}", options);
assertManaOptions("{W}{G}{G}", options);
assertManaOptions("{W}{W}{G}", options);
assertManaOptions("{G}{G}{W}", options);
assertManaOptions("{G}{W}{W}", options);
options = playerB.getAvailableManaTest(currentGame);
Assert.assertEquals("Player B should be able to create only 2 different mana options", 2, options.size());
assertManaOptions("{W}{G}", options);
assertManaOptions("{G}{W}", options);
assertManaOptions("{W}{W}", options);
}

View file

@ -27,7 +27,7 @@ public class SylvokExplorerTest extends CardTestPlayerBase {
assertAllCommandsUsed();
ManaOptions options = playerA.getAvailableManaTest(currentGame);
Assert.assertEquals("Player should be able to create 1 red and 1 white mana", "{W}{R}", options.get(0).toString());
Assert.assertEquals("Player should be able to create 1 red and 1 white mana", "{R}{W}", options.get(0).toString());
Assert.assertEquals("Player should be able to create 1 blue and 1 white mana", "{W}{U}", options.get(1).toString());
}

View file

@ -7,7 +7,9 @@ import mage.counters.CounterType;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
import static org.mage.test.utils.ManaOptionsTestUtils.*;
import static org.mage.test.utils.ManaOptionsTestUtils.assertDuplicatedManaOptions;
import static org.mage.test.utils.ManaOptionsTestUtils.assertManaOptions;
/**
* This test checks if the calculated possible mana options are correct related
@ -47,9 +49,9 @@ public class ManaOptionsTest extends CardTestPlayerBase {
Assert.assertEquals("mana variations don't fit", 4, manaOptions.size());
assertManaOptions("{G}{G}{G}", manaOptions);
assertManaOptions("{W}{R}{G}{G}", manaOptions);
assertManaOptions("{W}{W}{R}{R}{G}", manaOptions);
assertManaOptions("{W}{W}{W}{R}{R}{R}", manaOptions);
assertManaOptions("{R}{G}{G}{W}", manaOptions);
assertManaOptions("{R}{R}{G}{W}{W}", manaOptions);
assertManaOptions("{R}{R}{R}{W}{W}{W}", manaOptions);
}
@ -130,7 +132,7 @@ public class ManaOptionsTest extends CardTestPlayerBase {
assertDuplicatedManaOptions(manaOptions);
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
assertManaOptions("{C}{W}{W}{G}{G}", manaOptions);
assertManaOptions("{C}{G}{G}{W}{W}", manaOptions);
}
// Crystal Quarry
@ -149,7 +151,7 @@ public class ManaOptionsTest extends CardTestPlayerBase {
assertDuplicatedManaOptions(manaOptions);
Assert.assertEquals("mana variations don't fit", 2, manaOptions.size());
assertManaOptions("{C}{W}{W}{G}{G}{G}", manaOptions);
assertManaOptions("{C}{G}{G}{G}{W}{W}", manaOptions);
assertManaOptions("{W}{U}{B}{R}{G}", manaOptions);
}
@ -172,7 +174,7 @@ public class ManaOptionsTest extends CardTestPlayerBase {
Assert.assertEquals("mana variations don't fit", 3, manaOptions.size());
assertManaOptions("{C}{G}{G}{G}", manaOptions);
assertManaOptions("{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{W}{W}{W}{W}{G}", manaOptions);
assertManaOptions("{G}{W}{W}{W}{W}", manaOptions);
}
@Test
@ -268,7 +270,7 @@ public class ManaOptionsTest extends CardTestPlayerBase {
assertDuplicatedManaOptions(manaOptions);
Assert.assertEquals("mana variations don't fit", 3, manaOptions.size());
assertManaOptions("{W}{W}{G}", manaOptions);
assertManaOptions("{G}{W}{W}", manaOptions);
assertManaOptions("{C}{G}{G}{G}", manaOptions);
assertManaOptions("{G}{G}{G}{G}{G}", manaOptions);
}
@ -279,7 +281,7 @@ public class ManaOptionsTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 4); // Creature {1}{W}
addCard(Zone.BATTLEFIELD, playerA, "Nykthos, Shrine to Nyx", 1); // Land
addCard(Zone.BATTLEFIELD, playerA, "Radha, Heart of Keld");
addCard(Zone.BATTLEFIELD, playerA, "Precognition Field");
addCard(Zone.BATTLEFIELD, playerA, "Mystic Forge");
@ -299,10 +301,10 @@ public class ManaOptionsTest extends CardTestPlayerBase {
Assert.assertEquals("mana variations don't fit", 6, manaOptions.size());
assertManaOptions("{C}{G}{G}{G}", manaOptions);
assertManaOptions("{G}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{W}{W}{W}{W}{W}{W}{G}", manaOptions);
assertManaOptions("{G}{W}{W}{W}{W}{W}{W}", manaOptions);
assertManaOptions("{R}{R}{R}{G}", manaOptions);
assertManaOptions("{B}{B}{B}{G}", manaOptions);
assertManaOptions("{U}{U}{G}", manaOptions);
assertManaOptions("{G}{U}{U}", manaOptions);
}
@Test
@ -356,7 +358,7 @@ public class ManaOptionsTest extends CardTestPlayerBase {
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
Assert.assertEquals("mana variations don't fit", 3, manaOptions.size());
assertDuplicatedManaOptions(manaOptions);
assertManaOptions("{C}{C}", manaOptions);
assertManaOptions("{C}{C}", manaOptions);
assertManaOptions("{Any}{Any}", manaOptions);
assertManaOptions("{C}{Any}", manaOptions);
}
@ -563,7 +565,7 @@ public class ManaOptionsTest extends CardTestPlayerBase {
Assert.assertEquals("mana variations don't fit", 2, manaOptions.size());
assertManaOptions("{W}{G}{Any}", manaOptions);
assertManaOptions("{G}{W}{Any}", manaOptions);
assertManaOptions("{Any}{Any}", manaOptions);
}
@ -584,8 +586,8 @@ public class ManaOptionsTest extends CardTestPlayerBase {
Assert.assertEquals("mana variations don't fit", 88, manaOptions.size());
assertManaOptions("{W}{W}{W}{W}{W}{W}{W}{W}{W}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{W}{W}{W}{W}{W}{W}{W}{W}{U}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{G}{G}{G}{G}{G}{G}{G}{G}{W}{W}{W}{W}{W}{W}{W}{W}{W}", manaOptions);
assertManaOptions("{G}{G}{G}{G}{G}{G}{G}{G}{W}{W}{W}{W}{W}{W}{W}{W}{U}", manaOptions);
}
@Test
@ -605,9 +607,9 @@ public class ManaOptionsTest extends CardTestPlayerBase {
Assert.assertEquals("mana variations don't fit", 4, manaOptions.size());
assertManaOptions("{U}{U}", manaOptions);
assertManaOptions("{W}{G}{G}", manaOptions);
assertManaOptions("{W}{U}{G}", manaOptions);
assertManaOptions("{W}{W}{G}", manaOptions);
assertManaOptions("{G}{G}{W}", manaOptions);
assertManaOptions("{G}{W}{U}", manaOptions);
assertManaOptions("{G}{W}{W}", manaOptions);
}
}

View file

@ -8,6 +8,8 @@ import mage.util.Copyable;
import org.apache.log4j.Logger;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
@ -538,6 +540,60 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
any = 0;
}
private static final Map<String, String> colorLetterMap = new HashMap<>();
static {
colorLetterMap.put("wr", "rw");
colorLetterMap.put("wg", "gw");
colorLetterMap.put("ug", "gu");
colorLetterMap.put("wrg", "rgw");
colorLetterMap.put("wug", "gwu");
colorLetterMap.put("wur", "urw");
colorLetterMap.put("urg", "gur");
colorLetterMap.put("ubg", "bgu");
colorLetterMap.put("wbr", "rwb");
colorLetterMap.put("wbrg", "brgw");
colorLetterMap.put("wurg", "rgwu");
colorLetterMap.put("wubg", "gwub");
}
private String getColorsInOrder() {
StringBuilder sb = new StringBuilder();
if (white > 0) {
sb.append('w');
}
if (blue > 0) {
sb.append('u');
}
if (black > 0) {
sb.append('b');
}
if (red > 0) {
sb.append('r');
}
if (green > 0) {
sb.append('g');
}
String manaString = sb.toString();
return colorLetterMap.getOrDefault(manaString, manaString);
}
private int colorCharToAmount(char color) {
switch (color) {
case 'w':
return white;
case 'u':
return blue;
case 'b':
return black;
case 'r':
return red;
case 'g':
return green;
}
return 0;
}
/**
* Returns this objects values as a {@link String}.
*
@ -549,54 +605,34 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
if (generic > 0) {
sbMana.append('{').append(generic).append('}');
}
// too many mana - replace by single icon
if (colorless >= 20) {
// normal mana
if (colorless < 20) {
for (int i = 0; i < colorless; i++) {
sbMana.append("{C}");
}
} else {
sbMana.append(colorless).append("{C}");
}
if (white >= 20) {
sbMana.append(white).append("{W}");
String colorsInOrder = getColorsInOrder();
for (char c : colorsInOrder.toCharArray()) {
int amount = colorCharToAmount(c);
if (amount < 20) {
for (int i = 0; i < amount; i++) {
sbMana.append('{').append(c).append('}');
}
} else {
sbMana.append(amount).append('{').append(c).append('}');
}
}
if (blue >= 20) {
sbMana.append(blue).append("{U}");
}
if (black >= 20) {
sbMana.append(black).append("{B}");
}
if (red >= 20) {
sbMana.append(red).append("{R}");
}
if (green >= 20) {
sbMana.append(green).append("{G}");
}
if (any >= 20) {
if (any < 20) {
for (int i = 0; i < any; i++) {
sbMana.append("{Any}");
}
} else {
sbMana.append(any).append("{Any}");
}
// normal mana
for (int i = 0; i < colorless && colorless < 20; i++) {
sbMana.append("{C}");
}
for (int i = 0; i < white && white < 20; i++) {
sbMana.append("{W}");
}
for (int i = 0; i < blue && blue < 20; i++) {
sbMana.append("{U}");
}
for (int i = 0; i < black && black < 20; i++) {
sbMana.append("{B}");
}
for (int i = 0; i < red && red < 20; i++) {
sbMana.append("{R}");
}
for (int i = 0; i < green && green < 20; i++) {
sbMana.append("{G}");
}
for (int i = 0; i < any && any < 20; i++) {
sbMana.append("{Any}");
}
return sbMana.toString();
return sbMana.toString().toUpperCase().replace("ANY", "Any");
}
/**