From 17afa3b3c13cc1e7dd52509ff9f4aeee4860844f Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 9 Mar 2018 15:51:31 +0100 Subject: [PATCH] * Added a test. --- .../CastSplitCardsFromOtherZonesTest.java | 31 +++++++++++++++++++ .../java/mage/abilities/effects/Effect.java | 22 +++++++++++++ 2 files changed, 53 insertions(+) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/cost/splitcards/CastSplitCardsFromOtherZonesTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/cost/splitcards/CastSplitCardsFromOtherZonesTest.java index fcec6f5e2ca..d6430520c35 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/cost/splitcards/CastSplitCardsFromOtherZonesTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/cost/splitcards/CastSplitCardsFromOtherZonesTest.java @@ -124,4 +124,35 @@ public class CastSplitCardsFromOtherZonesTest extends CardTestPlayerBase { assertGraveyardCount(playerB, "Icy Manipulator", 1); } + + /** + * Cast a split card half from exile + */ + @Test + public void testCastSpliHalfFromExile() { + // Fire Instant {1}{R} + // Fire deals 2 damage divided as you choose among one or two target creatures and/or players. + // Ice Instant {1}{U} + // Tap target permanent. + // Draw a card. + addCard(Zone.LIBRARY, playerA, "Fire // Ice", 1); + skipInitShuffling(); + addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); // Creature 2/2 + + // Whenever Etali, Primal Storm attacks, exile the top card of each player's library, then you may + // cast any number of nonland cards exiled this way without paying their mana costs. + addCard(Zone.BATTLEFIELD, playerB, "Etali, Primal Storm"); // Creature {4}{R} 6/6 + + attack(2, playerB, "Etali, Primal Storm"); + setChoice(playerB, "Yes"); + setChoice(playerB, "Cast Fire"); + addTarget(playerB, "Silvercoat Lion"); + + setStopAt(2, PhaseStep.END_COMBAT); + execute(); + + assertLife(playerA, 14); + assertGraveyardCount(playerA, "Silvercoat Lion", 1); + assertGraveyardCount(playerA, "Fire // Ice", 1); + } } diff --git a/Mage/src/main/java/mage/abilities/effects/Effect.java b/Mage/src/main/java/mage/abilities/effects/Effect.java index fc98f40a947..cc7d51c7b34 100644 --- a/Mage/src/main/java/mage/abilities/effects/Effect.java +++ b/Mage/src/main/java/mage/abilities/effects/Effect.java @@ -46,12 +46,34 @@ public interface Effect extends Serializable { void newId(); + /** + * Some general behaviours for rule text handling: Rule text of effects get + * automatically a full stop "." at the end, if not another effect e.g. with + * a starting "and" follows. So at least for effects of the framework, that + * are used from multiple cards, it's better to set no full stop at the end + * of the rule text of an effect. Also the starting letter of an effect is + * automatically converted to upper case if the rule text starts with this + * text. So There is no need to let the effect text start with upper case, + * even if extracted from a filter message. Also here it's important to use + * only lower cases for effects located in the framework, so if used for a + * triggered abilitiy, the effect text needs to start with lower case after + * the comma. + * + * @param mode the selected mode of the ability (mostly there is only one) + * @return + */ String getText(Mode mode); Effect setText(String staticText); boolean apply(Game game, Ability source); + /** + * The outcome is used for the AI to decide if an effect does bad or good to + * the targets. + * + * @return + */ Outcome getOutcome(); void setOutcome(Outcome outcome);