forge-gui-desktop: tests: refactor (format)

Affected namespace:
forge.ai.simulation
This commit is contained in:
Leandro Doctors
2022-04-17 03:18:38 -03:00
parent efa45f8889
commit 1a57bee27f
3 changed files with 2207 additions and 2184 deletions

View File

@@ -319,7 +319,8 @@ public class GameSimulationTest extends SimulationTest {
Card manifestedCreature = findCardWithName(simGame, ""); Card manifestedCreature = findCardWithName(simGame, "");
AssertJUnit.assertNotNull(manifestedCreature); AssertJUnit.assertNotNull(manifestedCreature);
SpellAbility unmanifestSA = findSAWithPrefix(manifestedCreature.getAllPossibleAbilities(p, false), "Unmanifest"); SpellAbility unmanifestSA = findSAWithPrefix(manifestedCreature.getAllPossibleAbilities(p, false),
"Unmanifest");
AssertJUnit.assertNotNull(unmanifestSA); AssertJUnit.assertNotNull(unmanifestSA);
AssertJUnit.assertEquals(2, manifestedCreature.getNetPower()); AssertJUnit.assertEquals(2, manifestedCreature.getNetPower());
AssertJUnit.assertFalse(manifestedCreature.hasKeyword("Flying")); AssertJUnit.assertFalse(manifestedCreature.hasKeyword("Flying"));
@@ -327,7 +328,8 @@ public class GameSimulationTest extends SimulationTest {
GameSimulator sim2 = createSimulator(simGame, simGame.getPlayers().get(1)); GameSimulator sim2 = createSimulator(simGame, simGame.getPlayers().get(1));
Game simGame2 = sim2.getSimulatedGameState(); Game simGame2 = sim2.getSimulatedGameState();
manifestedCreature = findCardWithName(simGame2, ""); manifestedCreature = findCardWithName(simGame2, "");
unmanifestSA = findSAWithPrefix(manifestedCreature.getAllPossibleAbilities(simGame2.getPlayers().get(1), false), "Unmanifest"); unmanifestSA = findSAWithPrefix(manifestedCreature.getAllPossibleAbilities(simGame2.getPlayers().get(1), false),
"Unmanifest");
sim2.simulateSpellAbility(unmanifestSA); sim2.simulateSpellAbility(unmanifestSA);
@@ -452,7 +454,8 @@ public class GameSimulationTest extends SimulationTest {
Game simGame = sim.getSimulatedGameState(); Game simGame = sim.getSimulatedGameState();
Card thopterSim = findCardWithName(simGame, ornithoperCardName); Card thopterSim = findCardWithName(simGame, ornithoperCardName);
Card bearSim = findCardWithName(simGame, bearCardName); Card bearSim = findCardWithName(simGame, bearCardName);
AssertJUnit.assertEquals(3, thopterSim.getCounters(CounterEnumType.P1P1) + bearSim.getCounters(CounterEnumType.P1P1)); AssertJUnit.assertEquals(3,
thopterSim.getCounters(CounterEnumType.P1P1) + bearSim.getCounters(CounterEnumType.P1P1));
} }
} }
@@ -1410,7 +1413,8 @@ public class GameSimulationTest extends SimulationTest {
@Test @Test
public void testBludgeonBrawlLatticeAura() { public void testBludgeonBrawlLatticeAura() {
// Enchantment Aura are with Mycosynth Lattice turned into Artifact Enchantment - Aura Equipment // Enchantment Aura are with Mycosynth Lattice turned into Artifact Enchantment
// - Aura Equipment
// Creature Auras should stay on // Creature Auras should stay on
String bearCardName = "Runeclaw Bear"; String bearCardName = "Runeclaw Bear";
Game game = initAndCreateGame(); Game game = initAndCreateGame();
@@ -1451,8 +1455,10 @@ public class GameSimulationTest extends SimulationTest {
@Test @Test
public void testBludgeonBrawlLatticeCurse() { public void testBludgeonBrawlLatticeCurse() {
// Enchantment Aura are with Mycosynth Lattice turned into Artifact Enchantment - Aura Equipment // Enchantment Aura are with Mycosynth Lattice turned into Artifact Enchantment
// Curses can only attach Player, but Equipment can only attach to Creature so it does fall off // - Aura Equipment
// Curses can only attach Player, but Equipment can only attach to Creature so
// it does fall off
Game game = initAndCreateGame(); Game game = initAndCreateGame();
Player p = game.getPlayers().get(0); Player p = game.getPlayers().get(0);
game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p); game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p);
@@ -1551,7 +1557,6 @@ public class GameSimulationTest extends SimulationTest {
AssertJUnit.assertTrue(dryad.hasKeyword(Keyword.INDESTRUCTIBLE)); AssertJUnit.assertTrue(dryad.hasKeyword(Keyword.INDESTRUCTIBLE));
} }
@Test @Test
public void testRiotEnchantment() { public void testRiotEnchantment() {
Game game = initAndCreateGame(); Game game = initAndCreateGame();
@@ -1615,7 +1620,8 @@ public class GameSimulationTest extends SimulationTest {
@Test @Test
public void testDoubleTeysaKarlovXathridNecromancer() { public void testDoubleTeysaKarlovXathridNecromancer() {
// Teysa Karlov dieing because of Legendary rule will make Xathrid Necromancer trigger 3 times // Teysa Karlov dieing because of Legendary rule will make Xathrid Necromancer
// trigger 3 times
Game game = initAndCreateGame(); Game game = initAndCreateGame();
Player p = game.getPlayers().get(0); Player p = game.getPlayers().get(0);
@@ -1642,7 +1648,6 @@ public class GameSimulationTest extends SimulationTest {
AssertJUnit.assertEquals(3, numZombies); AssertJUnit.assertEquals(3, numZombies);
} }
@Test @Test
public void testTeysaKarlovGitrogMonster() { public void testTeysaKarlovGitrogMonster() {
@@ -1752,7 +1757,6 @@ public class GameSimulationTest extends SimulationTest {
AssertJUnit.assertEquals(1, simGame.getPlayers().get(0).getZone(ZoneType.Hand).size()); AssertJUnit.assertEquals(1, simGame.getPlayers().get(0).getZone(ZoneType.Hand).size());
} }
@Test @Test
public void testCloneTransform() { public void testCloneTransform() {
Game game = initAndCreateGame(); Game game = initAndCreateGame();
@@ -1891,8 +1895,12 @@ public class GameSimulationTest extends SimulationTest {
Player p = game.getPlayers().get(0); Player p = game.getPlayers().get(0);
game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p); game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p);
for (int i=0; i<7; i++) { addCardToZone("Plains", p, ZoneType.Battlefield); } for (int i = 0; i < 7; i++) {
for (int i=0; i<7; i++) { addCardToZone("Island", p, ZoneType.Battlefield); } addCardToZone("Plains", p, ZoneType.Battlefield);
}
for (int i = 0; i < 7; i++) {
addCardToZone("Island", p, ZoneType.Battlefield);
}
Card gideon = addCardToZone("Gideon Blackblade", p, ZoneType.Hand); Card gideon = addCardToZone("Gideon Blackblade", p, ZoneType.Hand);
Card sparkDouble = addCardToZone("Spark Double", p, ZoneType.Hand); Card sparkDouble = addCardToZone("Spark Double", p, ZoneType.Hand);
@@ -1918,9 +1926,15 @@ public class GameSimulationTest extends SimulationTest {
Player p = game.getPlayers().get(0); Player p = game.getPlayers().get(0);
game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p); game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p);
for (int i=0; i<7; i++) { addCardToZone("Plains", p, ZoneType.Battlefield); } for (int i = 0; i < 7; i++) {
for (int i=0; i<7; i++) { addCardToZone("Island", p, ZoneType.Battlefield); } addCardToZone("Plains", p, ZoneType.Battlefield);
for (int i=0; i<7; i++) { addCardToZone("Forest", p, ZoneType.Battlefield); } }
for (int i = 0; i < 7; i++) {
addCardToZone("Island", p, ZoneType.Battlefield);
}
for (int i = 0; i < 7; i++) {
addCardToZone("Forest", p, ZoneType.Battlefield);
}
Card tgtLand = addCardToZone("Wastes", p, ZoneType.Battlefield); Card tgtLand = addCardToZone("Wastes", p, ZoneType.Battlefield);
@@ -1953,8 +1967,12 @@ public class GameSimulationTest extends SimulationTest {
Player p = game.getPlayers().get(0); Player p = game.getPlayers().get(0);
game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p); game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p);
for (int i=0; i<7; i++) { addCardToZone("Swamp", p, ZoneType.Battlefield); } for (int i = 0; i < 7; i++) {
for (int i=0; i<7; i++) { addCardToZone("Forest", p, ZoneType.Battlefield); } addCardToZone("Swamp", p, ZoneType.Battlefield);
}
for (int i = 0; i < 7; i++) {
addCardToZone("Forest", p, ZoneType.Battlefield);
}
addCardToZone("Basking Rootwalla", p, ZoneType.Graveyard); addCardToZone("Basking Rootwalla", p, ZoneType.Graveyard);
Card ooze = addCardToZone("Necrotic Ooze", p, ZoneType.Hand); Card ooze = addCardToZone("Necrotic Ooze", p, ZoneType.Hand);
@@ -1978,7 +1996,9 @@ public class GameSimulationTest extends SimulationTest {
Player p = game.getPlayers().get(0); Player p = game.getPlayers().get(0);
game.getPhaseHandler().devModeSet(PhaseType.MAIN2, p); game.getPhaseHandler().devModeSet(PhaseType.MAIN2, p);
for (int i=0; i<7; i++) { addCardToZone("Swamp", p, ZoneType.Battlefield); } for (int i = 0; i < 7; i++) {
addCardToZone("Swamp", p, ZoneType.Battlefield);
}
Card epo = addCardToZone("Epochrasite", p, ZoneType.Graveyard); Card epo = addCardToZone("Epochrasite", p, ZoneType.Graveyard);
Card animate = addCardToZone("Animate Dead", p, ZoneType.Hand); Card animate = addCardToZone("Animate Dead", p, ZoneType.Hand);
@@ -2331,7 +2351,8 @@ public class GameSimulationTest extends SimulationTest {
AssertJUnit.assertEquals(1, simPridemate.getToughnessBonusFromCounters()); AssertJUnit.assertEquals(1, simPridemate.getToughnessBonusFromCounters());
AssertJUnit.assertEquals(1, simPridemate.getPowerBonusFromCounters()); AssertJUnit.assertEquals(1, simPridemate.getPowerBonusFromCounters());
// 2 times 7 damage with life gain = 14 + 20 = 34 (damage to Stormwild Capridor is prevented) // 2 times 7 damage with life gain = 14 + 20 = 34 (damage to Stormwild Capridor
// is prevented)
AssertJUnit.assertEquals(34, simGame.getPlayers().get(0).getLife()); AssertJUnit.assertEquals(34, simGame.getPlayers().get(0).getLife());
} }

View File

@@ -109,7 +109,8 @@ public class SpellAbilityPickerSimulationTest extends SimulationTest {
SpellAbilityPicker picker = new SpellAbilityPicker(game, p); SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
SpellAbility sa = picker.chooseSpellAbilityToPlay(null); SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
AssertJUnit.assertEquals(spell.getSpellAbilities().get(0), sa); AssertJUnit.assertEquals(spell.getSpellAbilities().get(0), sa);
AssertJUnit.assertEquals("Dromar's Charm -> Target creature gets -2/-2 until end of turn.", picker.getPlan().getDecisions().get(0).modesStr); AssertJUnit.assertEquals("Dromar's Charm -> Target creature gets -2/-2 until end of turn.",
picker.getPlan().getDecisions().get(0).modesStr);
} }
@Test @Test
@@ -279,7 +280,8 @@ public class SpellAbilityPickerSimulationTest extends SimulationTest {
Plan plan = picker.getPlan(); Plan plan = picker.getPlan();
AssertJUnit.assertEquals(3, plan.getDecisions().size()); AssertJUnit.assertEquals(3, plan.getDecisions().size());
AssertJUnit.assertEquals("Play land Mountain", plan.getDecisions().get(1).saRef.toString()); AssertJUnit.assertEquals("Play land Mountain", plan.getDecisions().get(1).saRef.toString());
AssertJUnit.assertEquals("Lightning Bolt deals 3 damage to any target.", plan.getDecisions().get(2).saRef.toString()); AssertJUnit.assertEquals("Lightning Bolt deals 3 damage to any target.",
plan.getDecisions().get(2).saRef.toString());
} }
@Test @Test