mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Fix GameSimulatorTest and add a testcase I forgot to add before.
This commit is contained in:
@@ -222,11 +222,12 @@ public class GameCopier {
|
|||||||
}
|
}
|
||||||
if (c.isFaceDown()) {
|
if (c.isFaceDown()) {
|
||||||
boolean isCreature = newCard.isCreature();
|
boolean isCreature = newCard.isCreature();
|
||||||
|
boolean hasManaCost = !newCard.getManaCost().isNoCost();
|
||||||
newCard.setState(CardStateName.FaceDown, true);
|
newCard.setState(CardStateName.FaceDown, true);
|
||||||
if (c.isManifested()) {
|
if (c.isManifested()) {
|
||||||
newCard.setManifested(true);
|
newCard.setManifested(true);
|
||||||
// TODO: Should be able to copy other abilities...
|
// TODO: Should be able to copy other abilities...
|
||||||
if (isCreature && ! newCard.getManaCost().isNoCost()) {
|
if (isCreature && hasManaCost) {
|
||||||
newCard.addSpellAbility(CardFactoryUtil.abilityManifestFaceUp(newCard, newCard.getManaCost()));
|
newCard.addSpellAbility(CardFactoryUtil.abilityManifestFaceUp(newCard, newCard.getManaCost()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class GameSimulator {
|
|||||||
eval.getScoreForGameState(origGame, origAiPlayer);
|
eval.getScoreForGameState(origGame, origAiPlayer);
|
||||||
// Print debug info.
|
// Print debug info.
|
||||||
printDiff(origLines, simLines);
|
printDiff(origLines, simLines);
|
||||||
throw new RuntimeException("Game copy error");
|
throw new RuntimeException("Game copy error. See diff output above for details.");
|
||||||
}
|
}
|
||||||
eval.setDebugging(false);
|
eval.setDebugging(false);
|
||||||
|
|
||||||
|
|||||||
@@ -391,6 +391,32 @@ public class GameSimulatorTest extends TestCase {
|
|||||||
assertNull(findSAWithPrefix(manifestedCreatureCopy, "Unmanifest"));
|
assertNull(findSAWithPrefix(manifestedCreatureCopy, "Unmanifest"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testManifest3() {
|
||||||
|
Game game = initAndCreateGame();
|
||||||
|
Player p = game.getPlayers().get(1);
|
||||||
|
addCard("Plains", p);
|
||||||
|
addCard("Plains", p);
|
||||||
|
Card soulSummons = addCardToZone("Soul Summons", p, ZoneType.Hand);
|
||||||
|
addCardToZone("Dryad Arbor", p, ZoneType.Library);
|
||||||
|
|
||||||
|
game.getPhaseHandler().devModeSet(PhaseType.MAIN2, p);
|
||||||
|
game.getAction().checkStateEffects(true);
|
||||||
|
|
||||||
|
SpellAbility manifestSA = soulSummons.getSpellAbilities().get(0);
|
||||||
|
|
||||||
|
GameSimulator sim = createSimulator(game, p);
|
||||||
|
sim.simulateSpellAbility(manifestSA);
|
||||||
|
Game simGame = sim.getSimulatedGameState();
|
||||||
|
Card manifestedCreature = findCardWithName(simGame, "");
|
||||||
|
assertNotNull(manifestedCreature);
|
||||||
|
assertNull(findSAWithPrefix(manifestedCreature, "Unmanifest"));
|
||||||
|
|
||||||
|
GameCopier copier = new GameCopier(simGame);
|
||||||
|
Game copy = copier.makeCopy();
|
||||||
|
Card manifestedCreatureCopy = findCardWithName(copy, "");
|
||||||
|
assertNull(findSAWithPrefix(manifestedCreatureCopy, "Unmanifest"));
|
||||||
|
}
|
||||||
|
|
||||||
public void testTypeOfPermanentChanging() {
|
public void testTypeOfPermanentChanging() {
|
||||||
String sarkhanCardName = "Sarkhan, the Dragonspeaker";
|
String sarkhanCardName = "Sarkhan, the Dragonspeaker";
|
||||||
Game game = initAndCreateGame();
|
Game game = initAndCreateGame();
|
||||||
|
|||||||
Reference in New Issue
Block a user