mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
[ROE] 4 cards with tests. ROE is 100% implemented.
This commit is contained in:
parent
309ebc7ee3
commit
0471771451
8 changed files with 936 additions and 0 deletions
|
|
@ -0,0 +1,108 @@
|
|||
package org.mage.test.cards.single.roe;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.cards.Card;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author magenoxx_at_gmail.com
|
||||
*/
|
||||
public class CastThroughTimeTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Tests Rebound works with a card that has no Rebound itself
|
||||
*/
|
||||
@Test
|
||||
public void testCastWithRebound() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Cast Through Time");
|
||||
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt");
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
|
||||
setStopAt(3, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 14);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests rebound from two Cast Through Time instances
|
||||
* Should have no effect for second copy
|
||||
*/
|
||||
@Test
|
||||
public void testCastWithDoubleRebound() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Cast Through Time", 2);
|
||||
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt");
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
|
||||
setStopAt(3, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 14);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests rebound tooltip
|
||||
*/
|
||||
@Test
|
||||
public void testReboundTooltipExists() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Cast Through Time");
|
||||
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt");
|
||||
|
||||
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
boolean found = false;
|
||||
for (Card card : currentGame.getPlayer(playerA.getId()).getHand().getCards(currentGame)) {
|
||||
if (card.getName().equals("Lightning Bolt")) {
|
||||
for (String rule : card.getRules()) {
|
||||
if (rule.startsWith("Rebound")) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Assert.assertTrue("Couldn't find Rebound rule text displayed for the card", found);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests Rebound disappeared
|
||||
*/
|
||||
@Test
|
||||
public void testCastWithoutRebound() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 2);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Cast Through Time");
|
||||
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt");
|
||||
addCard(Constants.Zone.HAND, playerA, "Naturalize");
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Naturalize", "Cast Through Time");
|
||||
castSpell(1, Constants.PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
|
||||
setStopAt(3, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 17);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests other than Battlefield zone
|
||||
*/
|
||||
@Test
|
||||
public void testInAnotherZone() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
addCard(Constants.Zone.GRAVEYARD, playerA, "Cast Through Time");
|
||||
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt");
|
||||
|
||||
castSpell(1, Constants.PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
|
||||
setStopAt(3, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 17);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
package org.mage.test.cards.single.roe;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.game.permanent.Permanent;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author magenoxx_at_gmail.com
|
||||
*/
|
||||
public class WorldAtWarTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Tests creatures attack twice
|
||||
*/
|
||||
@Test
|
||||
public void testCard() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 5);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Fervor");
|
||||
addCard(Constants.Zone.HAND, playerA, "World at War");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elite Vanguard");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Warclamp Mastiff");
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "World at War");
|
||||
|
||||
attack(1, playerA, "Elite Vanguard");
|
||||
attack(1, playerA, "Elite Vanguard");
|
||||
attack(1, playerA, "Warclamp Mastiff");
|
||||
attack(1, playerA, "Warclamp Mastiff");
|
||||
|
||||
setStopAt(1, Constants.PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
System.out.println("player: " + playerA.getId());
|
||||
|
||||
assertLife(playerB, 14);
|
||||
Permanent eliteVanguard = getPermanent("Elite Vanguard", playerA);
|
||||
Assert.assertTrue(eliteVanguard.isTapped());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests creatures attack twice on each turn (Rebound)
|
||||
*/
|
||||
@Test
|
||||
public void testCardWithRebound() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 5);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Fervor");
|
||||
addCard(Constants.Zone.HAND, playerA, "World at War");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elite Vanguard");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Warclamp Mastiff");
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "World at War");
|
||||
|
||||
attack(1, playerA, "Elite Vanguard");
|
||||
attack(1, playerA, "Elite Vanguard");
|
||||
attack(1, playerA, "Warclamp Mastiff");
|
||||
attack(1, playerA, "Warclamp Mastiff");
|
||||
|
||||
attack(3, playerA, "Elite Vanguard");
|
||||
attack(3, playerA, "Elite Vanguard");
|
||||
attack(3, playerA, "Warclamp Mastiff");
|
||||
attack(3, playerA, "Warclamp Mastiff");
|
||||
|
||||
setStopAt(3, Constants.PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 8);
|
||||
Permanent eliteVanguard = getPermanent("Elite Vanguard", playerA);
|
||||
Assert.assertTrue(eliteVanguard.isTapped());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests creatures attack thrice
|
||||
*/
|
||||
@Test
|
||||
public void testDoubleCast() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 10);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Fervor");
|
||||
addCard(Constants.Zone.HAND, playerA, "World at War", 2);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elite Vanguard");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Warclamp Mastiff");
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "World at War");
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "World at War");
|
||||
|
||||
attack(1, playerA, "Elite Vanguard");
|
||||
attack(1, playerA, "Elite Vanguard");
|
||||
attack(1, playerA, "Elite Vanguard");
|
||||
attack(1, playerA, "Warclamp Mastiff");
|
||||
attack(1, playerA, "Warclamp Mastiff");
|
||||
attack(1, playerA, "Warclamp Mastiff");
|
||||
|
||||
setStopAt(1, Constants.PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 11);
|
||||
Permanent eliteVanguard = getPermanent("Elite Vanguard", playerA);
|
||||
Assert.assertTrue(eliteVanguard.isTapped());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue