mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
forge-gui-desktop: tests: refactor (format)
Affected namespace: forge.ai.simulation
This commit is contained in:
@@ -319,7 +319,8 @@ public class GameSimulationTest extends SimulationTest {
|
||||
Card manifestedCreature = findCardWithName(simGame, "");
|
||||
AssertJUnit.assertNotNull(manifestedCreature);
|
||||
|
||||
SpellAbility unmanifestSA = findSAWithPrefix(manifestedCreature.getAllPossibleAbilities(p, false), "Unmanifest");
|
||||
SpellAbility unmanifestSA = findSAWithPrefix(manifestedCreature.getAllPossibleAbilities(p, false),
|
||||
"Unmanifest");
|
||||
AssertJUnit.assertNotNull(unmanifestSA);
|
||||
AssertJUnit.assertEquals(2, manifestedCreature.getNetPower());
|
||||
AssertJUnit.assertFalse(manifestedCreature.hasKeyword("Flying"));
|
||||
@@ -327,7 +328,8 @@ public class GameSimulationTest extends SimulationTest {
|
||||
GameSimulator sim2 = createSimulator(simGame, simGame.getPlayers().get(1));
|
||||
Game simGame2 = sim2.getSimulatedGameState();
|
||||
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);
|
||||
|
||||
@@ -452,7 +454,8 @@ public class GameSimulationTest extends SimulationTest {
|
||||
Game simGame = sim.getSimulatedGameState();
|
||||
Card thopterSim = findCardWithName(simGame, ornithoperCardName);
|
||||
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
|
||||
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
|
||||
String bearCardName = "Runeclaw Bear";
|
||||
Game game = initAndCreateGame();
|
||||
@@ -1451,8 +1455,10 @@ public class GameSimulationTest extends SimulationTest {
|
||||
|
||||
@Test
|
||||
public void testBludgeonBrawlLatticeCurse() {
|
||||
// Enchantment Aura are with Mycosynth Lattice turned into Artifact Enchantment - Aura Equipment
|
||||
// Curses can only attach Player, but Equipment can only attach to Creature so it does fall off
|
||||
// Enchantment Aura are with Mycosynth Lattice turned into Artifact Enchantment
|
||||
// - Aura Equipment
|
||||
// Curses can only attach Player, but Equipment can only attach to Creature so
|
||||
// it does fall off
|
||||
Game game = initAndCreateGame();
|
||||
Player p = game.getPlayers().get(0);
|
||||
game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p);
|
||||
@@ -1551,7 +1557,6 @@ public class GameSimulationTest extends SimulationTest {
|
||||
AssertJUnit.assertTrue(dryad.hasKeyword(Keyword.INDESTRUCTIBLE));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testRiotEnchantment() {
|
||||
Game game = initAndCreateGame();
|
||||
@@ -1615,7 +1620,8 @@ public class GameSimulationTest extends SimulationTest {
|
||||
|
||||
@Test
|
||||
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();
|
||||
Player p = game.getPlayers().get(0);
|
||||
@@ -1642,7 +1648,6 @@ public class GameSimulationTest extends SimulationTest {
|
||||
AssertJUnit.assertEquals(3, numZombies);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testTeysaKarlovGitrogMonster() {
|
||||
|
||||
@@ -1752,7 +1757,6 @@ public class GameSimulationTest extends SimulationTest {
|
||||
AssertJUnit.assertEquals(1, simGame.getPlayers().get(0).getZone(ZoneType.Hand).size());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testCloneTransform() {
|
||||
Game game = initAndCreateGame();
|
||||
@@ -1801,7 +1805,7 @@ public class GameSimulationTest extends SimulationTest {
|
||||
AssertJUnit.assertEquals(2, countCardsWithName(simGame, hillGiantName));
|
||||
AssertJUnit.assertEquals(0, countCardsWithName(simGame, terrorName));
|
||||
|
||||
Card clonedOutLaw = (Card)sim.getGameCopier().find(outlaw);
|
||||
Card clonedOutLaw = (Card) sim.getGameCopier().find(outlaw);
|
||||
|
||||
AssertJUnit.assertTrue(clonedOutLaw.isCloned());
|
||||
AssertJUnit.assertTrue(clonedOutLaw.isDoubleFaced());
|
||||
@@ -1822,7 +1826,7 @@ public class GameSimulationTest extends SimulationTest {
|
||||
AssertJUnit.assertEquals(2, countCardsWithName(simGame, hillGiantName));
|
||||
AssertJUnit.assertEquals(0, countCardsWithName(simGame, terrorName));
|
||||
|
||||
Card transformOutLaw = (Card)sim.getGameCopier().find(outlaw);
|
||||
Card transformOutLaw = (Card) sim.getGameCopier().find(outlaw);
|
||||
|
||||
AssertJUnit.assertTrue(transformOutLaw.isCloned());
|
||||
AssertJUnit.assertTrue(transformOutLaw.isDoubleFaced());
|
||||
@@ -1891,8 +1895,12 @@ public class GameSimulationTest extends SimulationTest {
|
||||
Player p = game.getPlayers().get(0);
|
||||
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++) { addCardToZone("Island", p, ZoneType.Battlefield); }
|
||||
for (int i = 0; i < 7; i++) {
|
||||
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 sparkDouble = addCardToZone("Spark Double", p, ZoneType.Hand);
|
||||
@@ -1918,9 +1926,15 @@ public class GameSimulationTest extends SimulationTest {
|
||||
Player p = game.getPlayers().get(0);
|
||||
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++) { addCardToZone("Island", p, ZoneType.Battlefield); }
|
||||
for (int i=0; i<7; i++) { addCardToZone("Forest", p, ZoneType.Battlefield); }
|
||||
for (int i = 0; i < 7; i++) {
|
||||
addCardToZone("Plains", 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);
|
||||
|
||||
@@ -1953,8 +1967,12 @@ public class GameSimulationTest extends SimulationTest {
|
||||
Player p = game.getPlayers().get(0);
|
||||
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++) { addCardToZone("Forest", p, ZoneType.Battlefield); }
|
||||
for (int i = 0; i < 7; i++) {
|
||||
addCardToZone("Swamp", p, ZoneType.Battlefield);
|
||||
}
|
||||
for (int i = 0; i < 7; i++) {
|
||||
addCardToZone("Forest", p, ZoneType.Battlefield);
|
||||
}
|
||||
|
||||
addCardToZone("Basking Rootwalla", p, ZoneType.Graveyard);
|
||||
Card ooze = addCardToZone("Necrotic Ooze", p, ZoneType.Hand);
|
||||
@@ -1978,7 +1996,9 @@ public class GameSimulationTest extends SimulationTest {
|
||||
Player p = game.getPlayers().get(0);
|
||||
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 animate = addCardToZone("Animate Dead", p, ZoneType.Hand);
|
||||
@@ -2026,7 +2046,7 @@ public class GameSimulationTest extends SimulationTest {
|
||||
int score = sim.simulateSpellAbility(saDimirClone).value;
|
||||
AssertJUnit.assertTrue(score > 0);
|
||||
|
||||
Card dimirdgAfterCopy1 = (Card)sim.getGameCopier().find(dimirdg);
|
||||
Card dimirdgAfterCopy1 = (Card) sim.getGameCopier().find(dimirdg);
|
||||
AssertJUnit.assertEquals("Jushi Apprentice", dimirdgAfterCopy1.getName());
|
||||
AssertJUnit.assertEquals(1, dimirdgAfterCopy1.getNetPower());
|
||||
AssertJUnit.assertEquals(2, dimirdgAfterCopy1.getNetToughness());
|
||||
@@ -2034,13 +2054,13 @@ public class GameSimulationTest extends SimulationTest {
|
||||
AssertJUnit.assertFalse(dimirdgAfterCopy1.isFlipped());
|
||||
AssertJUnit.assertFalse(dimirdgAfterCopy1.getType().isLegendary());
|
||||
|
||||
bear = (Card)sim.getGameCopier().find(bear);
|
||||
bear = (Card) sim.getGameCopier().find(bear);
|
||||
|
||||
// make new simulator so new SpellAbility is found
|
||||
Game simGame = sim.getSimulatedGameState();
|
||||
sim = createSimulator(simGame, p);
|
||||
|
||||
Player copiedPlayer = (Player)sim.getGameCopier().find(p);
|
||||
Player copiedPlayer = (Player) sim.getGameCopier().find(p);
|
||||
int handSize = copiedPlayer.getCardsIn(ZoneType.Hand).size();
|
||||
AssertJUnit.assertEquals(9, handSize);
|
||||
|
||||
@@ -2048,23 +2068,23 @@ public class GameSimulationTest extends SimulationTest {
|
||||
score = sim.simulateSpellAbility(draw).value;
|
||||
AssertJUnit.assertTrue(score > 0);
|
||||
|
||||
copiedPlayer = (Player)sim.getGameCopier().find(p);
|
||||
copiedPlayer = (Player) sim.getGameCopier().find(p);
|
||||
handSize = copiedPlayer.getCardsIn(ZoneType.Hand).size();
|
||||
AssertJUnit.assertEquals(10, handSize);
|
||||
|
||||
simGame = sim.getSimulatedGameState();
|
||||
|
||||
bear = (Card)sim.getGameCopier().find(bear);
|
||||
bear = (Card) sim.getGameCopier().find(bear);
|
||||
|
||||
// make new simulator so new SpellAbility is found
|
||||
simGame = sim.getSimulatedGameState();
|
||||
sim = createSimulator(simGame, p);
|
||||
|
||||
//bear = (Card)sim.getGameCopier().find(bear);
|
||||
// bear = (Card)sim.getGameCopier().find(bear);
|
||||
|
||||
simGame = sim.getSimulatedGameState();
|
||||
|
||||
Card dimirdgAfterFlip1 = (Card)sim.getGameCopier().find(dimirdgAfterCopy1);
|
||||
Card dimirdgAfterFlip1 = (Card) sim.getGameCopier().find(dimirdgAfterCopy1);
|
||||
|
||||
AssertJUnit.assertEquals("Tomoya the Revealer", dimirdgAfterFlip1.getName());
|
||||
AssertJUnit.assertEquals(2, dimirdgAfterFlip1.getNetPower());
|
||||
@@ -2080,9 +2100,9 @@ public class GameSimulationTest extends SimulationTest {
|
||||
score = sim.simulateSpellAbility(saDimirClone).value;
|
||||
AssertJUnit.assertTrue(score > 0);
|
||||
|
||||
Card dimirdgAfterCopy2 = (Card)sim.getGameCopier().find(dimirdgAfterCopy1);
|
||||
Card dimirdgAfterCopy2 = (Card) sim.getGameCopier().find(dimirdgAfterCopy1);
|
||||
|
||||
//System.out.println(sim.getSimulatedGameState().getCardsIn(ZoneType.Battlefield));
|
||||
// System.out.println(sim.getSimulatedGameState().getCardsIn(ZoneType.Battlefield));
|
||||
|
||||
System.out.println(dimirdgAfterCopy2.getName());
|
||||
System.out.println(dimirdgAfterCopy2.getCloneStates());
|
||||
@@ -2331,7 +2351,8 @@ public class GameSimulationTest extends SimulationTest {
|
||||
AssertJUnit.assertEquals(1, simPridemate.getToughnessBonusFromCounters());
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ public class SpellAbilityPickerSimulationTest extends SimulationTest {
|
||||
|
||||
SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
|
||||
SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
|
||||
//assertEquals(game.PLAY_LAND_SURROGATE, sa);
|
||||
// assertEquals(game.PLAY_LAND_SURROGATE, sa);
|
||||
AssertJUnit.assertEquals(mountain, sa.getHostCard());
|
||||
|
||||
Plan plan = picker.getPlan();
|
||||
@@ -109,7 +109,8 @@ public class SpellAbilityPickerSimulationTest extends SimulationTest {
|
||||
SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
|
||||
SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
|
||||
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
|
||||
@@ -279,7 +280,8 @@ public class SpellAbilityPickerSimulationTest extends SimulationTest {
|
||||
Plan plan = picker.getPlan();
|
||||
AssertJUnit.assertEquals(3, plan.getDecisions().size());
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user