* Splice onto Arcane - Fixed that an arcane spell with no targets did not fizzle if a targeted spell was spliced with it that has no more legal targets on resolution (so all targets of the spell were illegal).

This commit is contained in:
LevelX2 2015-09-21 17:57:27 +02:00
parent 7224ab1614
commit 822528d05c
6 changed files with 224 additions and 78 deletions

View file

@ -25,14 +25,13 @@
* authors and should not be interpreted as representing official policies, either expressed * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.sets.alarareborn; package mage.sets.alarareborn;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
/** /**
@ -45,8 +44,6 @@ public class Terminate extends CardImpl {
super(ownerId, 46, "Terminate", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{B}{R}"); super(ownerId, 46, "Terminate", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{B}{R}");
this.expansionSetCode = "ARB"; this.expansionSetCode = "ARB";
// Destroy target creature. It can't be regenerated. // Destroy target creature. It can't be regenerated.
this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new DestroyTargetEffect(true)); this.getSpellAbility().addEffect(new DestroyTargetEffect(true));

View file

@ -25,15 +25,14 @@
* authors and should not be interpreted as representing official policies, either expressed * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.sets.conflux; package mage.sets.conflux;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.effects.common.ExileTargetEffect; import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
@ -57,6 +56,7 @@ public class CelestialPurge extends CardImpl {
super(ownerId, 5, "Celestial Purge", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{W}"); super(ownerId, 5, "Celestial Purge", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{W}");
this.expansionSetCode = "CON"; this.expansionSetCode = "CON";
// Exile target black or red permanent.
this.getSpellAbility().addTarget(new TargetPermanent(filter)); this.getSpellAbility().addTarget(new TargetPermanent(filter));
this.getSpellAbility().addEffect(new ExileTargetEffect()); this.getSpellAbility().addEffect(new ExileTargetEffect());
} }

View file

@ -51,7 +51,6 @@ public class Bitterblossom extends CardImpl {
this.expansionSetCode = "MOR"; this.expansionSetCode = "MOR";
this.subtype.add("Faerie"); this.subtype.add("Faerie");
// At the beginning of your upkeep, you lose 1 life and put a 1/1 black Faerie Rogue creature token with flying onto the battlefield. // At the beginning of your upkeep, you lose 1 life and put a 1/1 black Faerie Rogue creature token with flying onto the battlefield.
Ability ability = new BeginningOfUpkeepTriggeredAbility(new LoseLifeSourceControllerEffect(1), TargetController.YOU, false); Ability ability = new BeginningOfUpkeepTriggeredAbility(new LoseLifeSourceControllerEffect(1), TargetController.YOU, false);
ability.addEffect(new CreateTokenEffect(new FaerieToken(), 1)); ability.addEffect(new CreateTokenEffect(new FaerieToken(), 1));
@ -69,6 +68,7 @@ public class Bitterblossom extends CardImpl {
} }
class FaerieToken extends Token { class FaerieToken extends Token {
FaerieToken() { FaerieToken() {
super("Faerie Rogue", "1/1 black Faerie Rogue creature token with flying"); super("Faerie Rogue", "1/1 black Faerie Rogue creature token with flying");
cardType.add(CardType.CREATURE); cardType.add(CardType.CREATURE);

View file

@ -38,12 +38,11 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
* *
* @author LevelX2 * @author LevelX2
*/ */
public class SpliceOnArcaneTest extends CardTestPlayerBase { public class SpliceOnArcaneTest extends CardTestPlayerBase {
/** /**
* Test that it works to cast Through the Breach * Test that it works to cast Through the Breach by slicing it on an arcane
* by slicing it on an arcane spell * spell
* *
*/ */
@Test @Test
@ -102,6 +101,7 @@ public class SpliceOnArcaneTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Mountain", 0); assertPermanentCount(playerA, "Mountain", 0);
Assert.assertEquals("No more mana available", "[]", playerA.getManaAvailable(currentGame).toString()); Assert.assertEquals("No more mana available", "[]", playerA.getManaAvailable(currentGame).toString());
} }
/** /**
* Nourishing Shoal's interaction with Splicing Through the Breach is * Nourishing Shoal's interaction with Splicing Through the Breach is
* bugged. You should still need to pay 2RR as an additional cost, which is * bugged. You should still need to pay 2RR as an additional cost, which is
@ -140,5 +140,65 @@ public class SpliceOnArcaneTest extends CardTestPlayerBase {
Assert.assertEquals("All available mana has to be used", "[]", playerA.getManaAvailable(currentGame).toString()); Assert.assertEquals("All available mana has to be used", "[]", playerA.getManaAvailable(currentGame).toString());
} }
/**
* Cards involved: Nourishing Shoal, Goryo's Vengeance, Griselbrand,
* Terminate
*
* I actually noticed this bug on the 1.4.3 client, but I didn't see it in
* the change log for 1.4.4, so I assume it is still unknown. Also, it is a
* bit of a rules corner case and I haven't seen anyone else report it, so
* the players of this deck may actually not realize it's incorrect.
*
* The scenario was that I cast a Nourishing Shoal with a Goryo's Vengeance
* spliced to it targeting Griselbrand in my graveyard and exiling
* Worldspine Wurm. My opponent responded with a Snapcaster Mage, so to
* deprive him of his ability to reuse his counterspell, I cast the Goryo's
* Vengeance on the Griselbrand. This one resolved. He then used Terminate
* on the Griselbrand after I had activated it once. When the Shoal tried to
* resolve, it should have been countered due to no legal target. However,
* it caused me to gain 11 life. It did not resurrect Griselbrand
* (correctly), but it should have done nothing at all.
*
* I include the info about the Terminate because thinking through, it could
* be pertinent. I would guess what is going on here is one of two things.
* Either the client doesn't recognize the Shoal with a spliced Vengeance as
* a spell with a single target (because Shoal normally doesn't have a
* target) or because the Griselbrand ended up back in the graveyard before
* the Shoal tried to resolve, the client thought its target was still
* valid. I lean toward the former since the Shoal/Vengeance properly failed
* to resurrect the now dead again Griselbrand, so I don't think it was
* reading that as the target, but I'm not certain. I will try to reproduce
* the error against a bot and update this report.
*/
@Test
public void testCounteredBecauseOfNoLegalTarget() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 8);
// You may exile a green card with converted mana cost X from your hand rather than pay Nourishing Shoal's mana cost.
// You gain X life.
addCard(Zone.HAND, playerA, "Nourishing Shoal", 1); // "{X}{G}{G}"
// Return target legendary creature card from your graveyard to the battlefield. That creature gains haste. Exile it at the beginning of the next end step.
// Splice onto Arcane {2}{B}
addCard(Zone.HAND, playerA, "Goryo's Vengeance", 1); // {1}{B}
addCard(Zone.GRAVEYARD, playerA, "Griselbrand", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nourishing Shoal");
setChoice(playerA, "X=3");
setChoice(playerA, "Yes"); // splice
addTarget(playerA, "Griselbrand");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Goryo's Vengeance", "Griselbrand", "Nourishing Shoal");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Nourishing Shoal", 1);
assertGraveyardCount(playerA, "Goryo's Vengeance", 1);
assertPermanentCount(playerA, "Griselbrand", 1);
assertLife(playerA, 20); // no life gain because Nourishing Shoal has to be countered having no legal targets (from Goryo's V.)
assertLife(playerB, 20);
}
} }

