mirror of
https://github.com/magefree/mage.git
synced 2025-12-30 15:32:08 -08:00
Merge branch 'master' into JaceArchitectOfThoughtFix
This commit is contained in:
commit
c4cd4b8b6a
320 changed files with 14921 additions and 4691 deletions
|
|
@ -39,9 +39,11 @@ public class SpitefulShadowsTest extends CardTestPlayerBase {
|
|||
|
||||
@Test
|
||||
public void testCard1() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Craw Wurm");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Craw Wurm"); // Creature 6/4
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||
// Enchant creature
|
||||
// Whenever enchanted creature is dealt damage, it deals that much damage to its controller.
|
||||
addCard(Zone.HAND, playerA, "Spiteful Shadows");
|
||||
addCard(Zone.HAND, playerA, "Lightning Bolt");
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package org.mage.test.cards.abilities.oneshot.exile;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
|
|
@ -70,10 +69,9 @@ public class FiendHunterTest extends CardTestPlayerBase {
|
|||
execute();
|
||||
|
||||
assertExileCount("Silvercoat Lion", 1);
|
||||
assertPermanentCount(playerB, "Primeval Titan", 1);
|
||||
|
||||
assertPermanentCount(playerA, "Fiend Hunter", 1);
|
||||
assertPermanentCount(playerA, "Restoration Angel", 1);
|
||||
assertPermanentCount(playerB, "Primeval Titan", 1);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,179 +1,180 @@
|
|||
|
||||
package org.mage.test.cards.abilities.other;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class LimitedCountedActivationsTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Tests usage of ActivationInfo class
|
||||
*/
|
||||
@Test
|
||||
public void testDragonWhelpActivatedThreeTimes() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
// Flying
|
||||
// {R}: Dragon Whelp gets +1/+0 until end of turn. If this ability has been activated four or more times this turn, sacrifice Dragon Whelp at the beginning of the next end step.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Dragon Whelp", 1); // 3/3
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
|
||||
attack(1, playerA, "Dragon Whelp");
|
||||
|
||||
setStopAt(2, PhaseStep.UPKEEP);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Dragon Whelp", 1);
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 15);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDragonWhelpActivatedFourTimes() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
|
||||
// Flying
|
||||
// {R}: Dragon Whelp gets +1/+0 until end of turn. If this ability has been activated four or more times this turn, sacrifice Dragon Whelp at the beginning of the next end step.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Dragon Whelp", 1); // 3/3
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
|
||||
attack(1, playerA, "Dragon Whelp");
|
||||
|
||||
setStopAt(2, PhaseStep.UPKEEP);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Dragon Whelp", 0);
|
||||
assertGraveyardCount(playerA, "Dragon Whelp", 1);
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 14);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDragonWhelpActivatedFiveTimes() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
|
||||
// Flying
|
||||
// {R}: Dragon Whelp gets +1/+0 until end of turn. If this ability has been activated four or more times this turn, sacrifice Dragon Whelp at the beginning of the next end step.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Dragon Whelp", 1); // 3/3
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
|
||||
attack(1, playerA, "Dragon Whelp");
|
||||
|
||||
setStopAt(2, PhaseStep.UPKEEP);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Dragon Whelp", 0);
|
||||
assertGraveyardCount(playerA, "Dragon Whelp", 1);
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 13);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDragonWhelpTwoObjects() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
|
||||
// Flying
|
||||
// {R}: Dragon Whelp gets +1/+0 until end of turn. If this ability has been activated four or more times this turn, sacrifice Dragon Whelp at the beginning of the next end step.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Dragon Whelp", 1); // 3/3
|
||||
// Put target creature card from a graveyard onto the battlefield under your control. You lose life equal to its converted mana cost.
|
||||
addCard(Zone.HAND, playerA, "Reanimate", 1);
|
||||
// Target creature gains haste until end of turn.
|
||||
addCard(Zone.HAND, playerA, "Unnatural Speed", 1);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2);
|
||||
// Destroy target nonartifact, nonblack creature. It can't be regenerated.
|
||||
addCard(Zone.HAND, playerB, "Terror", 1); // {1}{B}
|
||||
|
||||
activateAbility(1, PhaseStep.UPKEEP, playerA, "{R}: ");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Terror", "Dragon Whelp");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reanimate", "Dragon Whelp");
|
||||
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Unnatural Speed", "Dragon Whelp");
|
||||
|
||||
activateAbility(1, PhaseStep.DECLARE_ATTACKERS, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.DECLARE_ATTACKERS, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.DECLARE_ATTACKERS, playerA, "{R}: ");
|
||||
|
||||
attack(1, playerA, "Dragon Whelp");
|
||||
|
||||
setStopAt(2, PhaseStep.UPKEEP);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Unnatural Speed", 1);
|
||||
assertGraveyardCount(playerA, "Reanimate", 1);
|
||||
|
||||
assertGraveyardCount(playerB, "Terror", 1);
|
||||
|
||||
assertPermanentCount(playerA, "Dragon Whelp", 1);
|
||||
assertPowerToughness(playerA, "Dragon Whelp", 2, 3);
|
||||
assertGraveyardCount(playerA, "Dragon Whelp", 0);
|
||||
|
||||
assertLife(playerA, 16);
|
||||
assertLife(playerB, 15);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDragonWhelpDontSacrificeNewObject() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 8);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
|
||||
// Flying
|
||||
// {R}: Dragon Whelp gets +1/+0 until end of turn. If this ability has been activated four or more times this turn, sacrifice Dragon Whelp at the beginning of the next end step.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Dragon Whelp", 1); // 3/3
|
||||
// Put target creature card from a graveyard onto the battlefield under your control. You lose life equal to its converted mana cost.
|
||||
addCard(Zone.HAND, playerA, "Reanimate", 1);
|
||||
// Target creature gains haste until end of turn.
|
||||
addCard(Zone.HAND, playerA, "Unnatural Speed", 1);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2);
|
||||
// Destroy target nonartifact, nonblack creature. It can't be regenerated.
|
||||
addCard(Zone.HAND, playerB, "Terror", 1); // {1}{B}
|
||||
|
||||
activateAbility(1, PhaseStep.UPKEEP, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.UPKEEP, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.UPKEEP, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.UPKEEP, playerA, "{R}: ");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Terror", "Dragon Whelp");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reanimate", "Dragon Whelp");
|
||||
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Unnatural Speed", "Dragon Whelp");
|
||||
|
||||
activateAbility(1, PhaseStep.DECLARE_ATTACKERS, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.DECLARE_ATTACKERS, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.DECLARE_ATTACKERS, playerA, "{R}: ");
|
||||
|
||||
attack(1, playerA, "Dragon Whelp");
|
||||
|
||||
setStopAt(2, PhaseStep.UPKEEP);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Unnatural Speed", 1);
|
||||
assertGraveyardCount(playerA, "Reanimate", 1);
|
||||
|
||||
assertGraveyardCount(playerB, "Terror", 1);
|
||||
|
||||
assertPermanentCount(playerA, "Dragon Whelp", 1);
|
||||
assertPowerToughness(playerA, "Dragon Whelp", 2, 3);
|
||||
assertGraveyardCount(playerA, "Dragon Whelp", 0);
|
||||
|
||||
assertLife(playerA, 16);
|
||||
assertLife(playerB, 15);
|
||||
}
|
||||
}
|
||||
package org.mage.test.cards.abilities.other;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class LimitedCountedActivationsTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Tests usage of ActivationInfo class
|
||||
*/
|
||||
@Test
|
||||
public void testDragonWhelpActivatedThreeTimes() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
// Flying
|
||||
// {R}: Dragon Whelp gets +1/+0 until end of turn. If this ability has been activated four or more times this turn, sacrifice Dragon Whelp at the beginning of the next end step.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Dragon Whelp", 1); // 3/3
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
|
||||
attack(1, playerA, "Dragon Whelp");
|
||||
|
||||
setStopAt(2, PhaseStep.UPKEEP);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Dragon Whelp", 1);
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 15);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDragonWhelpActivatedFourTimes() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
|
||||
// Flying
|
||||
// {R}: Dragon Whelp gets +1/+0 until end of turn. If this ability has been activated four or more times this turn, sacrifice Dragon Whelp at the beginning of the next end step.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Dragon Whelp", 1); // 3/3
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
|
||||
attack(1, playerA, "Dragon Whelp");
|
||||
|
||||
setStopAt(2, PhaseStep.UPKEEP);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Dragon Whelp", 0);
|
||||
assertGraveyardCount(playerA, "Dragon Whelp", 1);
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 14);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDragonWhelpActivatedFiveTimes() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
|
||||
// Flying
|
||||
// {R}: Dragon Whelp gets +1/+0 until end of turn. If this ability has been activated four or more times this turn, sacrifice Dragon Whelp at the beginning of the next end step.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Dragon Whelp", 1); // 3/3
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
|
||||
|
||||
attack(1, playerA, "Dragon Whelp");
|
||||
|
||||
setStopAt(2, PhaseStep.UPKEEP);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Dragon Whelp", 0);
|
||||
assertGraveyardCount(playerA, "Dragon Whelp", 1);
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 13);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDragonWhelpTwoObjects() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
|
||||
// Flying
|
||||
// {R}: Dragon Whelp gets +1/+0 until end of turn. If this ability has been activated four or more times this turn, sacrifice Dragon Whelp at the beginning of the next end step.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Dragon Whelp", 1); // 3/3
|
||||
// Put target creature card from a graveyard onto the battlefield under your control. You lose life equal to its converted mana cost.
|
||||
addCard(Zone.HAND, playerA, "Reanimate", 1);
|
||||
// Target creature gains haste until end of turn.
|
||||
addCard(Zone.HAND, playerA, "Unnatural Speed", 1);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2);
|
||||
// Destroy target nonartifact, nonblack creature. It can't be regenerated.
|
||||
addCard(Zone.HAND, playerB, "Terror", 1); // {1}{B}
|
||||
|
||||
activateAbility(1, PhaseStep.UPKEEP, playerA, "{R}: ");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Terror", "Dragon Whelp");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reanimate", "Dragon Whelp");
|
||||
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Unnatural Speed", "Dragon Whelp");
|
||||
|
||||
activateAbility(1, PhaseStep.DECLARE_ATTACKERS, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.DECLARE_ATTACKERS, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.DECLARE_ATTACKERS, playerA, "{R}: ");
|
||||
|
||||
attack(1, playerA, "Dragon Whelp");
|
||||
|
||||
setStopAt(2, PhaseStep.UPKEEP);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Unnatural Speed", 1);
|
||||
assertGraveyardCount(playerA, "Reanimate", 1);
|
||||
|
||||
assertGraveyardCount(playerB, "Terror", 1);
|
||||
|
||||
assertPermanentCount(playerA, "Dragon Whelp", 1);
|
||||
assertPowerToughness(playerA, "Dragon Whelp", 2, 3);
|
||||
assertGraveyardCount(playerA, "Dragon Whelp", 0);
|
||||
|
||||
assertLife(playerA, 16);
|
||||
assertLife(playerB, 15);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDragonWhelpDontSacrificeNewObject() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 8);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
|
||||
// Flying
|
||||
// {R}: Dragon Whelp gets +1/+0 until end of turn. If this ability has been activated four or more times this turn, sacrifice Dragon Whelp at the beginning of the next end step.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Dragon Whelp", 1); // 3/3
|
||||
// Put target creature card from a graveyard onto the battlefield under your control. You lose life equal to its converted mana cost.
|
||||
addCard(Zone.HAND, playerA, "Reanimate", 1);
|
||||
// Target creature gains haste until end of turn.
|
||||
addCard(Zone.HAND, playerA, "Unnatural Speed", 1);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2);
|
||||
// Destroy target nonartifact, nonblack creature. It can't be regenerated.
|
||||
addCard(Zone.HAND, playerB, "Terror", 1); // {1}{B}
|
||||
|
||||
activateAbility(1, PhaseStep.UPKEEP, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.UPKEEP, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.UPKEEP, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.UPKEEP, playerA, "{R}: ");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Terror", "Dragon Whelp");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reanimate", "Dragon Whelp");
|
||||
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Unnatural Speed", "Dragon Whelp");
|
||||
|
||||
activateAbility(1, PhaseStep.DECLARE_ATTACKERS, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.DECLARE_ATTACKERS, playerA, "{R}: ");
|
||||
activateAbility(1, PhaseStep.DECLARE_ATTACKERS, playerA, "{R}: ");
|
||||
|
||||
attack(1, playerA, "Dragon Whelp");
|
||||
|
||||
setStopAt(2, PhaseStep.UPKEEP);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Unnatural Speed", 1);
|
||||
assertGraveyardCount(playerA, "Reanimate", 1);
|
||||
|
||||
assertGraveyardCount(playerB, "Terror", 1);
|
||||
|
||||
assertLife(playerA, 16);
|
||||
assertLife(playerB, 15);
|
||||
|
||||
assertGraveyardCount(playerA, "Dragon Whelp", 0);
|
||||
|
||||
assertPermanentCount(playerA, "Dragon Whelp", 1);
|
||||
assertPowerToughness(playerA, "Dragon Whelp", 2, 3);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package org.mage.test.cards.conditional;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
public class IcequakeTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testIcequakeOnSnowLand(){
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Snow-Covered Plains");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp",10);
|
||||
addCard(Zone.HAND, playerA, "Icequake");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN,playerA, "Icequake", "Snow-Covered Plains");
|
||||
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 19);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package org.mage.test.cards.continuous;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
*/
|
||||
public class GoblinGoliathTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void test_DoubleDamage() {
|
||||
// test double damage on creature (no), on yourself (no) and on opponent (yes) by bold damage
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 20);
|
||||
// {3}{R}, {T}: If a source you control would deal damage to an opponent this turn, it deals double that damage to that player instead.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Goblin Goliath");
|
||||
addCard(Zone.HAND, playerA, "Lightning Bolt", 4); // 3 damage
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Barktooth Warbeard"); // 6/5
|
||||
|
||||
// normal damage without ability
|
||||
castSpell(1, PhaseStep.UPKEEP, playerA, "Lightning Bolt", playerB);
|
||||
checkLife("normal damage to opponent", 1, PhaseStep.PRECOMBAT_MAIN, playerB, 20 - 3);
|
||||
|
||||
// activate double damage
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{3}{R}");
|
||||
// cast bolt to player (2x damage)
|
||||
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Lightning Bolt", playerB);
|
||||
checkLife("double damage to opponent", 1, PhaseStep.END_COMBAT, playerB, 20 - 3 - 3 * 2);
|
||||
// cast bolt to creature (1x damage)
|
||||
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Lightning Bolt", "Barktooth Warbeard");
|
||||
checkPermanentCount("normal damage to creature", 1, PhaseStep.END_COMBAT, playerB, "Barktooth Warbeard", 1);
|
||||
// cast bolt to yourself (1x damage)
|
||||
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Lightning Bolt", playerA);
|
||||
checkLife("normal damage to yourself", 1, PhaseStep.END_COMBAT, playerA, 20 - 3);
|
||||
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Lightning Bolt", 4);
|
||||
assertLife(playerA, 20 - 3);
|
||||
assertLife(playerB, 20 - 3 - 3 * 2);
|
||||
assertGraveyardCount(playerB, "Barktooth Warbeard", 0);
|
||||
}
|
||||
}
|
||||
|
|
@ -27,17 +27,16 @@ public class SummonersEggTest extends CardTestPlayerBase {
|
|||
@Test
|
||||
public void testSummonersEggImprint() {
|
||||
addCard(Zone.HAND, playerA, "Summoner's Egg");
|
||||
addCard(Zone.HAND, playerA, "Sejiri Merfolk");
|
||||
addCard(Zone.HAND, playerA, "Maritime Guard");
|
||||
addCard(Zone.HAND, playerA, "Goblin Roughrider");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Summoner's Egg");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Summoner's Egg");
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
|
||||
assertHandCount(playerA, 1);
|
||||
assertHandCount(playerA, "Sejiri Merfolk", 1);
|
||||
assertHandCount(playerA, "Maritime Guard", 1);
|
||||
assertHandCount(playerA, "Goblin Roughrider", 0);
|
||||
|
||||
assertExileCount("Goblin Roughrider", 1);
|
||||
|
|
@ -53,7 +52,7 @@ public class SummonersEggTest extends CardTestPlayerBase {
|
|||
@Test
|
||||
public void testSummonersEggDies() {
|
||||
addCard(Zone.HAND, playerA, "Summoner's Egg");
|
||||
addCard(Zone.HAND, playerA, "Sejiri Merfolk");
|
||||
addCard(Zone.HAND, playerA, "Maritime Guard");
|
||||
addCard(Zone.HAND, playerA, "Goblin Roughrider");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
|
||||
addCard(Zone.HAND, playerB, "Char");
|
||||
|
|
@ -67,7 +66,7 @@ public class SummonersEggTest extends CardTestPlayerBase {
|
|||
execute();
|
||||
|
||||
assertHandCount(playerA, 1);
|
||||
assertHandCount(playerA, "Sejiri Merfolk", 1);
|
||||
assertHandCount(playerA, "Maritime Guard", 1);
|
||||
assertHandCount(playerA, "Goblin Roughrider", 0);
|
||||
|
||||
assertGraveyardCount(playerA, "Summoner's Egg", 1);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.mage.test.cards.mana;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class HarvestMageTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testOneInstance() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
|
||||
// {G}, {T}, Discard a card: Until end of turn, if you tap a land for mana, it produces one mana of a color of your choice instead of any other type and amount.
|
||||
addCard(Zone.HAND, playerA, "Harvest Mage", 1); // Creature 1/1 {G}
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Harvest Mage");
|
||||
|
||||
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{G}, {T}, Discard a card: Until end of turn");
|
||||
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Harvest Mage", 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package org.mage.test.cards.replacement.redirect;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class GlarecasterTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* I can activate Glarecaster's redirection ability, immediately cast two
|
||||
* Lightning Bolts on it and both get redirected towards the chosen target.
|
||||
* If I pass until the next step and cast another Bolt on it, it's not being
|
||||
* redirected anymore.
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testTwoTimesInstantSpellDamage() {
|
||||
addCard(Zone.HAND, playerA, "Lightning Bolt", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||
|
||||
// Flying
|
||||
// {5}{W}: The next time damage would be dealt to Glarecaster and/or you this turn, that damage is dealt to any target instead.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Glarecaster"); // Creature 3/3
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Plains", 6);
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{5}{W}: The next time damage would be dealt to", playerA);
|
||||
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", "Glarecaster");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Lightning Bolt", 2);
|
||||
|
||||
assertPermanentCount(playerB, "Glarecaster", 1);
|
||||
|
||||
assertLife(playerA, 17);
|
||||
assertLife(playerB, 17);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -26,8 +26,7 @@ public class PrizedAmalgamTest extends CardTestPlayerBase {
|
|||
addCard(Zone.GRAVEYARD, playerA, "Prized Amalgam", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reanimate");
|
||||
addTarget(playerA, "Bronze Sable");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reanimate", "Bronze Sable");
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
|
|
@ -72,8 +71,7 @@ public class PrizedAmalgamTest extends CardTestPlayerBase {
|
|||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
addCard(Zone.GRAVEYARD, playerB, "Prized Amalgam", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reanimate");
|
||||
addTarget(playerA, "Hill Giant");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reanimate", "Hill Giant");
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
|
|
@ -95,8 +93,7 @@ public class PrizedAmalgamTest extends CardTestPlayerBase {
|
|||
// Whenever a creature enters the battlefield, if it entered from your graveyard or you cast it from your graveyard, return Prized Amalgam from your graveyard to the battlefield tapped at the beginning of the next end step.
|
||||
addCard(Zone.GRAVEYARD, playerB, "Prized Amalgam", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Necromantic Summons");
|
||||
addTarget(playerA, "Merfolk Looter");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Necromantic Summons", "Merfolk Looter");
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import mage.cards.decks.DeckCardInfo;
|
|||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.cards.repository.CardScanner;
|
||||
import mage.constants.*;
|
||||
import mage.game.match.MatchOptions;
|
||||
import mage.player.ai.ComputerPlayer;
|
||||
|
|
@ -21,9 +22,7 @@ import mage.remote.SessionImpl;
|
|||
import mage.util.RandomUtil;
|
||||
import mage.view.*;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.*;
|
||||
|
||||
/**
|
||||
* Intended to test Mage server under different load patterns.
|
||||
|
|
@ -45,6 +44,12 @@ public class LoadTest {
|
|||
private static final String TEST_PROXY_TYPE = "None";
|
||||
private static final String TEST_USER_NAME = "user";
|
||||
|
||||
@BeforeClass
|
||||
public static void initDatabase() {
|
||||
// recreate missing cards db
|
||||
CardScanner.scan();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_CreateRandomDeck() {
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ public class BlatantThieveryTest extends CardTestMultiPlayerBase {
|
|||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Blatant Thievery", 1);
|
||||
assertPermanentCount(playerA, "Silvercoat Lion", 1);
|
||||
assertPermanentCount(playerA, "Walking Corpse", 1);
|
||||
assertPermanentCount(playerA, "Pillarfield Ox", 1);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -10,6 +10,8 @@ import java.util.Scanner;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.constants.PhaseStep;
|
||||
|
|
@ -54,6 +56,8 @@ public abstract class MageTestPlayerBase {
|
|||
|
||||
protected Map<TestPlayer, Map<Zone, String>> commands = new HashMap<>();
|
||||
|
||||
protected static Map<String, DeckCardLists> loadedDeckCardLists = new HashMap<>(); // test decks buffer
|
||||
|
||||
protected TestPlayer playerA;
|
||||
protected TestPlayer playerB;
|
||||
protected TestPlayer playerC;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
package org.mage.test.serverside.base.impl;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.Mana;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.cards.decks.importer.DeckImporterUtil;
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
|
|
@ -49,8 +49,10 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
public static final String NO_TARGET = "NO_TARGET";
|
||||
|
||||
public static final String CHECK_COMMAND_PT = "PT";
|
||||
public static final String CHECK_COMMAND_LIFE = "LIFE";
|
||||
public static final String CHECK_COMMAND_ABILITY = "ABILITY";
|
||||
public static final String CHECK_COMMAND_PERMANENT_COUNT = "PERMANENT_COUNT";
|
||||
public static final String CHECK_COMMAND_EXILE_COUNT = "EXILE_COUNT";
|
||||
public static final String CHECK_COMMAND_HAND_COUNT = "HAND_COUNT";
|
||||
public static final String CHECK_COMMAND_COLOR = "COLOR";
|
||||
public static final String CHECK_COMMAND_SUBTYPE = "SUBTYPE";
|
||||
|
|
@ -64,7 +66,6 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
protected String deckNameD;
|
||||
|
||||
protected enum ExpectedType {
|
||||
|
||||
TURN_NUMBER,
|
||||
RESULT,
|
||||
LIFE,
|
||||
|
|
@ -165,12 +166,21 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
protected TestPlayer createPlayer(Game game, TestPlayer player, String name, String deckName) throws GameException {
|
||||
player = createNewPlayer(name, game.getRangeOfInfluence());
|
||||
player.setTestMode(true);
|
||||
|
||||
logger.debug("Loading deck...");
|
||||
Deck deck = Deck.load(DeckImporterUtil.importDeck(deckName), false, false);
|
||||
DeckCardLists list;
|
||||
if (loadedDeckCardLists.containsKey(deckName)) {
|
||||
list = loadedDeckCardLists.get(deckName);
|
||||
} else {
|
||||
list = DeckImporterUtil.importDeck(deckName);
|
||||
loadedDeckCardLists.put(deckName, list);
|
||||
}
|
||||
Deck deck = Deck.load(list, false, false);
|
||||
logger.debug("Done!");
|
||||
if (deck.getCards().size() < 40) {
|
||||
throw new IllegalArgumentException("Couldn't load deck, deck size=" + deck.getCards().size());
|
||||
}
|
||||
|
||||
game.loadCards(deck.getCards(), player.getId());
|
||||
game.loadCards(deck.getSideboard(), player.getId());
|
||||
game.addPlayer(player, deck);
|
||||
|
|
@ -240,6 +250,10 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
check(checkName, turnNum, step, player, CHECK_COMMAND_PT, permanentName, power.toString(), toughness.toString());
|
||||
}
|
||||
|
||||
public void checkLife(String checkName, int turnNum, PhaseStep step, TestPlayer player, Integer life) {
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_LIFE, life.toString());
|
||||
}
|
||||
|
||||
public void checkAbility(String checkName, int turnNum, PhaseStep step, TestPlayer player, String permanentName, Class<?> abilityClass, Boolean mustHave) {
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_ABILITY, permanentName, abilityClass.getName(), mustHave.toString());
|
||||
}
|
||||
|
|
@ -248,6 +262,10 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
check(checkName, turnNum, step, player, CHECK_COMMAND_PERMANENT_COUNT, permanentName, count.toString());
|
||||
}
|
||||
|
||||
public void checkExileCount(String checkName, int turnNum, PhaseStep step, TestPlayer player, String permanentName, Integer count) {
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_EXILE_COUNT, permanentName, count.toString());
|
||||
}
|
||||
|
||||
public void checkHandCount(String checkName, int turnNum, PhaseStep step, TestPlayer player, Integer count) {
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_HAND_COUNT, count.toString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,13 +59,9 @@ public class DeckValidatorTest extends MageTestBase {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testStandardValid() {
|
||||
public void testStandardDeckCardsAmountValid() {
|
||||
ArrayList<CardNameAmount> deck = new ArrayList<>();
|
||||
|
||||
deck.add(new CardNameAmount("MPS-AKH", 28, 4)); // Rhonas the Indomitable
|
||||
deck.add(new CardNameAmount("Built to Smash", 4));
|
||||
deck.add(new CardNameAmount("Heroic Intervention", 4));
|
||||
deck.add(new CardNameAmount("Mountain", 48));
|
||||
deck.add(new CardNameAmount("Mountain", 60));
|
||||
|
||||
DeckValidator validator = new Standard();
|
||||
boolean validationSuccessful = testDeckValid(validator, deck);
|
||||
|
|
@ -73,13 +69,9 @@ public class DeckValidatorTest extends MageTestBase {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testStandardNotValid() {
|
||||
public void testStandardDeckCardsAmountNotValid() {
|
||||
ArrayList<CardNameAmount> deck = new ArrayList<>();
|
||||
|
||||
deck.add(new CardNameAmount("MPS-AKH", 28, 4)); // Rhonas the Indomitable
|
||||
deck.add(new CardNameAmount("Built to Smash", 4));
|
||||
deck.add(new CardNameAmount("Heroic Intervention", 4));
|
||||
deck.add(new CardNameAmount("Mountain", 47));
|
||||
deck.add(new CardNameAmount("Mountain", 59));
|
||||
|
||||
ArrayList<CardNameAmount> sideboard = new ArrayList<>();
|
||||
sideboard.add(new CardNameAmount("Mountain", 16));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue