Merge pull request #11031 from xenohedron/cleanup-7a-7b

More SetBasePowerToughnessSourceEffect cleanup
This commit is contained in:
xenohedron 2023-08-31 00:29:59 -04:00 committed by GitHub
commit d6c690601d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 657 additions and 256 deletions

View file

@ -0,0 +1,161 @@
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;
/**
* Check that effects setting base power/toughness work properly, including CDA and 7b with duration
*
* @author xenohedron
*/
public class SetBasePTSourceTest extends CardTestPlayerBase {
@Test
public void testCDAsetPT() {
String rootless = "Rootless Yew"; // 3GG 5/4
// When Rootless Yew dies, search your library for a creature card with power or toughness 6 or greater,
// reveal it, put it into your hand, then shuffle.
String enigma = "Enigma Drake"; // 1UR */4
// Enigma Drake's power is equal to the number of instant and sorcery cards in your graveyard.
String kami = "Traproot Kami"; // G 0/*
// Traproot Kamis toughness is equal to the number of Forests on the battlefield.
setStrictChooseMode(true);
addCard(Zone.LIBRARY, playerA, enigma);
addCard(Zone.GRAVEYARD, playerA, "Shock", 6);
addCard(Zone.BATTLEFIELD, playerA, rootless);
addCard(Zone.BATTLEFIELD, playerA, "Tarmogoyf");
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
addCard(Zone.BATTLEFIELD, playerA, kami);
addCard(Zone.BATTLEFIELD, playerA, "Visara the Dreadful");
// Activate Visara to trigger dies ability and search. CDA must apply in all zones.
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Destroy target", rootless);
addTarget(playerA, enigma); // power 6 due to 6 instants in graveyard
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertHandCount(playerA, enigma, 1);
assertGraveyardCount(playerA, rootless, 1);
assertPowerToughness(playerA, kami, 0, 3); // 3 forests
assertPowerToughness(playerA, "Tarmogoyf", 2, 3); // Instant and creature
}
@Test
public void testLayer7b() {
String mimic = "Battlegate Mimic"; // {1}{R/W} 2/1
// Whenever you cast a spell thats both red and white, Battlegate Mimic has base power and toughness 4/2
// until end of turn and gains first strike until end of turn.
String figure = "Figure of Destiny"; // {R/W} 1/1
// {R/W}: Figure of Destiny becomes a Kithkin Spirit with base power and toughness 2/2.
// {R/W}{R/W}{R/W}: If Figure of Destiny is a Spirit, it becomes a Kithkin Spirit Warrior with base power and toughness 4/4.
// {R/W}{R/W}{R/W}{R/W}{R/W}{R/W}: If Figure of Destiny is a Warrior, it becomes a Kithkin Spirit Warrior Avatar
// with base power and toughness 8/8, flying, and first strike.
String cloudshift = "Cloudshift"; // {W} Instant
// Exile target creature you control, then return that card to the battlefield under your control.
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 10);
addCard(Zone.BATTLEFIELD, playerA, mimic);
addCard(Zone.HAND, playerA, figure);
addCard(Zone.HAND, playerA, cloudshift, 2);
addCard(Zone.HAND, playerA, "Double Cleave"); // {1}{R/W} Instant
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, figure);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, mimic, 4, 2);
assertPowerToughness(playerA, figure,1, 1);
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{R/W}: ");
waitStackResolved(1, PhaseStep.POSTCOMBAT_MAIN);
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{R/W}{R/W}{R/W}: ");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPowerToughness(playerA, mimic, 4, 2);
assertPowerToughness(playerA, figure,4, 4);
setStopAt(2, PhaseStep.UPKEEP);
execute();
assertPowerToughness(playerA, mimic, 2, 1);
assertPowerToughness(playerA, figure,4, 4);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Double Cleave", mimic);
waitStackResolved(2, PhaseStep.PRECOMBAT_MAIN);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, cloudshift, figure);
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, mimic, 4, 2);
assertPowerToughness(playerA, figure, 1, 1);
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerA, cloudshift, mimic);
waitStackResolved(2, PhaseStep.POSTCOMBAT_MAIN);
activateAbility(2, PhaseStep.POSTCOMBAT_MAIN, playerA, "{R/W}: ");
setStopAt(2, PhaseStep.END_TURN);
execute();
assertPowerToughness(playerA, mimic, 2, 1);
assertPowerToughness(playerA, figure, 2, 2);
}
@Test
public void testSvogthos() {
String svogthos = "Svogthos, the Restless Tomb"; // Land
// {3}{B}{G}: Until end of turn, Svogthos, the Restless Tomb becomes a black and green Plant Zombie creature with
// "This creatures power and toughness are each equal to the number of creature cards in your graveyard." Its still a land.
setStrictChooseMode(true);
addCard(Zone.GRAVEYARD, playerA, "Walking Corpse", 5);
addCard(Zone.BATTLEFIELD, playerA, svogthos);
addCard(Zone.BATTLEFIELD, playerA, "Bayou", 5);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{3}{B}{G}: ");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, svogthos, 5, 5);
}
@Test
public void testSuturedGhoul() {
String ghoul = "Sutured Ghoul"; // 4BBB */* Trample
// As Sutured Ghoul enters the battlefield, exile any number of creature cards from your graveyard.
// Sutured Ghoul's power is equal to the total power of the exiled cards and its toughness is equal to their total toughness.
String tymaret = "Tymaret, Chosen from Death"; // BB 2/*
// Tymaret's toughness is equal to your devotion to black.
String corpse = "Walking Corpse"; // 1B 2/2
String bogstomper = "Bogstomper"; // 4BB 6/5
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, corpse);
addCard(Zone.GRAVEYARD, playerA, tymaret, 1);
addCard(Zone.GRAVEYARD, playerA, bogstomper, 1);
addCard(Zone.HAND, playerA, ghoul);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 7);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, ghoul);
addTarget(playerA, tymaret + "^" + bogstomper);
// Total devotion is 3 + 1 so Tymaret has toughness 4 in all zones
// Therefore Sutured Ghoul exiling Tymaret and Bogstomper should have power 2+6 and toughness 4+5
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertExileCount(playerA, tymaret, 1);
assertExileCount(playerA, bogstomper, 1);
assertPowerToughness(playerA, ghoul, 8, 9);
}
}

