* Split cards - added spliced effects support for fused spells, no more double splice pays (#6493, #6549);

This commit is contained in:
Oleg Agafonov 2020-06-10 09:58:21 +04:00
parent b38ac2f575
commit a75d08283f
5 changed files with 144 additions and 5 deletions

View file

@ -0,0 +1,99 @@
package org.mage.test.cards.split;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author JayDi85
*/
public class CastSplitCardsWithSpliceTest extends CardTestPlayerBase {
// splice cost applies for one fused spell, not to every part
// https://github.com/magefree/mage/issues/6493
@Test
public void test_ThaliaGuardianOfThraben_CostModification_Fused() {
removeAllCardsFromHand(playerA);
// Noncreature spells cost {1} more to cast.
addCard(Zone.BATTLEFIELD, playerA, "Thalia, Guardian of Thraben", 1);
//
// Wear {1}{R} Destroy target artifact.
// Tear {W} Destroy target enchantment.
addCard(Zone.HAND, playerA, "Wear // Tear", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2 + 1);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
addCard(Zone.BATTLEFIELD, playerB, "Bident of Thassa", 1); // Legendary Enchantment Artifact
addCard(Zone.BATTLEFIELD, playerB, "Bow of Nylea", 1); // Legendary Enchantment Artifact
// cast fused
// old bug: https://github.com/magefree/mage/issues/6493
// * getPlayable checks fused cost (+1 modification)
// * activate checks fused cost (+1 modification) andeach card's part (+1 modification)
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "fused Wear // Tear");
addTarget(playerA, "Bident of Thassa");
addTarget(playerA, "Bow of Nylea");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertGraveyardCount(playerA, "Wear // Tear", 1);
assertGraveyardCount(playerB, "Bident of Thassa", 1);
assertGraveyardCount(playerB, "Bow of Nylea", 1);
assertHandCount(playerA, 0);
// must used all mana
assertTappedCount("Mountain", true, 3);
assertTappedCount("Plains", true, 1);
}
@Test
public void test_ThaliaGuardianOfThraben_CostModification_FusedWithSplice() {
removeAllCardsFromHand(playerA);
// Noncreature spells cost {1} more to cast.
addCard(Zone.BATTLEFIELD, playerA, "Thalia, Guardian of Thraben", 1);
//
// Draw a card.
// Splice onto instant or sorcery {2}{U}
addCard(Zone.HAND, playerA, "Everdream", 1);
addCard(Zone.BATTLEFIELD, playerA, "Island", 3); // for splice
//
// Wear {1}{R} Destroy target artifact.
// Tear {W} Destroy target enchantment.
addCard(Zone.HAND, playerA, "Wear // Tear", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2 + 1);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
addCard(Zone.BATTLEFIELD, playerB, "Bident of Thassa", 1); // Legendary Enchantment Artifact
addCard(Zone.BATTLEFIELD, playerB, "Bow of Nylea", 1); // Legendary Enchantment Artifact
// cast fused with splice
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "fused Wear // Tear");
setChoice(playerA, "Yes"); // use splice
addTarget(playerA, "Everdream"); // card to splice
addTarget(playerA, "Bident of Thassa"); // target left
addTarget(playerA, "Bow of Nylea"); // target right
// must used all mana
//showAvaileableMana("after", 1, PhaseStep.POSTCOMBAT_MAIN, playerA);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertGraveyardCount(playerA, "Wear // Tear", 1);
assertGraveyardCount(playerB, "Bident of Thassa", 1);
assertGraveyardCount(playerB, "Bow of Nylea", 1);
assertHandCount(playerA, 2); // splice card + draw effect from spliced
// must used all mana
assertTappedCount("Island", true, 3);
assertTappedCount("Mountain", true, 3);
assertTappedCount("Plains", true, 1);
}
}

View file

@ -1077,6 +1077,7 @@ public class TestPlayer implements Player {
List<String> data = abilities.stream()
.map(a -> (a.getZone() + " -> "
+ a.getSourceObject(game).getIdName() + " -> "
+ (a.toString().startsWith("Cast ") ? "[" + a.getManaCostsToPay().getText() + "] -> " : "") // printed cost, not modified
+ (a.toString().length() > 0
? a.toString().substring(0, Math.min(20, a.toString().length()))
: a.getClass().getSimpleName())