From 5d7e12d6dfc78510b3d9ac0d0493342deb807875 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Thu, 9 Oct 2014 16:20:33 +0200 Subject: [PATCH] * Fixed a bug, that if a spell with a spell cast triggered ability (e.g. Ulamog, the Infinite Gyre) was successfully countered, the triggered ability was unintended removed from the stack with the spell. --- .../triggers/UlamogTheInfiniteGyreTest.java | 67 +++++++++++++++++++ Mage/src/mage/cards/CardImpl.java | 2 +- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/triggers/UlamogTheInfiniteGyreTest.java diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/UlamogTheInfiniteGyreTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/UlamogTheInfiniteGyreTest.java new file mode 100644 index 00000000000..44a39cd25c7 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/UlamogTheInfiniteGyreTest.java @@ -0,0 +1,67 @@ +/* + * 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.triggers; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author LevelX2 + */ + +public class UlamogTheInfiniteGyreTest extends CardTestPlayerBase { + + /** + * Tests if Ulamog, the Infinite Gyre is countered its triggered ability resolves anyway + */ + @Test + public void testDisabledEffectOnChangeZone() { + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 11); + addCard(Zone.HAND, playerA, "Ulamog, the Infinite Gyre"); + + addCard(Zone.BATTLEFIELD, playerB, "Island", 2); + addCard(Zone.HAND, playerB, "Counterspell", 1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ulamog, the Infinite Gyre"); + addTarget(playerA, "Island"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Counterspell", "Ulamog, the Infinite Gyre", "Ulamog, the Infinite Gyre"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + + assertHandCount(playerA, "Ulamog, the Infinite Gyre", 0); + assertPermanentCount(playerA, "Ulamog, the Infinite Gyre", 0); + assertGraveyardCount(playerB, "Counterspell", 1); + assertPermanentCount(playerB, "Island", 1); + } + +} diff --git a/Mage/src/mage/cards/CardImpl.java b/Mage/src/mage/cards/CardImpl.java index 2a82bed3a18..c808fc50ac7 100644 --- a/Mage/src/mage/cards/CardImpl.java +++ b/Mage/src/mage/cards/CardImpl.java @@ -326,7 +326,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { game.getState().getCommand().remove((Commander)game.getObject(objectId)); break; case STACK: - StackObject stackObject = game.getStack().getStackObject(getId()); + StackObject stackObject = game.getStack().getSpell(getId()); if (stackObject != null) { game.getStack().remove(stackObject); }