Reworked ability source object handling.

This commit is contained in:
LevelX2 2018-10-21 21:37:23 +02:00
parent e6b78d7a2e
commit 26a93d4427
19 changed files with 292 additions and 288 deletions

View file

@ -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");

View file

@ -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);
}

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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);