View file

@ -0,0 +1,287 @@
package org.mage.test.cards.replacement.entersBattlefield;
import mage.abilities.keyword.DefenderAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.HasteAbility;
import mage.constants.PhaseStep;
import mage.constants.SubType;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author xenohedron
*/
public class PrimalClayTest extends CardTestPlayerBase {
private static final String clay = "Primal Clay";
// As Primal Clay enters the battlefield, it becomes your choice of a 3/3 artifact creature, a 2/2 artifact creature
// with flying, or a 1/6 Wall artifact creature with defender in addition to its other types.
private static final String plasma = "Primal Plasma";
// As Primal Plasma enters the battlefield, it becomes your choice of a 3/3 creature, a 2/2 creature with flying,
// or a 1/6 creature with defender.
private static final String sentry = "Molten Sentry";
// As Molten Sentry enters the battlefield, flip a coin. If the coin comes up heads, Molten Sentry enters the battlefield
// as a 5/2 creature with haste. If it comes up tails, Molten Sentry enters the battlefield as a 2/5 creature with defender.
private static final String aquamorph = "Aquamorph Entity";
// As Aquamorph Entity enters the battlefield or is turned face up, it becomes your choice of 5/1 or 1/5.
private static final String tunnel = "Tunnel";
// Destroy target Wall. It can't be regenerated.
private static final String clone = "Clone";
// You may have Clone enter the battlefield as a copy of any creature on the battlefield.
private static final String cryptoplasm = "Cryptoplasm";
// At the beginning of your upkeep, you may have Cryptoplasm become a copy of another target creature, except it has this ability.
private static final String cloudshift = "Cloudshift";
// Exile target creature you control, then return that card to the battlefield under your control.
@Test
public void testClayPTSet() {
addCard(Zone.HAND, playerA, clay);
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, clay);
setChoice(playerA, "a 3/3 artifact creature");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, clay, 3, 3);
}
@Test
public void testClayAbilityGained() {
addCard(Zone.HAND, playerA, clay);
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, clay);
setChoice(playerA, "a 2/2 artifact creature with flying");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, clay, 2, 2);
assertAbility(playerA, clay, FlyingAbility.getInstance(), true);
}
@Test
@Ignore("current workaround implementation doesn't account for this")
public void testClaySubtypeGained() {
addCard(Zone.HAND, playerA, clay);
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, clay);
setChoice(playerA, "a 1/6 Wall artifact creature with defender");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, clay, 1, 6);
assertAbility(playerA, clay, DefenderAbility.getInstance(), true);
assertSubtype(clay, SubType.WALL);
}
@Test
public void testClayCopyPTOnBattlefield() {
addCard(Zone.HAND, playerA, clay);
addCard(Zone.HAND, playerA, cryptoplasm);
addCard(Zone.BATTLEFIELD, playerA, "Island", 7);
addCard(Zone.BATTLEFIELD, playerB, "Plains", 3);
addCard(Zone.HAND, playerB, "The Battle of Bywater", 1);
// Destroy all creatures with power 3 or greater. Then create a Food token for each creature you control.
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, clay);
setChoice(playerA, "a 3/3 artifact creature");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, cryptoplasm);
// cryptoplasm trigger at next upkeep
setChoice(playerA, true); // whether to copy
addTarget(playerA, clay); // what to copy
castSpell(4, PhaseStep.PRECOMBAT_MAIN, playerB, "The Battle of Bywater");
// since cryptoplasm now a 3/3, both are destroyed
setStrictChooseMode(true);
setStopAt(4, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertGraveyardCount(playerA, clay, 1);
assertGraveyardCount(playerA, cryptoplasm, 1);
}
@Ignore("Chosen characteristics of Primal Clay should be copiable values")
@Test
public void testClayCopySubtypeOnBattlefield() {
addCard(Zone.HAND, playerA, clay);
addCard(Zone.HAND, playerA, cryptoplasm);
addCard(Zone.BATTLEFIELD, playerA, "Island", 7);
addCard(Zone.HAND, playerB, tunnel, 2);
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, clay);
setChoice(playerA, "a 1/6 Wall artifact creature with defender");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, cryptoplasm);
// cryptoplasm trigger at next upkeep
setChoice(playerA, true); // whether to copy
addTarget(playerA, clay); // what to copy
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerB, tunnel, clay);
waitStackResolved(3, PhaseStep.PRECOMBAT_MAIN);
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerB, tunnel, clay);
setStrictChooseMode(true);
setStopAt(3, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, clay, 1);
assertGraveyardCount(playerA, cryptoplasm, 1);
}
@Test
public void testPlasmaClone() {
addCard(Zone.HAND, playerA, plasma);
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
addCard(Zone.HAND, playerB, clone);
addCard(Zone.BATTLEFIELD, playerB, "Island", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, plasma);
setChoice(playerA, "a 1/6 creature with defender");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, clone);
setChoice(playerB, true); // whether to copy
setChoice(playerB, plasma); // what to copy
setChoice(playerB, "a 2/2 creature with flying"); // new choice as ETB
setStrictChooseMode(true);
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, plasma, 1, 6);
assertPowerToughness(playerB, plasma, 2, 2);
assertAbility(playerB, plasma, FlyingAbility.getInstance(), true);
//assertAbility(playerB, plasma, DefenderAbility.getInstance(), true); TODO: this is a copiable value
}
@Test
public void testMoltenSentryClone() {
addCard(Zone.HAND, playerA, sentry);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
addCard(Zone.HAND, playerB, clone);
addCard(Zone.BATTLEFIELD, playerB, "Island", 4);
setFlipCoinResult(playerA, true);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, sentry);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, clone);
setChoice(playerB, true); // whether to copy
setFlipCoinResult(playerB, false);
setChoice(playerB, sentry); // what to copy
setStrictChooseMode(true);
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, sentry, 5, 2);
assertAbility(playerA, sentry, HasteAbility.getInstance(), true);
assertPowerToughness(playerB, sentry, 2, 5);
assertAbility(playerB, sentry, DefenderAbility.getInstance(), true);
}
@Test
public void testAquamorphEntityETB() {
addCard(Zone.HAND, playerA, aquamorph);
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, aquamorph);
setChoice(playerA, false); // not using morph
setChoice(playerA, "a 5/1 creature");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, aquamorph, 5, 1);
}
@Test
public void testAquamorphEntityUnmorph() {
addCard(Zone.HAND, playerA, aquamorph);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 6);
addCard(Zone.HAND, playerA, "Island");
addCard(Zone.HAND, playerA, "Savage Swipe", 1);
// Target creature you control gets +2/+2 until end of turn if its power is 2. Then it fights target creature you dont control.
addCard(Zone.BATTLEFIELD, playerB, "Siege Mastodon", 1); // 3/5 creature for fighting
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, aquamorph);
setChoice(playerA, true); // cast facedown as 2/2
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Savage Swipe");
addTarget(playerA, ""); // morph
addTarget(playerA, "Siege Mastodon");
// 2/2 becomes 4/4, fights 3/5, neither dies
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Island");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}{U}: Turn"); // unmorph
setChoice(playerA, "a 1/5 creature");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, aquamorph, 1 + 2, 5 + 2);
assertDamageReceived(playerA, aquamorph, 3);
assertDamageReceived(playerB, "Siege Mastodon", 4);
}
@Test
public void testClayFlicker() {
addCard(Zone.HAND, playerA, clay);
addCard(Zone.HAND, playerA, cloudshift);
addCard(Zone.BATTLEFIELD, playerA, "Waterkin Shaman");
// 2/1; Whenever a creature with flying enters the battlefield under your control, Waterkin Shaman gets +1/+1 until end of turn.
addCard(Zone.BATTLEFIELD, playerA, "Plains", 5);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, clay);
setChoice(playerA, "a 2/2 artifact creature with flying");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, cloudshift, clay);
setChoice(playerA, "a 3/3 artifact creature");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, clay, 3, 3);
assertPowerToughness(playerA, "Waterkin Shaman", 2 + 1, 1 + 1);
assertAbility(playerA, clay, FlyingAbility.getInstance(), false);
}
@Test
public void testClayFlickerWall() {
addCard(Zone.HAND, playerA, clay);
addCard(Zone.HAND, playerA, cloudshift);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 5);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, clay);
setChoice(playerA, "a 1/6 artifact creature with defender");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, cloudshift, clay);
setChoice(playerA, "a 3/3 artifact creature");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, clay, 3, 3);
assertNotSubtype(clay, SubType.WALL);
}
}