From eea43662e150524d909059469dac428a1254d0ad Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 3 Jun 2015 20:16:58 +0200 Subject: [PATCH] Added test. --- .../mage/sets/darksteel/DarksteelCitadel.java | 4 + .../mage/sets/shadowmoor/FracturingGust.java | 2 - .../abilities/keywords/FlashbackTest.java | 78 +++++++++++++++++++ .../mage/game/permanent/PermanentImpl.java | 1 - 4 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/FlashbackTest.java diff --git a/Mage.Sets/src/mage/sets/darksteel/DarksteelCitadel.java b/Mage.Sets/src/mage/sets/darksteel/DarksteelCitadel.java index 8fab79820b4..d230e02a283 100644 --- a/Mage.Sets/src/mage/sets/darksteel/DarksteelCitadel.java +++ b/Mage.Sets/src/mage/sets/darksteel/DarksteelCitadel.java @@ -44,7 +44,11 @@ public class DarksteelCitadel extends CardImpl { public DarksteelCitadel (UUID ownerId) { super(ownerId, 164, "Darksteel Citadel", Rarity.COMMON, new CardType[]{CardType.ARTIFACT, CardType.LAND}, null); this.expansionSetCode = "DST"; + + // Indestructible (Effects that say "destroy" don't destroy this land.) this.addAbility(IndestructibleAbility.getInstance()); + + // {T}: Add {1} to your mana pool. this.addAbility(new ColorlessManaAbility()); } diff --git a/Mage.Sets/src/mage/sets/shadowmoor/FracturingGust.java b/Mage.Sets/src/mage/sets/shadowmoor/FracturingGust.java index b214901a10d..f8b990c0278 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/FracturingGust.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/FracturingGust.java @@ -51,7 +51,6 @@ public class FracturingGust extends CardImpl { super(ownerId, 227, "Fracturing Gust", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{2}{G/W}{G/W}{G/W}"); this.expansionSetCode = "SHM"; - // Destroy all artifacts and enchantments. You gain 2 life for each permanent destroyed this way. this.getSpellAbility().addEffect(new FracturingGustDestroyEffect()); } @@ -94,7 +93,6 @@ class FracturingGustDestroyEffect extends OneShotEffect { for (Permanent permanent: game.getState().getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if (permanent.destroy(source.getSourceId(), game, false)) { ++destroyedPermanents; - } } game.applyEffects(); // needed in case a destroyed permanent did prevent life gain diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/FlashbackTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/FlashbackTest.java new file mode 100644 index 00000000000..e3786359193 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/FlashbackTest.java @@ -0,0 +1,78 @@ +/* + * 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.keywords; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author LevelX2 + */ +public class FlashbackTest extends CardTestPlayerBase { + + /** + * Fracturing Gust is bugged. In a match against Affinity, it worked + * properly when cast from hand. When I cast it from graveyard c/o + * Snapcaster Mage flashback, it destroyed my opponent's Darksteel Citadels, + * which it did not do when cast from my hand. + */ + @Test + public void testSnapcasterMageWithFracturingGust() { + addCard(Zone.BATTLEFIELD, playerA, "Island", 2); + addCard(Zone.BATTLEFIELD, playerA, "Forest", 5); + addCard(Zone.HAND, playerA, "Snapcaster Mage", 1); + + // Destroy all artifacts and enchantments. You gain 2 life for each permanent destroyed this way. + addCard(Zone.GRAVEYARD, playerA, "Fracturing Gust"); + + addCard(Zone.BATTLEFIELD, playerA, "Berserkers' Onslaught", 1); + addCard(Zone.BATTLEFIELD, playerB, "Darksteel Citadel", 1); + + + // When Snapcaster Mage enters the battlefield, target instant or sorcery card in your graveyard gains flashback until end of turn. The flashback cost is equal to its mana cost. + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Snapcaster Mage"); + setChoice(playerA, "Fracturing Gust"); + + activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Flashback {2}{G/W}{G/W}{G/W}"); // now snapcaster mage is died so -13/-13 + + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertPermanentCount(playerA, "Snapcaster Mage", 1); + assertGraveyardCount(playerA, "Berserkers' Onslaught", 1); + + assertPermanentCount(playerB, "Darksteel Citadel", 1); + + assertExileCount("Fracturing Gust", 1); + } + +} diff --git a/Mage/src/mage/game/permanent/PermanentImpl.java b/Mage/src/mage/game/permanent/PermanentImpl.java index 098313d6337..5bfc16c5428 100644 --- a/Mage/src/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/mage/game/permanent/PermanentImpl.java @@ -30,7 +30,6 @@ package mage.game.permanent; import java.util.ArrayList; import java.util.Collections; -import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator;