[Simulated AI] Test coverage for playing lands.

This commit is contained in:
Myrd
2017-01-08 17:09:38 +00:00
parent 742ef8157b
commit a45e005897

View File

@@ -14,39 +14,59 @@ public class SpellAbilityPickerTest extends SimulationTestCase {
addCard("Mountain", p); addCard("Mountain", p);
addCardToZone("Shock", p, ZoneType.Hand); addCardToZone("Shock", p, ZoneType.Hand);
Player opponent = game.getPlayers().get(0); Player opponent = game.getPlayers().get(0);
addCard("Runeclaw Bear", opponent); addCard("Runeclaw Bear", opponent);
opponent.setLife(2, null); opponent.setLife(2, null);
game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p); game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p);
game.getAction().checkStateEffects(true); game.getAction().checkStateEffects(true);
SpellAbilityPicker picker = new SpellAbilityPicker(game, p); SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
SpellAbility sa = picker.chooseSpellAbilityToPlay(null); SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
assertNotNull(sa); assertNotNull(sa);
assertNull(sa.getTargetCard()); assertNull(sa.getTargetCard());
assertEquals(opponent, sa.getTargets().getFirstTargetedPlayer()); assertEquals(opponent, sa.getTargets().getFirstTargetedPlayer());
} }
public void testPickingKillingCreature() { public void testPickingKillingCreature() {
Game game = initAndCreateGame(); Game game = initAndCreateGame();
Player p = game.getPlayers().get(1); Player p = game.getPlayers().get(1);
addCard("Mountain", p); addCard("Mountain", p);
addCardToZone("Shock", p, ZoneType.Hand); addCardToZone("Shock", p, ZoneType.Hand);
Player opponent = game.getPlayers().get(0); Player opponent = game.getPlayers().get(0);
Card bearCard = addCard("Runeclaw Bear", opponent); Card bearCard = addCard("Runeclaw Bear", opponent);
opponent.setLife(20, null); opponent.setLife(20, null);
game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p); game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p);
game.getAction().checkStateEffects(true); game.getAction().checkStateEffects(true);
SpellAbilityPicker picker = new SpellAbilityPicker(game, p); SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
SpellAbility sa = picker.chooseSpellAbilityToPlay(null); SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
assertNotNull(sa); assertNotNull(sa);
assertEquals(bearCard, sa.getTargetCard()); assertEquals(bearCard, sa.getTargetCard());
assertNull(sa.getTargets().getFirstTargetedPlayer()); assertNull(sa.getTargets().getFirstTargetedPlayer());
} }
public void testSequenceStartingWithPlayingLand() {
Game game = initAndCreateGame();
Player p = game.getPlayers().get(1);
Card mountain = addCardToZone("Mountain", p, ZoneType.Hand);
addCardToZone("Shock", p, ZoneType.Hand);
Player opponent = game.getPlayers().get(0);
addCard("Runeclaw Bear", opponent);
opponent.setLife(20, null);
game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p);
game.getAction().checkStateEffects(true);
SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
assertEquals(game.PLAY_LAND_SURROGATE, sa);
assertEquals(mountain, sa.getHostCard());
}
} }