View file

@ -0,0 +1,68 @@
/*
* 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 org.mage.test.cards.abilities.oneshot.exile;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class CelestialPurgeTest extends CardTestPlayerBase {
/**
* I activated Celestial Purge trying to targeting a Bitterblossom but i
* couldn't so please fix that bug
*/
@Test
public void testExileWorks() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
// Exile target black or red permanent.
addCard(Zone.HAND, playerA, "Celestial Purge");
// At the beginning of your upkeep, you lose 1 life and put a 1/1 black Faerie Rogue creature token with flying onto the battlefield.
addCard(Zone.BATTLEFIELD, playerB, "Bitterblossom");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Celestial Purge", "Bitterblossom");
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 19);
assertGraveyardCount(playerA, "Celestial Purge", 1);
assertExileCount("Bitterblossom", 1);
assertPermanentCount(playerB, "Faerie Rogue", 1);
}
}

View file

@ -171,6 +171,7 @@ public class Spell extends StackObjImpl implements Card {
int index = 0; int index = 0;
result = false; result = false;
boolean legalParts = false; boolean legalParts = false;
boolean notTargeted = true;
// check for legal parts // check for legal parts
for (SpellAbility spellAbility : this.spellAbilities) { for (SpellAbility spellAbility : this.spellAbilities) {
// if muliple modes are selected, and there are modes with targets, then at least one mode has to have a legal target or // if muliple modes are selected, and there are modes with targets, then at least one mode has to have a legal target or
@ -178,10 +179,15 @@ public class Spell extends StackObjImpl implements Card {
// If all targets are illegal when the spell tries to resolve, the spell is countered and none of its effects happen. // If all targets are illegal when the spell tries to resolve, the spell is countered and none of its effects happen.
// If at least one target is still legal at that time, the spell resolves, but an illegal target can't perform any actions // If at least one target is still legal at that time, the spell resolves, but an illegal target can't perform any actions
// or have any actions performed on it. // or have any actions performed on it.
// if only a spliced spell has targets and all targets ar illegal, the complete spell is countered
if (hasTargets(spellAbility, game)) {
notTargeted = false;
legalParts |= spellAbilityHasLegalParts(spellAbility, game); legalParts |= spellAbilityHasLegalParts(spellAbility, game);
} }
}
// resolve if legal parts // resolve if legal parts
if (legalParts) { if (notTargeted || legalParts) {
for (SpellAbility spellAbility : this.spellAbilities) { for (SpellAbility spellAbility : this.spellAbilities) {
if (spellAbilityHasLegalParts(spellAbility, game)) { if (spellAbilityHasLegalParts(spellAbility, game)) {
for (UUID modeId : spellAbility.getModes().getSelectedModes()) { for (UUID modeId : spellAbility.getModes().getSelectedModes()) {
@ -262,6 +268,21 @@ public class Spell extends StackObjImpl implements Card {
} }
} }
private boolean hasTargets(SpellAbility spellAbility, Game game) {
if (spellAbility.getModes().getSelectedModes().size() > 1) {
for (UUID modeId : spellAbility.getModes().getSelectedModes()) {
spellAbility.getModes().setActiveMode(modeId);
if (!spellAbility.getTargets().isEmpty()) {
return true;
}
}
return false;
} else {
return !spellAbility.getTargets().isEmpty();
}
}
private boolean spellAbilityHasLegalParts(SpellAbility spellAbility, Game game) { private boolean spellAbilityHasLegalParts(SpellAbility spellAbility, Game game) {
if (spellAbility.getModes().getSelectedModes().size() > 1) { if (spellAbility.getModes().getSelectedModes().size() > 1) {
boolean targetedMode = false; boolean targetedMode = false;