diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/cost/additional/RevealedOrControlledDragonTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/cost/additional/RevealedOrControlledDragonTest.java index 8a92a892b09..032923abbf0 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/cost/additional/RevealedOrControlledDragonTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/cost/additional/RevealedOrControlledDragonTest.java @@ -4,18 +4,145 @@ import mage.constants.PhaseStep; import mage.constants.Zone; import mage.counters.CounterType; import org.junit.Test; +import org.mage.test.player.TestPlayer; import org.mage.test.serverside.base.CardTestPlayerBase; /** - * @author TheElk801 + * @author TheElk801, xenohedron */ public class RevealedOrControlledDragonTest extends CardTestPlayerBase { private static final String dragon = "Shivan Dragon"; - private static final String roar = "Draconic Roar"; private static final String lion = "Silvercoat Lion"; private static final String orator = "Orator of Ojutai"; private static final String sentinels = "Scaleguard Sentinels"; + private static final String roar = "Draconic Roar"; // 1R + // As an additional cost to cast this spell, you may reveal a Dragon card from your hand. + // Draconic Roar deals 3 damage to target creature. If you revealed a Dragon card or controlled a Dragon + // as you cast this spell, Draconic Roar deals 3 damage to that creature’s controller. + private static final String crab = "Fortress Crab"; // 1/6 for target + private static final String hatchling = "Dragon Hatchling"; // for reveal + private static final String whelp = "Dragon Whelp"; // for battlefield + private static final String vampire = "Bloodthrone Vampire"; // for sac + private static final String hellkite = "Bogardan Hellkite"; // for flash (6RR) + // When Bogardan Hellkite enters the battlefield, it deals 5 damage divided as you choose among any number of targets. + + @Test + public void noDragon() { + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); + addCard(Zone.HAND, playerA, roar); + addCard(Zone.BATTLEFIELD, playerB, crab); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, roar); + addTarget(playerA, crab); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertDamageReceived(playerB, crab, 3); + assertLife(playerB, 20); + } + + @Test + public void chooseNotToReveal() { + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); + addCard(Zone.HAND, playerA, roar); + addCard(Zone.BATTLEFIELD, playerB, crab); + addCard(Zone.HAND, playerA, hatchling); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, roar); + setChoice(playerA, TestPlayer.CHOICE_SKIP); // no reveal + addTarget(playerA, crab); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertDamageReceived(playerB, crab, 3); + assertLife(playerB, 20); + } + + @Test + public void revealDragon() { + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); + addCard(Zone.HAND, playerA, roar); + addCard(Zone.BATTLEFIELD, playerB, crab); + addCard(Zone.HAND, playerA, hatchling); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, roar); + setChoice(playerA, hatchling); // to reveal + addTarget(playerA, crab); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertDamageReceived(playerB, crab, 3); + assertLife(playerB, 17); + } + + @Test + public void controlDragon() { + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); + addCard(Zone.HAND, playerA, roar); + addCard(Zone.BATTLEFIELD, playerB, crab); + addCard(Zone.BATTLEFIELD, playerA, whelp); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, roar); + addTarget(playerA, crab); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertDamageReceived(playerB, crab, 3); + assertLife(playerB, 17); + } + + @Test + public void controlDragonSacBeforeResolve() { + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); + addCard(Zone.HAND, playerA, roar); + addCard(Zone.BATTLEFIELD, playerB, crab); + addCard(Zone.BATTLEFIELD, playerA, whelp); + addCard(Zone.BATTLEFIELD, playerA, vampire); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, roar); + addTarget(playerA, crab); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sacrifice"); + setChoice(playerA, whelp); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertDamageReceived(playerB, crab, 3); + assertLife(playerB, 17); + assertPowerToughness(playerA, vampire, 3, 3); + } + + @Test + public void controlDragonOnlyAfterCast() { + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 10); + addCard(Zone.HAND, playerA, roar); + addCard(Zone.BATTLEFIELD, playerB, crab); + addCard(Zone.HAND, playerA, hellkite); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, roar); + setChoice(playerA, TestPlayer.CHOICE_SKIP); // no reveal + addTarget(playerA, crab); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, hellkite); + addTargetAmount(playerA, playerB, 5); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertDamageReceived(playerB, crab, 3); + assertLife(playerB, 15); // 5 damage from hellkite, but 0 from roar + } + public void addDragonToHand(String cardName) { addCard(Zone.HAND, playerA, dragon); addCard(Zone.HAND, playerA, cardName);