Manifest abilities - improved combo support for MDF, split and other cards (related to #10803, part of #11873)

This commit is contained in:
Oleg Agafonov 2024-03-02 14:49:17 +04:00
parent 6cd8359fbd
commit 11ddfa0087
5 changed files with 136 additions and 9 deletions

View file

@ -1,5 +1,6 @@
package org.mage.test.cards.abilities.keywords;
import mage.MageObject;
import mage.cards.Card;
import mage.cards.repository.TokenRepository;
import mage.constants.EmptyNames;
@ -118,6 +119,102 @@ public class ManifestTest extends CardTestPlayerBase {
Assert.assertEquals("manifested cards must be taken from opponent's library", 2, playerA.getLibrary().size() - playerB.getLibrary().size());
}
private void runManifestThenBlink(String cardToManifest, String cardAfterBlink) {
// split, mdfc and other cards must be able to manifested
// bug: https://github.com/magefree/mage/issues/10608
skipInitShuffling();
// Manifest the top card of your library.
addCard(Zone.HAND, playerA, "Soul Summons", 1); // {1}{W}, sorcery
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
//
// Exile target creature you control, then return that card to the battlefield under your control.
addCard(Zone.HAND, playerA, "Cloudshift", 1); // {W}, instant
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
//
addCard(Zone.LIBRARY, playerA, cardToManifest, 1);
// manifest
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Soul Summons");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
checkPermanentCount("need face down", 1, PhaseStep.PRECOMBAT_MAIN, playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
// blink
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cloudshift", EmptyNames.FACE_DOWN_CREATURE.toString());
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
checkPermanentCount("need no face down", 1, PhaseStep.PRECOMBAT_MAIN, playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
runCode("after blink", 1, PhaseStep.PRECOMBAT_MAIN, playerA, (info, player, game) -> {
if (cardAfterBlink == null) {
Assert.assertEquals("after blink card must keep in exile",
1, currentGame.getExile().getAllCardsByRange(currentGame, playerA.getId()).size());
} else {
String realPermanentName = currentGame.getBattlefield().getAllPermanents()
.stream()
.filter(p -> p.getName().equals(cardAfterBlink))
.map(MageObject::getName)
.findFirst()
.orElse(null);
Assert.assertEquals("after blink card must go to battlefield",
cardAfterBlink, realPermanentName);
}
});
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
}
@Test
public void test_ManifestThenBlink_Creature() {
runManifestThenBlink("Grizzly Bears", "Grizzly Bears");
}
@Test
public void test_ManifestThenBlink_Instant() {
runManifestThenBlink("Lightning Bolt", null);
}
@Test
public void test_ManifestThenBlink_MDFC_Creature() {
runManifestThenBlink("Akoum Warrior // Akoum Teeth", "Akoum Warrior");
}
@Test
public void test_ManifestThenBlink_MDFC_LandOnMainSide() {
runManifestThenBlink("Barkchannel Pathway // Tidechannel Pathway", "Barkchannel Pathway");
}
@Test
public void test_ManifestThenBlink_MDFC_LandOnSecondSide() {
runManifestThenBlink("Bala Ged Recovery // Bala Ged Sanctuary", null);
}
@Test
public void test_ManifestThenBlink_Split_Normal() {
runManifestThenBlink("Assault // Battery", null);
}
@Test
public void test_ManifestThenBlink_Split_Fused() {
runManifestThenBlink("Alive // Well", null);
}
@Test
public void test_ManifestThenBlink_Split_Aftermath() {
runManifestThenBlink("Dusk // Dawn", null);
}
@Test
public void test_ManifestThenBlink_Meld() {
runManifestThenBlink("Graf Rats", "Graf Rats");
}
@Test
public void test_ManifestThenBlink_Adventure() {
runManifestThenBlink("Ardenvale Tactician // Dizzying Swoop", "Ardenvale Tactician");
}
/**
* Tests that ETB triggered abilities did not trigger for manifested cards
*/

View file

@ -1219,6 +1219,7 @@ public class TestPlayer implements Player {
.map(c -> (((c instanceof PermanentToken) ? "[T] " : "[C] ")
+ c.getIdName()
+ (c.isCopy() ? " [copy of " + c.getCopyFrom().getId().toString().substring(0, 3) + "]" : "")
+ " class " + c.getMainCard().getClass().getSimpleName() + ""
+ " - " + c.getPower().getValue() + "/" + c.getToughness().getValue()
+ (c.isPlaneswalker(game) ? " - L" + c.getCounters(game).getCount(CounterType.LOYALTY) : "")
+ ", " + (c.isTapped() ? "Tapped" : "Untapped")