mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 04:42:07 -08:00
[AVR] 5 cards with tests
This commit is contained in:
parent
fa76485be0
commit
445efc8c18
14 changed files with 910 additions and 88 deletions
|
|
@ -0,0 +1,99 @@
|
|||
package org.mage.test.cards.abilities.lose;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.game.permanent.Permanent;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author noxx
|
||||
*/
|
||||
public class LoseAbilityTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testLoseFlyingByEnchantCreature() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 4);
|
||||
addCard(Constants.Zone.HAND, playerA, "Grounded", 2);
|
||||
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elite Vanguard");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Air Elemental");
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Grounded", "Elite Vanguard");
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Grounded", "Air Elemental");
|
||||
|
||||
setStopAt(2, Constants.PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
Permanent eliteVanguard = getPermanent("Elite Vanguard", playerA.getId());
|
||||
Assert.assertNotNull(eliteVanguard);
|
||||
Assert.assertFalse(eliteVanguard.getAbilities().contains(FlyingAbility.getInstance()));
|
||||
|
||||
Permanent airElemental = getPermanent("Air Elemental", playerA.getId());
|
||||
Assert.assertNotNull(airElemental);
|
||||
// should NOT have flying
|
||||
Assert.assertFalse(airElemental.getAbilities().contains(FlyingAbility.getInstance()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that first losing ability and then gaining it will results in Flying existence
|
||||
*/
|
||||
@Test
|
||||
public void testLoseVsGainAbility() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Air Elemental");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 2);
|
||||
addCard(Constants.Zone.HAND, playerA, "Grounded");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 6);
|
||||
addCard(Constants.Zone.HAND, playerA, "Drake Umbra");
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Grounded", "Air Elemental");
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Drake Umbra", "Air Elemental");
|
||||
|
||||
setStopAt(2, Constants.PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
Permanent airElemental = getPermanent("Air Elemental", playerA.getId());
|
||||
Assert.assertNotNull(airElemental);
|
||||
|
||||
Assert.assertTrue(airElemental.getAttachments().size() == 2);
|
||||
// should have flying
|
||||
Assert.assertTrue(airElemental.getAbilities().contains(FlyingAbility.getInstance()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that first gaining multiple copies of ability and then losing it will results in Flying not existence
|
||||
*/
|
||||
@Test
|
||||
public void testMultiGainVsLoseAbility() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Air Elemental");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 5);
|
||||
addCard(Constants.Zone.HAND, playerA, "Grounded");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 10);
|
||||
addCard(Constants.Zone.HAND, playerA, "Drake Umbra", 2);
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Drake Umbra", "Air Elemental");
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Drake Umbra", "Air Elemental");
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Grounded", "Air Elemental");
|
||||
|
||||
setStopAt(2, Constants.PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
Permanent airElemental = getPermanent("Air Elemental", playerA.getId());
|
||||
Assert.assertNotNull(airElemental);
|
||||
|
||||
Assert.assertTrue(airElemental.getAttachments().size() == 3);
|
||||
// should NOT have flying
|
||||
Assert.assertFalse(airElemental.getAbilities().contains(FlyingAbility.getInstance()));
|
||||
}
|
||||
}
|
||||
|
|
@ -54,4 +54,27 @@ public class AlchemistsRefugeTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, "Elite Vanguard", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that effect will be removed at the end of the turn
|
||||
*/
|
||||
@Test
|
||||
public void testEffectOnlyForOneTurn() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Alchemist's Refuge");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Plains");
|
||||
addCard(Constants.Zone.HAND, playerA, "Elite Vanguard");
|
||||
|
||||
activateAbility(2, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "{G}{U}, {tap}:");
|
||||
castSpell(4, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Elite Vanguard");
|
||||
|
||||
setStopAt(4, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertPermanentCount(playerA, "Elite Vanguard", 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,4 +93,114 @@ public class AttackBlockRestrictionsTest extends CardTestPlayerBase {
|
|||
|
||||
assertPermanentCount(playerA, "Hunted Ghoul", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests "Creatures with flying can't block creatures you control"
|
||||
*/
|
||||
@Test
|
||||
public void testBowerPassage() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Bower Passage");
|
||||
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Elite Vanguard");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Arbor Elf");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Assault Griffin");
|
||||
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Angelic Wall");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Air Elemental");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Llanowar Elves");
|
||||
|
||||
// non flying vs. flying
|
||||
attack(2, playerB, "Elite Vanguard");
|
||||
block(2, playerA, "Angelic Wall", "Elite Vanguard");
|
||||
// non flying vs. non flying
|
||||
attack(2, playerB, "Arbor Elf");
|
||||
block(2, playerA, "Llanowar Elves", "Arbor Elf");
|
||||
// flying vs. flying
|
||||
attack(2, playerB, "Assault Griffin");
|
||||
block(2, playerA, "Air Elemental", "Assault Griffin");
|
||||
|
||||
setStopAt(2, Constants.PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 15);
|
||||
assertLife(playerB, 20);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests restriction effect going away after card is destroyed
|
||||
*/
|
||||
@Test
|
||||
public void testBowerPassageDestroyed() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Bower Passage");
|
||||
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Elite Vanguard");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Arbor Elf");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Assault Griffin");
|
||||
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Angelic Wall");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Air Elemental");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Llanowar Elves");
|
||||
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 2);
|
||||
addCard(Constants.Zone.HAND, playerA, "Naturalize");
|
||||
|
||||
// non flying vs. flying
|
||||
attack(2, playerB, "Elite Vanguard");
|
||||
block(2, playerA, "Angelic Wall", "Elite Vanguard");
|
||||
// non flying vs. non flying
|
||||
attack(2, playerB, "Arbor Elf");
|
||||
block(2, playerA, "Llanowar Elves", "Arbor Elf");
|
||||
// flying vs. flying
|
||||
attack(2, playerB, "Assault Griffin");
|
||||
block(2, playerA, "Air Elemental", "Assault Griffin");
|
||||
|
||||
castSpell(2, Constants.PhaseStep.DECLARE_ATTACKERS, playerA, "Naturalize", "Bower Passage");
|
||||
|
||||
setStopAt(2, Constants.PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerB, "Bower Passage", 0);
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests "Creatures with flying can't block creatures you control"
|
||||
*/
|
||||
@Test
|
||||
public void testChampionOfLambholt() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Champion of Lambholt");
|
||||
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Elite Vanguard");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Arbor Elf");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Assault Griffin");
|
||||
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Plains", 5);
|
||||
addCard(Constants.Zone.HAND, playerB, "Baneslayer Angel");
|
||||
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Angelic Wall");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Air Elemental");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Llanowar Elves");
|
||||
|
||||
castSpell(2, Constants.PhaseStep.PRECOMBAT_MAIN, playerB, "Baneslayer Angel");
|
||||
|
||||
// non flying vs. flying
|
||||
attack(2, playerB, "Elite Vanguard");
|
||||
block(2, playerA, "Angelic Wall", "Elite Vanguard");
|
||||
// non flying vs. non flying
|
||||
attack(2, playerB, "Arbor Elf");
|
||||
block(2, playerA, "Llanowar Elves", "Arbor Elf");
|
||||
// flying vs. flying
|
||||
attack(2, playerB, "Assault Griffin");
|
||||
block(2, playerA, "Air Elemental", "Assault Griffin");
|
||||
|
||||
setStopAt(2, Constants.PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPowerToughness(playerB, "Champion of Lambholt", 2, 2);
|
||||
|
||||
assertLife(playerA, 17);
|
||||
assertLife(playerB, 20);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue