diff --git a/Mage.Sets/src/mage/sets/modernmasters2015/Spellskite.java b/Mage.Sets/src/mage/sets/modernmasters2015/Spellskite.java new file mode 100644 index 0000000000..dfa4f67e7b --- /dev/null +++ b/Mage.Sets/src/mage/sets/modernmasters2015/Spellskite.java @@ -0,0 +1,52 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.modernmasters2015; + +import java.util.UUID; + +/** + * + * @author fireshoes + */ +public class Spellskite extends mage.sets.newphyrexia.Spellskite { + + public Spellskite(UUID ownerId) { + super(ownerId); + this.cardNumber = 230; + this.expansionSetCode = "MMB"; + } + + public Spellskite(final Spellskite card) { + super(card); + } + + @Override + public Spellskite copy() { + return new Spellskite(this); + } +} diff --git a/Mage.Sets/src/mage/sets/modernmasters2015/SplinterTwin.java b/Mage.Sets/src/mage/sets/modernmasters2015/SplinterTwin.java new file mode 100644 index 0000000000..f5ea21519a --- /dev/null +++ b/Mage.Sets/src/mage/sets/modernmasters2015/SplinterTwin.java @@ -0,0 +1,52 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.modernmasters2015; + +import java.util.UUID; + +/** + * + * @author fireshoes + */ +public class SplinterTwin extends mage.sets.riseoftheeldrazi.SplinterTwin { + + public SplinterTwin(UUID ownerId) { + super(ownerId); + this.cardNumber = 129; + this.expansionSetCode = "MMB"; + } + + public SplinterTwin(final SplinterTwin card) { + super(card); + } + + @Override + public SplinterTwin copy() { + return new SplinterTwin(this); + } +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counterspell/CrypticCommandTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counterspell/CrypticCommandTest.java index ea031d4976..804af9f69d 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counterspell/CrypticCommandTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counterspell/CrypticCommandTest.java @@ -80,5 +80,44 @@ public class CrypticCommandTest extends CardTestPlayerBase { assertHandCount(playerB, 0); // Because Cryptic Command has no legal target playerB does not draw a card and has 0 cards in hand } - + /** + * Game is not letting me play Ricochet Trap targetting oponent's Cryptic Command, + * modes 1 and 4. It only has one target and should be allowed + */ + @Test + public void testCommandChangeTarget() { + addCard(Zone.HAND, playerA, "Thoughtseize"); + // Counter target spell. If that spell is countered this way, put it into its owner's hand instead of into that player's graveyard. + // Draw a card. + addCard(Zone.HAND, playerA, "Ricochet Trap"); + addCard(Zone.HAND, playerA, "Lightning Bolt"); + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5); + + addCard(Zone.HAND, playerB, "Cryptic Command"); + addCard(Zone.BATTLEFIELD, playerB, "Island", 4); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Thoughtseize", playerB); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Cryptic Command", "Thoughtseize"); + setModeChoice(playerB, "1"); // Counter target spell + setModeChoice(playerB, "4"); // Draw a card + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ricochet Trap", "Cryptic Command"); + addTarget(playerA, "Lightning Bolt"); + + setStopAt(1, PhaseStep.CLEANUP); + execute(); + + assertLife(playerA, 18); // -2 from Thoughtseize + assertLife(playerB, 20); + + assertGraveyardCount(playerA, "Ricochet Trap", 1); + assertGraveyardCount(playerA, "Thoughtseize", 1); + assertGraveyardCount(playerB, "Cryptic Command", 1); + assertGraveyardCount(playerA, "Lightning Bolt", 1); + + assertHandCount(playerB, 1); // card drawn from Cryptic Command + + } } diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index 1effa04962..edcd277a89 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -68,6 +68,7 @@ import mage.abilities.mana.ManaOptions; import mage.cards.Card; import mage.constants.Zone; import mage.target.TargetSource; +import mage.target.TargetSpell; import mage.target.common.TargetCardInHand; import mage.target.common.TargetPermanentOrPlayer; @@ -445,6 +446,26 @@ public class TestPlayer extends ComputerPlayer { } } + if (target instanceof TargetSpell) { + for (String targetDefinition: targets) { + String[] targetList = targetDefinition.split("\\^"); + boolean targetFound = false; + for (String targetName: targetList) { + for(StackObject stackObject: game.getStack()) { + if (stackObject.getName().equals(targetName)) { + target.add(stackObject.getId(), game); + targetFound = true; + break; + } + } + } + if (targetFound) { + targets.remove(targetDefinition); + return true; + } + } + } + } return super.chooseTarget(outcome, target, source, game); diff --git a/Mage/src/mage/filter/predicate/mageobject/NumberOfTargetsPredicate.java b/Mage/src/mage/filter/predicate/mageobject/NumberOfTargetsPredicate.java index bc4b271f43..787a14d2ac 100644 --- a/Mage/src/mage/filter/predicate/mageobject/NumberOfTargetsPredicate.java +++ b/Mage/src/mage/filter/predicate/mageobject/NumberOfTargetsPredicate.java @@ -27,7 +27,9 @@ */ package mage.filter.predicate.mageobject; +import java.util.UUID; import mage.MageObject; +import mage.abilities.Mode; import mage.filter.predicate.Predicate; import mage.game.Game; import mage.game.stack.Spell; @@ -50,10 +52,12 @@ public class NumberOfTargetsPredicate implements Predicate { public boolean apply(MageObject input, Game game) { Spell spell = game.getStack().getSpell(input.getId()); if (spell != null) { - Targets spellTargets = spell.getSpellAbility().getTargets(); int numberOfTargets = 0; - for (Target target : spellTargets) { - numberOfTargets += target.getTargets().size(); + for (UUID modeId : spell.getSpellAbility().getModes().getSelectedModes()) { + Mode mode = spell.getSpellAbility().getModes().get(modeId); + for (Target target : mode.getTargets()) { + numberOfTargets += target.getTargets().size(); + } } if (numberOfTargets == targets) { return true; diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index 9ce488cbe3..d554f9005e 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -25943,7 +25943,9 @@ Forest|Dragons of Tarkir|264|L||Basic Land - Forest|||G| Emrakul, the Aeons Torn|Modern Masters 2015|3|M|{15}|Legendary Creature - Eldrazi|15|15|Emrakul, the Aeons Torn can't be countered.$When you cast Emrakul, take an extra turn after this one.$Flying, protection from colored spells, annihilator 6$When Emrakul is put into a graveyard from anywhere, its owner shuffles his or her graveyard into his or her library.| Karn Liberated|Modern Masters 2015|4|M|{7}|Planeswalker - Karn|||+4: Target player exiles a card from his or her hand.$-3: Exile target permanent.$-14: Restart the game, leaving in exile all non-Aura permanent cards exiled with Karn Liberated. Then put those cards onto the battlefield under your control.| Vendilion Clique|Modern Masters 2015|67|M|{1}{U}{U}|Legendary Creature Faerie Wizard|3|1|Flash$Flying$When Vendilion Clique enters the battlefield, look at target player's hand. You may choose a nonland card from it. If you do, that player reveals the chosen card, puts it on the bottom of his or her library, then draws a card.| +Splinter Twin|Modern Masters 2015|129|R|{2}{R}{R}|Enchantment - Aura|||Enchant creature$Enchanted creature has "{T}: Put a token that's a copy of this creature onto the battlefield. That token has haste. Exile it at the beginning of the next end step."| Tarmogoyf|Modern Masters 2015|165|M|{1}{G}|Creature - Lhurgoyf|*|1+*|Tarmogoyf's power is equal to the number of card types among cards in all graveyards and its toughness is equal to that number plus 1. (Artifact, creature, enchantment, instant, land, planeswalker, sorcery, and tribal are card types.)| +Spellskite|Modern Masters 2015|230|R|{2}|Artifact Creature - Horror|0|4|{UP}: Change a target of target spell or ability to Spellskite. ({UP} can be paid with either {U} or 2 life.)| Liliana, Heretical Healer|Magic Origins|106|M|{1}{B}{B}|Legendary Creature - Human Cleric|2|3|Lifelink$Whenever another nontoken creature you control dies, exile Liliana, Heretical Healer, then return her to the battlefield transformed under her owner's control. If you do, put a 2/2 black Zombie creature token onto the battlefield.| Liliana, Defiant Necromancer|Magic Origins|106|M||Planeswalker - Liliana|||+2: Each player discards a card.$-X: Return target nonlegendary creature card with converted mana cost X from your graveyard to the battlefield.$-8: You get an emble with "Whenever a creature dies, return it to the battlefield under your control at the beginning of the next end step."| Ambush Commander|Duel Decks: Anthology, Elves vs. Goblins|1|R|{3}{G}{G}|Creature - Elf|2|2|Forests you control are 1/1 green Elf creatures that are still lands.${1}{G}, Sacrifice an Elf: Target creature gets +3/+3 until end of turn.|