diff --git a/Mage.Server/src/main/java/mage/server/tournament/TournamentController.java b/Mage.Server/src/main/java/mage/server/tournament/TournamentController.java index 7c43702d5c..0d69cf257a 100644 --- a/Mage.Server/src/main/java/mage/server/tournament/TournamentController.java +++ b/Mage.Server/src/main/java/mage/server/tournament/TournamentController.java @@ -294,7 +294,7 @@ public class TournamentController { TournamentPlayer player = tournament.getPlayer(playerId); if (player != null && !player.hasQuit()) { tournamentSessions.get(playerId).submitDeck(deck); - ChatManager.getInstance().broadcast(chatId, "", player.getPlayer().getLogName() + " has submitted his tournament deck", MessageColor.BLACK, true, MessageType.STATUS, SoundToPlay.PlayerSubmittedDeck); + ChatManager.getInstance().broadcast(chatId, "", player.getPlayer().getLogName() + " has submitted his or her tournament deck", MessageColor.BLACK, true, MessageType.STATUS, SoundToPlay.PlayerSubmittedDeck); } } } diff --git a/Mage.Sets/src/mage/sets/eldritchmoon/ThirstingAxe.java b/Mage.Sets/src/mage/sets/eldritchmoon/ThirstingAxe.java index d54f8ad59e..d80276c5b8 100644 --- a/Mage.Sets/src/mage/sets/eldritchmoon/ThirstingAxe.java +++ b/Mage.Sets/src/mage/sets/eldritchmoon/ThirstingAxe.java @@ -27,8 +27,12 @@ */ package mage.sets.eldritchmoon; +import java.util.HashSet; +import java.util.Set; import java.util.UUID; +import mage.MageObjectReference; +import mage.abilities.Ability; import mage.abilities.TriggeredAbility; import mage.abilities.common.BeginningOfYourEndStepTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; @@ -36,7 +40,6 @@ import mage.abilities.condition.CompoundCondition; import mage.abilities.condition.Condition; import mage.abilities.condition.InvertCondition; import mage.abilities.condition.common.AttachedCondition; -import mage.abilities.condition.common.WatcherCondition; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.SacrificeEquippedEffect; @@ -50,6 +53,7 @@ import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.watchers.Watcher; + /** * * @author Quercitron @@ -67,12 +71,12 @@ public class ThirstingAxe extends CardImpl { // At the beginning of your end step, if equipped creature didn't deal combat damage to a creature this turn, sacrifice it. TriggeredAbility ability = new BeginningOfYourEndStepTriggeredAbility(new SacrificeEquippedEffect(), false); Condition condition = new CompoundCondition( - new AttachedCondition(), - new InvertCondition(new WatcherCondition(CombatDamageToCreatureByEquippedWatcher.BASIC_KEY, WatcherScope.CARD))); + AttachedCondition.getInstance(), + new InvertCondition(new EquippedDealtCombatDamageToCreatureCondition())); String triggeredAbilityText = "At the beginning of your end step, if equipped creature " + "didn't deal combat damage to a creature this turn, sacrifice it."; ConditionalTriggeredAbility sacrificeTriggeredAbility = new ConditionalTriggeredAbility(ability, condition, triggeredAbilityText); - this.addAbility(sacrificeTriggeredAbility, new CombatDamageToCreatureByEquippedWatcher()); + this.addAbility(sacrificeTriggeredAbility, new CombatDamageToCreatureWatcher()); // Equip {2} this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2))); @@ -88,34 +92,62 @@ public class ThirstingAxe extends CardImpl { } } -class CombatDamageToCreatureByEquippedWatcher extends Watcher { +class EquippedDealtCombatDamageToCreatureCondition implements Condition { - public final static String BASIC_KEY = "CombatDamageToCreatureByEquippedWatcher"; - - public CombatDamageToCreatureByEquippedWatcher() { - super(BASIC_KEY, WatcherScope.CARD); + @Override + public boolean apply(Game game, Ability source) { + Permanent equipment = game.getPermanent(source.getSourceId()); + if (equipment != null && equipment.getAttachedTo() != null) { + CombatDamageToCreatureWatcher watcher = + (CombatDamageToCreatureWatcher) game.getState().getWatchers().get(CombatDamageToCreatureWatcher.BASIC_KEY); + return watcher.dealtDamage(equipment.getAttachedTo(), equipment.getAttachedToZoneChangeCounter(), game); + } + return false; } - public CombatDamageToCreatureByEquippedWatcher(final CombatDamageToCreatureByEquippedWatcher watcher) { +} + +class CombatDamageToCreatureWatcher extends Watcher { + + // which objects dealt combat damage to creature during the turn + public final Set dealtCombatDamageToCreature; + + public final static String BASIC_KEY = "CombatDamageToCreatureWatcher"; + + public CombatDamageToCreatureWatcher() { + super(BASIC_KEY, WatcherScope.GAME); + dealtCombatDamageToCreature = new HashSet<>(); + } + + public CombatDamageToCreatureWatcher(final CombatDamageToCreatureWatcher watcher) { super(watcher); + dealtCombatDamageToCreature = new HashSet<>(watcher.dealtCombatDamageToCreature); } @Override - public CombatDamageToCreatureByEquippedWatcher copy() { - return new CombatDamageToCreatureByEquippedWatcher(this); + public CombatDamageToCreatureWatcher copy() { + return new CombatDamageToCreatureWatcher(this); } @Override public void watch(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) { - Permanent equipment = game.getPermanent(this.getSourceId()); - if (equipment != null && equipment.getAttachedTo() != null) { - if (equipment.getAttachedTo().equals(event.getSourceId())) { - if (((DamagedCreatureEvent)event).isCombatDamage()) { - condition = true; - } - } + if (((DamagedCreatureEvent) event).isCombatDamage()) { + MageObjectReference damageSource = new MageObjectReference(event.getSourceId(), game); + dealtCombatDamageToCreature.add(damageSource); } } } + + @Override + public void reset() { + super.reset(); + dealtCombatDamageToCreature.clear(); + } + + public boolean dealtDamage(UUID objectId, int zoneChangeCounter, Game game) { + MageObjectReference reference = new MageObjectReference(objectId, zoneChangeCounter, game); + return dealtCombatDamageToCreature.contains(reference); + } + } diff --git a/Mage.Sets/src/mage/sets/fifthedition/Shrink.java b/Mage.Sets/src/mage/sets/fifthedition/Shrink.java new file mode 100644 index 0000000000..511057581a --- /dev/null +++ b/Mage.Sets/src/mage/sets/fifthedition/Shrink.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.fifthedition; + +import java.util.UUID; + +/** + * + * @author choiseul11 + */ +public class Shrink extends mage.sets.homelands.Shrink { + + public Shrink(UUID ownerId) { + super(ownerId); + this.cardNumber = "188"; + this.expansionSetCode = "5ED"; + } + + public Shrink(final Shrink card) { + super(card); + } + + @Override + public Shrink copy() { + return new Shrink(this); + } +} diff --git a/Mage.Sets/src/mage/sets/homelands/Shrink.java b/Mage.Sets/src/mage/sets/homelands/Shrink.java new file mode 100644 index 0000000000..3ec872acb5 --- /dev/null +++ b/Mage.Sets/src/mage/sets/homelands/Shrink.java @@ -0,0 +1,62 @@ +/* + * 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.homelands; + +import java.util.UUID; + +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author choiseul11 + */ +public class Shrink extends CardImpl { + + public Shrink(UUID ownerId) { + super(ownerId, 71, "Shrink", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{G}"); + this.expansionSetCode = "HML"; + + // Target creature gets -5/-0 until end of turn. + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addEffect(new BoostTargetEffect(-5, 0, Duration.EndOfTurn)); + } + + public Shrink(final Shrink card) { + super(card); + } + + @Override + public Shrink copy() { + return new Shrink(this); + } +} diff --git a/Mage.Sets/src/mage/sets/masterseditionii/Shrink.java b/Mage.Sets/src/mage/sets/masterseditionii/Shrink.java new file mode 100644 index 0000000000..1aed747885 --- /dev/null +++ b/Mage.Sets/src/mage/sets/masterseditionii/Shrink.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.masterseditionii; + +import java.util.UUID; + +/** + * + * @author choiseul11 + */ +public class Shrink extends mage.sets.homelands.Shrink { + + public Shrink(UUID ownerId) { + super(ownerId); + this.cardNumber = "175"; + this.expansionSetCode = "ME2"; + } + + public Shrink(final Shrink card) { + super(card); + } + + @Override + public Shrink copy() { + return new Shrink(this); + } +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/equipped/KusariGamaTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/equipped/KusariGamaTest.java new file mode 100644 index 0000000000..5b9a376270 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/equipped/KusariGamaTest.java @@ -0,0 +1,48 @@ +package org.mage.test.cards.abilities.equipped; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import mage.game.permanent.Permanent; +import org.junit.Assert; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) + */ +public class KusariGamaTest extends CardTestPlayerBase { + + // reported bug: trigger occurs but no damage is dealt + @Test + public void testTriggeredAbilityDealsDamage() { + + // Kusari-Gama - Artifact Equipment - Equip {3} + // Equipped creature has "2: This creature gets +1/+0 until end of turn." + // Whenever equipped creature deals damage to a blocking creature, Kusari-Gama deals that much damage to each other creature defending player controls. + addCard(Zone.BATTLEFIELD, playerA, "Kusari-Gama"); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 3); + addCard(Zone.BATTLEFIELD, playerA, "Sylvan Advocate"); // 2/3 vigilance {1}{G} + + addCard(Zone.BATTLEFIELD, playerB, "Wall of Omens"); // 0/4 {1}{W} + addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 2); // 2/2 {1}{W} + addCard(Zone.BATTLEFIELD, playerB, "Hill Giant"); // 3/3 {3}{R} + + activateAbility(1, PhaseStep.BEGIN_COMBAT, playerA, "Equip {3}", "Sylvan Advocate"); + attack(1, playerA, "Sylvan Advocate"); + block(1, playerB, "Wall of Omens", "Sylvan Advocate"); + setStopAt(1, PhaseStep.END_COMBAT); + execute(); + + assertPermanentCount(playerA, "Kusari-Gama", 1); + assertPermanentCount(playerB, "Wall of Omens", 1); + assertPermanentCount(playerB, "Hill Giant", 1); + + Permanent wallPerm = getPermanent("Wall of Omens", playerB); + Permanent giantPerm = getPermanent("Hill Giant", playerB); + Assert.assertEquals("Wall of Omens should have 2 damage dealt to it", 2, wallPerm.getDamage()); + Assert.assertEquals("Hill Giant should have 2 damage dealt to it", 2, giantPerm.getDamage()); + + assertGraveyardCount(playerB, "Silvercoat Lion", 2); + } +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EscalateTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EscalateTest.java index 8c94982111..34db143d05 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EscalateTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EscalateTest.java @@ -115,5 +115,45 @@ public class EscalateTest extends CardTestPlayerBase { assertGraveyardCount(playerB, "Gaddock Teeg", 1); assertLife(playerB, 17); } + + @Test + public void testSpellQuellerInteraction_ThreeCMC_ThreeModes() { + + // {1}{W}{U} Flash Flying 2/3 Spirit + // When Spell Queller enters the battlefield, exile target spell with converted mana cost 4 or less. + // When Spell Queller leaves the battlefield, the exiled card's owner may cast that card without paying its mana cost. + addCard(Zone.HAND, playerB, "Spell Queller"); + addCard(Zone.BATTLEFIELD, playerB, "Wall of Omens"); // {1}{W} 0/4 + addCard(Zone.BATTLEFIELD, playerB, "Island", 2); + addCard(Zone.BATTLEFIELD, playerB, "Plains", 1); + + // Escalate {1} (Pay this cost for each mode chosen beyond the first.) + // Choose one or more — + // * Target player discards all the cards in his or her hand, then draws that many cards. + // * Collective Defiance deals 4 damage to target creature. + // * Collective Defiance deals 3 damage to target opponent. + addCard(Zone.HAND, playerA, "Collective Defiance"); // {1}{R}{R} sorcery + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Collective Defiance", "mode=2Wall of Omens"); + setModeChoice(playerA, "1"); // opponent discards hand and draws that many + setModeChoice(playerA, "2"); // deal 4 dmg to target creature (Wall of Omens) + setModeChoice(playerA, "3"); // deal 3 dmg to opponent + addTarget(playerA, playerB); // mode 1 + addTarget(playerA, playerB); // mode 3 + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Spell Queller"); + addTarget(playerB, "Collective Defiance"); + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertPermanentCount(playerB, "Spell Queller", 1); + assertHandCount(playerA, "Collective Defiance", 0); + assertExileCount("Collective Defiance", 1); + assertGraveyardCount(playerA, "Collective Defiance", 0); + assertPermanentCount(playerB, "Wall of Omens", 1); + assertLife(playerA, 20); + assertLife(playerB, 20); + } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/UndyingTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/UndyingTest.java index 61b401429c..1d004f808a 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/UndyingTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/UndyingTest.java @@ -76,6 +76,7 @@ public class UndyingTest extends CardTestPlayerBase { execute(); assertPermanentCount(playerA, "Elite Vanguard", 1); + assertCounterCount(playerA, "Elite Vanguard", CounterType.P1P1, 1); assertPowerToughness(playerA, "Elite Vanguard", 3, 2); } @@ -112,6 +113,7 @@ public class UndyingTest extends CardTestPlayerBase { assertGraveyardCount(playerA, "Lightning Bolt", 1); assertPermanentCount(playerB, "Strangleroot Geist", 0); assertPermanentCount(playerA, "Strangleroot Geist", 1); + assertCounterCount(playerA, "Strangleroot Geist", CounterType.P1P1, 1); assertPowerToughness(playerA, "Strangleroot Geist", 3, 2); } @@ -211,6 +213,7 @@ public class UndyingTest extends CardTestPlayerBase { assertPermanentCount(playerA, "Silvercoat Lion", 1); assertPermanentCount(playerA, "Mikaeus, the Unhallowed", 1); + assertCounterCount(playerA, "Silvercoat Lion", CounterType.P1P1, 1); assertPowerToughness(playerA, "Silvercoat Lion", 4, 4); } @@ -271,5 +274,45 @@ public class UndyingTest extends CardTestPlayerBase { assertPowerToughness(playerA, "Tatterkite", 3, 2); } + + /** + * I stole my opponents Vorapede using Simic Manipulator and shortly after someone played Wrath of God. + * Instead of returning to my opponent's board, Vorapede came back under my control. + * The rules text for Undying states that it should return under its owner's control, not its controller's. + */ + @Test + public void testUndyingCreatureReturnsUnderOwnersControl() { + + // Creature — Insect + // Vigilance, trample + // Undying (When this creature dies, if it had no +1/+1 counters on it, return it to the battlefield under its owner's control with a +1/+1 counter on it.) + addCard(Zone.BATTLEFIELD, playerB, "Vorapede"); // {2}{G}{G}{G} 5/4 + addCard(Zone.HAND, playerB, "Doom Blade"); // {1}{B} destroy target non-black creature + addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2); + + // {2}{R} sorcery - Gain control of target creature until end of turn. Untap that creature. It gains haste until end of turn. + addCard(Zone.HAND, playerA, "Act of Treason"); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3); + + // playerA takes control of Vorapede from playerB + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Act of Treason", "Vorapede"); + attack(1, playerA, "Vorapede"); + // playerB kills Vorapede under the control of playerA now + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Doom Blade", "Vorapede"); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertLife(playerA, 20); + assertLife(playerB, 15); + assertGraveyardCount(playerA, "Act of Treason", 1); + assertGraveyardCount(playerB, "Doom Blade", 1); + + // Vorapede should return under control of playerA, not playerB + assertPermanentCount(playerA, "Vorapede", 1); + assertPermanentCount(playerB, "Vorapede", 0); + assertCounterCount(playerA, "Vorapede", CounterType.P1P1, 1); + assertPowerToughness(playerA, "Vorapede", 6, 5); + } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/replacement/ClergyOfTheHolyNimbusTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/ClergyOfTheHolyNimbusTest.java new file mode 100644 index 0000000000..ad2ee133e4 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/ClergyOfTheHolyNimbusTest.java @@ -0,0 +1,68 @@ +package org.mage.test.cards.replacement; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Ignore; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) + */ +public class ClergyOfTheHolyNimbusTest extends CardTestPlayerBase { + + @Test + public void testBasicRegeneration() { + + // If Clergy of the Holy Nimbus would be destroyed, regenerate it. + // {1}: Clergy of the Holy Nimbus can't be regenerated this turn. Only any opponent may activate this ability. + addCard(Zone.BATTLEFIELD, playerB, "Clergy of the Holy Nimbus"); // {W} 1/1 + addCard(Zone.HAND, playerA, "Doom Blade"); // {1}{B} destroy target non-black creature + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Doom Blade", "Clergy of the Holy Nimbus"); + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertGraveyardCount(playerA, "Doom Blade", 1); + assertPermanentCount(playerB, "Clergy of the Holy Nimbus", 1); + } + + @Test + public void testCannotBeRegeneratedSpell() { + + // If Clergy of the Holy Nimbus would be destroyed, regenerate it. + // {1}: Clergy of the Holy Nimbus can't be regenerated this turn. Only any opponent may activate this ability. + addCard(Zone.BATTLEFIELD, playerB, "Clergy of the Holy Nimbus"); // {W} 1/1 + addCard(Zone.HAND, playerA, "Wrath of God"); // {2}{W}{W} destroy all creatures, they cannot be regenerated + addCard(Zone.BATTLEFIELD, playerA, "Plains", 4); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Wrath of God"); + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertGraveyardCount(playerA, "Wrath of God", 1); + assertGraveyardCount(playerB, "Clergy of the Holy Nimbus", 1); + } + + // in game testing works correctly - not sure if the ability is being activated or not here. + @Ignore + @Test + public void testOpponentPaysOneToNotAllowRegeneration() { + + // If Clergy of the Holy Nimbus would be destroyed, regenerate it. + // {1}: Clergy of the Holy Nimbus can't be regenerated this turn. Only any opponent may activate this ability. + addCard(Zone.BATTLEFIELD, playerB, "Clergy of the Holy Nimbus"); // {W} 1/1 + addCard(Zone.HAND, playerA, "Doom Blade"); // {1}{B} destroy target non-black creature + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3); + + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}:"); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Doom Blade", "Clergy of the Holy Nimbus"); + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertGraveyardCount(playerA, "Doom Blade", 1); + assertGraveyardCount(playerB, "Clergy of the Holy Nimbus", 1); + } +}