From ffd0c24c9cf91632bfb76cfc374fa6ce8c35ef48 Mon Sep 17 00:00:00 2001 From: LevelX2 <ludwig.hirth@online.de> Date: Fri, 28 Jul 2017 12:21:52 +0200 Subject: [PATCH] Some minor changes. --- Mage.Sets/src/mage/cards/w/WordsOfWaste.java | 31 ++++++----------- .../src/mage/cards/w/WordsOfWilding.java | 34 +++++++------------ .../abilities/keywords/FlashbackTest.java | 9 ++--- .../cards/replacement/DrawEffectsTest.java | 20 +++++++++++ .../cards/triggers/ZurTheEnchanterTest.java | 7 ++-- .../effects/ContinuousEffectImpl.java | 2 +- .../abilities/effects/ContinuousEffects.java | 2 +- .../abilities/keyword/FlashbackAbility.java | 3 +- 8 files changed, 56 insertions(+), 52 deletions(-) diff --git a/Mage.Sets/src/mage/cards/w/WordsOfWaste.java b/Mage.Sets/src/mage/cards/w/WordsOfWaste.java index 509dbb2647..4ec2c97848 100644 --- a/Mage.Sets/src/mage/cards/w/WordsOfWaste.java +++ b/Mage.Sets/src/mage/cards/w/WordsOfWaste.java @@ -27,25 +27,22 @@ */ package mage.cards.w; -import java.util.List; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.Effect; import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.discard.DiscardEachPlayerEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; +import mage.constants.TargetController; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.players.Player; -import mage.abilities.effects.common.discard.DiscardEachPlayerEffect; -import mage.constants.TargetController; -import mage.abilities.dynamicvalue.common.StaticValue; /** * @@ -54,8 +51,7 @@ import mage.abilities.dynamicvalue.common.StaticValue; public class WordsOfWaste extends CardImpl { public WordsOfWaste(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{B}"); - + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}"); // {1}: The next time you would draw a card this turn, each opponent discards a card instead. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new WordsOfWasteEffect(), new ManaCostsImpl("{1}"))); @@ -75,7 +71,7 @@ class WordsOfWasteEffect extends ReplacementEffectImpl { public WordsOfWasteEffect() { super(Duration.EndOfTurn, Outcome.Discard); - staticText = "The next time you would draw a card this turn, each opponent discards a card instead."; + staticText = "The next time you would draw a card this turn, each opponent discards a card instead"; } public WordsOfWasteEffect(final WordsOfWasteEffect effect) { @@ -87,29 +83,24 @@ class WordsOfWasteEffect extends ReplacementEffectImpl { return new WordsOfWasteEffect(this); } - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { + public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - new DiscardEachPlayerEffect(new StaticValue(1), false, TargetController.OPPONENT).apply(game, source); - this.used = true; - discard(); - return true; + new DiscardEachPlayerEffect(TargetController.OPPONENT).apply(game, source); + this.discard(); + return true; } return false; } - + @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.DRAW_CARD; - } + } @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (!this.used) { - return source.getControllerId().equals(event.getPlayerId()); - } - return false; + return source.getControllerId().equals(event.getPlayerId()); } } diff --git a/Mage.Sets/src/mage/cards/w/WordsOfWilding.java b/Mage.Sets/src/mage/cards/w/WordsOfWilding.java index 99284ed6cc..1975c5b7d2 100644 --- a/Mage.Sets/src/mage/cards/w/WordsOfWilding.java +++ b/Mage.Sets/src/mage/cards/w/WordsOfWilding.java @@ -27,13 +27,12 @@ */ package mage.cards.w; -import java.util.List; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.Effect; import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.CreateTokenEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; @@ -42,11 +41,8 @@ import mage.constants.Outcome; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; -import mage.players.Player; -import mage.abilities.effects.common.CreateTokenEffect; import mage.game.permanent.token.BearToken; -import mage.constants.TargetController; -import mage.abilities.dynamicvalue.common.StaticValue; +import mage.players.Player; /** * @@ -55,8 +51,7 @@ import mage.abilities.dynamicvalue.common.StaticValue; public class WordsOfWilding extends CardImpl { public WordsOfWilding(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{G}"); - + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}"); // {1}: The next time you would draw a card this turn, create a 2/2 green Bear creature token instead. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new WordsOfWildingEffect(), new ManaCostsImpl("{1}"))); @@ -75,8 +70,8 @@ public class WordsOfWilding extends CardImpl { class WordsOfWildingEffect extends ReplacementEffectImpl { public WordsOfWildingEffect() { - super(Duration.EndOfTurn, Outcome.Discard); - staticText = "The next time you would draw a card this turn, create a 2/2 green Bear creature token instead."; + super(Duration.EndOfTurn, Outcome.PutCreatureInPlay); + staticText = "The next time you would draw a card this turn, create a 2/2 green Bear creature token instead"; } public WordsOfWildingEffect(final WordsOfWildingEffect effect) { @@ -88,29 +83,24 @@ class WordsOfWildingEffect extends ReplacementEffectImpl { return new WordsOfWildingEffect(this); } - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { + public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - new CreateTokenEffect(new BearToken()).apply(game, source); - this.used = true; - discard(); - return true; + new CreateTokenEffect(new BearToken()).apply(game, source); + discard(); + return true; } return false; } - + @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.DRAW_CARD; - } + } @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (!this.used) { - return source.getControllerId().equals(event.getPlayerId()); - } - return false; + return source.getControllerId().equals(event.getPlayerId()); } } 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 index 2c1d1fd4c3..e63d71f56b 100644 --- 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 @@ -381,8 +381,9 @@ public class FlashbackTest extends CardTestPlayerBase { assertPermanentCount(playerA, "Snapcaster Mage", 1); assertGraveyardCount(playerA, "Whispers of the Muse", 0); - assertHandCount(playerA, 1); assertExileCount("Whispers of the Muse", 1); + assertHandCount(playerA, 1); + } /** @@ -418,7 +419,7 @@ public class FlashbackTest extends CardTestPlayerBase { Sorcery Create X 1/1 red Elemental Cat creature tokens with haste. Exile them at the beginning of the next end step. Flashbackâ{R}{R}, Sacrifice X Mountains. - */ + */ String fCatBlitz = "Firecat Blitz"; String mountain = "Mountain"; @@ -434,7 +435,7 @@ public class FlashbackTest extends CardTestPlayerBase { execute(); assertExileCount(playerA, fCatBlitz, 1); - assertPermanentCount(playerA, "Elemental Cat", 1); + assertPermanentCount(playerA, "Elemental Cat", 1); assertGraveyardCount(playerA, mountain, 1); } @@ -506,7 +507,7 @@ public class FlashbackTest extends CardTestPlayerBase { execute(); assertGraveyardCount(playerA, eVanguard, 1); - assertGraveyardCount(playerA,yOx, 1); + assertGraveyardCount(playerA, yOx, 1); assertGraveyardCount(playerA, memnite, 1); assertExileCount(playerA, dReturn, 1); assertPermanentCount(playerA, bSable, 1); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/replacement/DrawEffectsTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/DrawEffectsTest.java index 59a0784801..90d6463d70 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/replacement/DrawEffectsTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/DrawEffectsTest.java @@ -110,4 +110,24 @@ public class DrawEffectsTest extends CardTestPlayerBase { assertHandCount(playerA, 14); assertHandCount(playerB, 0); } + + @Test + public void WordsOfWilding() { + addCard(Zone.BATTLEFIELD, playerA, "Island", 4); + // {1}: The next time you would draw a card this turn, create a 2/2 green Bear creature token instead. + addCard(Zone.BATTLEFIELD, playerA, "Words of Wilding", 1); + + // Draw two cards. + addCard(Zone.HAND, playerA, "Counsel of the Soratami", 1); // Sorcery {2}{U} + + activateAbility(1, PhaseStep.UPKEEP, playerA, "{1}"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Counsel of the Soratami"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertGraveyardCount(playerA, "Counsel of the Soratami", 1); + assertPermanentCount(playerA, "Bear", 1); + assertHandCount(playerA, 1); + } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/ZurTheEnchanterTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/ZurTheEnchanterTest.java index b5a57a73b2..d5462cb059 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/ZurTheEnchanterTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/ZurTheEnchanterTest.java @@ -45,8 +45,8 @@ public class ZurTheEnchanterTest extends CardTestPlayerBase { * shroud (Lightning Greaves, Diplomatic Immunity, Greater Auramancy + an * aura on him, etc.) and when his ability triggers searching for an aura * (in this case, Empyrial Armor) and trying to attach it to Zur himself. - * The game won't allow you to attach it him, even though it should, since - * the enchantment is put onto the battlefield and not cast, hence, no + * The game won't allow you to attach it to him, even though it should, + * since the enchantment is put onto the battlefield and not cast, hence, no * targeting is done. The rulings page for Zur itself say it so on Gatherer: * * Shroud shouldn't stop Empyrial Armor from attaching to Zur, only @@ -55,7 +55,8 @@ public class ZurTheEnchanterTest extends CardTestPlayerBase { @Test public void testAuraToBattlefieldDoesNotTarget() { // Flying - // Whenever Zur the Enchanter attacks, you may search your library for an enchantment card with converted mana cost 3 or less and put it onto the battlefield. If you do, shuffle your library. + // Whenever Zur the Enchanter attacks, you may search your library for an enchantment card + // with converted mana cost 3 or less and put it onto the battlefield. If you do, shuffle your library. addCard(Zone.BATTLEFIELD, playerB, "Zur the Enchanter"); // 1/4 addCard(Zone.BATTLEFIELD, playerB, "Island", 2); diff --git a/Mage/src/main/java/mage/abilities/effects/ContinuousEffectImpl.java b/Mage/src/main/java/mage/abilities/effects/ContinuousEffectImpl.java index 52cb239bd2..f838ef3eb6 100644 --- a/Mage/src/main/java/mage/abilities/effects/ContinuousEffectImpl.java +++ b/Mage/src/main/java/mage/abilities/effects/ContinuousEffectImpl.java @@ -34,7 +34,6 @@ import java.util.List; import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; - import mage.MageObjectReference; import mage.abilities.Ability; import mage.abilities.MageSingleton; @@ -165,6 +164,7 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu */ @Override public void discard() { + this.used = true; // to prevent further usage before effect is removed this.discarded = true; } diff --git a/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java b/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java index 1299a3666f..e1ac2ffa00 100644 --- a/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java +++ b/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java @@ -355,7 +355,7 @@ public class ContinuousEffects implements Serializable { for (Ability ability : abilities) { // for replacment effects of static abilities do not use LKI to check if to apply if (ability.getAbilityType() != AbilityType.STATIC || ability.isInUseableZone(game, null, event)) { - if (effect.getDuration() != Duration.OneUse || !effect.isUsed()) { + if (!effect.isUsed()) { if (!game.getScopeRelevant() || effect.hasSelfScope() || !event.getTargetId().equals(ability.getSourceId())) { diff --git a/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java b/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java index cb3e10fd15..c05f20118f 100644 --- a/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java @@ -267,6 +267,7 @@ class FlashbackReplacementEffect extends ReplacementEffectImpl { if (controller != null) { Card card = game.getCard(event.getTargetId()); if (card != null) { + discard(); return controller.moveCards( card, Zone.EXILED, source, game, false, false, false, event.getAppliedEffects()); } @@ -284,7 +285,7 @@ class FlashbackReplacementEffect extends ReplacementEffectImpl { if (event.getTargetId().equals(source.getSourceId()) && ((ZoneChangeEvent) event).getFromZone() == Zone.STACK && ((ZoneChangeEvent) event).getToZone() != Zone.EXILED) { - discard(); + int zcc = game.getState().getZoneChangeCounter(source.getSourceId()); if (((FixedTarget) getTargetPointer()).getZoneChangeCounter() == zcc) { return true;