From eb6e7f9b46074384affb2a64d4a27c145664893a Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 1 May 2015 12:15:13 +0200 Subject: [PATCH] * Fixed a bug of draw card replace effect (e.g. multiple Thought Reflection enchantments on the battlefield let you draw less cards than intended). --- .../sets/alarareborn/SagesOfTheAnima.java | 14 ++--- .../TomorrowAzamisFamiliar.java | 7 ++- .../mage/sets/dragonsmaze/BloodScrivener.java | 9 ++- .../mage/sets/dragonsmaze/NotionThief.java | 9 ++- .../src/mage/sets/iceage/ZursWeirding.java | 9 +-- .../sets/legends/ChainsOfMephistopheles.java | 21 ++++--- .../src/mage/sets/mirage/ForbiddenCrypt.java | 9 ++- .../mage/sets/odyssey/ObstinateFamiliar.java | 12 ++-- .../src/mage/sets/onslaught/WordsOfWar.java | 11 +++- .../src/mage/sets/onslaught/WordsOfWind.java | 25 ++++---- Mage.Sets/src/mage/sets/tenth/Abundance.java | 12 ++-- .../mage/sets/zendikar/ArchmageAscension.java | 23 +++++--- .../cards/replacement/DrawEffectsTest.java | 59 +++++++++++++++++++ .../common/ExileFromZoneTargetEffect.java | 2 +- .../effects/common/UntapLandsEffect.java | 2 +- Mage/src/mage/game/events/GameEvent.java | 8 ++- 16 files changed, 164 insertions(+), 68 deletions(-) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/replacement/DrawEffectsTest.java diff --git a/Mage.Sets/src/mage/sets/alarareborn/SagesOfTheAnima.java b/Mage.Sets/src/mage/sets/alarareborn/SagesOfTheAnima.java index e2f80e19ced..61b2394f775 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/SagesOfTheAnima.java +++ b/Mage.Sets/src/mage/sets/alarareborn/SagesOfTheAnima.java @@ -60,8 +60,6 @@ public class SagesOfTheAnima extends CardImpl { this.subtype.add("Elf"); this.subtype.add("Wizard"); - - this.power = new MageInt(3); this.toughness = new MageInt(4); @@ -138,12 +136,14 @@ class SagesOfTheAnimaReplacementEffect extends ReplacementEffectImpl { } return true; } - + + @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 (event.getType() == GameEvent.EventType.DRAW_CARD && event.getPlayerId().equals(source.getControllerId())) { - return true; - } - return false; + return event.getPlayerId().equals(source.getControllerId()); } } diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/TomorrowAzamisFamiliar.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/TomorrowAzamisFamiliar.java index ce477cad41a..5b766d64fa2 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/TomorrowAzamisFamiliar.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/TomorrowAzamisFamiliar.java @@ -103,8 +103,13 @@ class TomorrowAzamisFamiliarReplacementEffect extends ReplacementEffectImpl { return true; } + @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) { - return EventType.DRAW_CARD.equals(event.getType()) && event.getPlayerId().equals(source.getControllerId()); + return event.getPlayerId().equals(source.getControllerId()); } } diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/BloodScrivener.java b/Mage.Sets/src/mage/sets/dragonsmaze/BloodScrivener.java index bce1ba5696d..c59127171dc 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/BloodScrivener.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/BloodScrivener.java @@ -107,10 +107,15 @@ class BloodScrivenerReplacementEffect extends ReplacementEffectImpl { } return true; } - + + @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 (event.getType() == EventType.DRAW_CARD && event.getPlayerId().equals(source.getControllerId())) { + if (event.getPlayerId().equals(source.getControllerId())) { Player player = game.getPlayer(event.getPlayerId()); if (player.getHand().isEmpty()) { return true; diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/NotionThief.java b/Mage.Sets/src/mage/sets/dragonsmaze/NotionThief.java index cba8b75fec1..4a3d6294d57 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/NotionThief.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/NotionThief.java @@ -109,10 +109,15 @@ class NotionThiefReplacementEffect extends ReplacementEffectImpl { } return true; } - + + @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 (event.getType() == EventType.DRAW_CARD && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { + if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { if (game.getActivePlayerId().equals(event.getPlayerId())) { CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get("CardsDrawnDuringDrawStep"); if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) { diff --git a/Mage.Sets/src/mage/sets/iceage/ZursWeirding.java b/Mage.Sets/src/mage/sets/iceage/ZursWeirding.java index 04b28308cf1..99b16460440 100644 --- a/Mage.Sets/src/mage/sets/iceage/ZursWeirding.java +++ b/Mage.Sets/src/mage/sets/iceage/ZursWeirding.java @@ -130,13 +130,14 @@ class ZursWeirdingReplacementEffect extends ReplacementEffectImpl { } 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 (event.getType() == EventType.DRAW_CARD) { - return true; - } - return false; + return true; } } diff --git a/Mage.Sets/src/mage/sets/legends/ChainsOfMephistopheles.java b/Mage.Sets/src/mage/sets/legends/ChainsOfMephistopheles.java index aefc9db49a8..7ec80af1ea2 100644 --- a/Mage.Sets/src/mage/sets/legends/ChainsOfMephistopheles.java +++ b/Mage.Sets/src/mage/sets/legends/ChainsOfMephistopheles.java @@ -42,7 +42,6 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.targetpointer.FixedTarget; import mage.watchers.common.CardsDrawnDuringDrawStepWatcher; @@ -57,8 +56,6 @@ public class ChainsOfMephistopheles extends CardImpl { super(ownerId, 5, "Chains of Mephistopheles", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}"); this.expansionSetCode = "LEG"; - this.color.setBlack(true); - // If a player would draw a card except the first one he or she draws in his or her draw step each turn, that player discards a card instead. If the player discards a card this way, he or she draws a card. If the player doesn't discard a card this way, he or she puts the top card of his or her library into his or her graveyard. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ChainsOfMephistophelesReplacementEffect()), new CardsDrawnDuringDrawStepWatcher()); } @@ -112,18 +109,20 @@ class ChainsOfMephistophelesReplacementEffect extends ReplacementEffectImpl { } 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 (event.getType() == EventType.DRAW_CARD) { - if (game.getActivePlayerId().equals(event.getPlayerId()) && game.getPhase().getStep().getType().equals(PhaseStep.DRAW)) { - CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get("CardsDrawnDuringDrawStep"); - if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) { - return true; - } - } else { + if (game.getActivePlayerId().equals(event.getPlayerId()) && game.getPhase().getStep().getType().equals(PhaseStep.DRAW)) { + CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get("CardsDrawnDuringDrawStep"); + if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) { return true; } + } else { + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/mirage/ForbiddenCrypt.java b/Mage.Sets/src/mage/sets/mirage/ForbiddenCrypt.java index 2bfde6b0e93..e5ec2847ebd 100644 --- a/Mage.Sets/src/mage/sets/mirage/ForbiddenCrypt.java +++ b/Mage.Sets/src/mage/sets/mirage/ForbiddenCrypt.java @@ -167,10 +167,15 @@ class ForbiddenCryptPutIntoYourGraveyardReplacementEffect extends ReplacementEff } return true; } - + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) { + if (((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) { Card card = game.getCard(event.getTargetId()); if (card != null && card.getOwnerId().equals(source.getControllerId())) { Permanent permanent = ((ZoneChangeEvent) event).getTarget(); diff --git a/Mage.Sets/src/mage/sets/odyssey/ObstinateFamiliar.java b/Mage.Sets/src/mage/sets/odyssey/ObstinateFamiliar.java index 19dbfacd9ce..fe04ec1114d 100644 --- a/Mage.Sets/src/mage/sets/odyssey/ObstinateFamiliar.java +++ b/Mage.Sets/src/mage/sets/odyssey/ObstinateFamiliar.java @@ -76,7 +76,7 @@ class ObstinateFamiliarReplacementEffect extends ReplacementEffectImpl { public ObstinateFamiliarReplacementEffect() { super(Duration.WhileOnBattlefield, Outcome.Benefit); - staticText = "If you would draw a card, you may skip that draw instead."; + staticText = "If you would draw a card, you may skip that draw instead"; } public ObstinateFamiliarReplacementEffect(final ObstinateFamiliarReplacementEffect effect) { @@ -97,13 +97,17 @@ class ObstinateFamiliarReplacementEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { return true; } - + + @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) { Permanent archmage = game.getPermanent(source.getSourceId()); Player you = game.getPlayer(source.getControllerId()); - if (event.getType() == GameEvent.EventType.DRAW_CARD - && event.getPlayerId().equals(source.getControllerId()) + if (event.getPlayerId().equals(source.getControllerId()) && archmage != null && you != null && you.chooseUse(Outcome.Benefit, "Would you like to skip drawing a card?", game)) { diff --git a/Mage.Sets/src/mage/sets/onslaught/WordsOfWar.java b/Mage.Sets/src/mage/sets/onslaught/WordsOfWar.java index 62b44408adf..068d193d60c 100644 --- a/Mage.Sets/src/mage/sets/onslaught/WordsOfWar.java +++ b/Mage.Sets/src/mage/sets/onslaught/WordsOfWar.java @@ -101,21 +101,26 @@ class WordsOfWarEffect extends ReplacementEffectImpl { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { player.damage(2, source.getSourceId(), game, false, true); - used = true; + discard(); return true; } Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null) { permanent.damage(2, source.getSourceId(), game, false, true); - used = true; + 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) { - return event.getType() == EventType.DRAW_CARD && source.getControllerId().equals(event.getPlayerId()) && used == false; + return source.getControllerId().equals(event.getPlayerId()); } } diff --git a/Mage.Sets/src/mage/sets/onslaught/WordsOfWind.java b/Mage.Sets/src/mage/sets/onslaught/WordsOfWind.java index 3e1a1f86373..ba008b0c0c8 100644 --- a/Mage.Sets/src/mage/sets/onslaught/WordsOfWind.java +++ b/Mage.Sets/src/mage/sets/onslaught/WordsOfWind.java @@ -91,13 +91,7 @@ class WordsOfWindEffect extends ReplacementEffectImpl { } @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - + public boolean replaceEvent(GameEvent event, Ability source, Game game) { game.informPlayers("Each player returns a permanent he or she controls to its owner's hand instead"); for (UUID playerId : game.getPlayerList()) { Player player = game.getPlayer(playerId); @@ -117,16 +111,17 @@ class WordsOfWindEffect extends ReplacementEffectImpl { } } } - used = true; - return apply(game, source); + discard(); + return true; } - + + @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 (event.getType() == EventType.DRAW_CARD && source.getControllerId().equals(event.getPlayerId()) && used == false) { - - return true; - } - return false; + return source.getControllerId().equals(event.getPlayerId()); } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/tenth/Abundance.java b/Mage.Sets/src/mage/sets/tenth/Abundance.java index 3702f3319a4..e44e8d0ec25 100644 --- a/Mage.Sets/src/mage/sets/tenth/Abundance.java +++ b/Mage.Sets/src/mage/sets/tenth/Abundance.java @@ -45,7 +45,6 @@ import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.Game; import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; import mage.players.Player; /** @@ -58,8 +57,6 @@ public class Abundance extends CardImpl { super(ownerId, 249, "Abundance", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}{G}"); this.expansionSetCode = "10E"; - this.color.setGreen(true); - // If you would draw a card, you may instead choose land or nonland and reveal cards from the top of your library until you reveal a card of the chosen kind. Put that card into your hand and put all other cards revealed this way on the bottom of your library in any order. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AbundanceReplacementEffect())); } @@ -120,10 +117,15 @@ class AbundanceReplacementEffect extends ReplacementEffectImpl { } return true; } - + + @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 (event.getType() == EventType.DRAW_CARD && event.getPlayerId().equals(source.getControllerId())) { + if (event.getPlayerId().equals(source.getControllerId())) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { return player.chooseUse(Outcome.Benefit, "Choose land or nonland?", game); diff --git a/Mage.Sets/src/mage/sets/zendikar/ArchmageAscension.java b/Mage.Sets/src/mage/sets/zendikar/ArchmageAscension.java index b1133fa496f..1b0ec8fb38c 100644 --- a/Mage.Sets/src/mage/sets/zendikar/ArchmageAscension.java +++ b/Mage.Sets/src/mage/sets/zendikar/ArchmageAscension.java @@ -90,12 +90,17 @@ class ArchmageAscensionTriggeredAbility extends TriggeredAbilityImpl { public ArchmageAscensionTriggeredAbility copy() { return new ArchmageAscensionTriggeredAbility(this); } - + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent archmage = game.getPermanent(super.getSourceId()); CardsDrawnControllerWatcher watcher = (CardsDrawnControllerWatcher) game.getState().getWatchers().get("CardsControllerDrawn"); - if (event.getType() == GameEvent.EventType.END_TURN_STEP_PRE && archmage != null && watcher != null && watcher.conditionMet()) { + if (archmage != null && watcher != null && watcher.conditionMet()) { return true; } return false; @@ -103,7 +108,7 @@ class ArchmageAscensionTriggeredAbility extends TriggeredAbilityImpl { @Override public String getRule() { - return "At the beginning of each end step, if you drew two or more cards this turn, you may put a quest counter on Archmage Ascension."; + return "At the beginning of each end step, if you drew two or more cards this turn, you may put a quest counter on {this}"; } } @@ -147,7 +152,7 @@ class ArchmageAscensionReplacementEffect extends ReplacementEffectImpl { public ArchmageAscensionReplacementEffect() { super(Duration.WhileOnBattlefield, Outcome.Benefit); - staticText = "As long as Archmage Ascension has six or more quest counters on it, if you would draw a card, you may instead search your library for a card, put that card into your hand, then shuffle your library"; + staticText = "As long as {this} has six or more quest counters on it, if you would draw a card, you may instead search your library for a card, put that card into your hand, then shuffle your library"; } public ArchmageAscensionReplacementEffect(final ArchmageAscensionReplacementEffect effect) { @@ -179,13 +184,17 @@ class ArchmageAscensionReplacementEffect extends ReplacementEffectImpl { } return true; } - + + @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) { Permanent archmage = game.getPermanent(source.getSourceId()); Player you = game.getPlayer(source.getControllerId()); - if (event.getType() == EventType.DRAW_CARD - && event.getPlayerId().equals(source.getControllerId()) + if (event.getPlayerId().equals(source.getControllerId()) && archmage != null && archmage.getCounters().getCount(CounterType.QUEST) >= 6 && you != null 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 new file mode 100644 index 00000000000..106ef6fe6fe --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/DrawEffectsTest.java @@ -0,0 +1,59 @@ +/* + * 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.replacement; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Assert; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author LevelX2 + */ + +public class DrawEffectsTest extends CardTestPlayerBase { + + /** + * The effects of multiple Thought Reflections are cumulative. For example, if you have + * three Thought Reflections on the battlefield, you'll draw eight times the original number of cards. + */ + @Test + public void testCard() { + // If you would draw a card, draw two cards instead. + addCard(Zone.BATTLEFIELD, playerB, "Thought Reflection", 3); + + setStopAt(2, PhaseStep.PRECOMBAT_MAIN); + execute(); + + Assert.assertEquals("Player B has to have 4 cards in hand", 8 , playerB.getHand().size()); + + } + +} \ No newline at end of file diff --git a/Mage/src/mage/abilities/effects/common/ExileFromZoneTargetEffect.java b/Mage/src/mage/abilities/effects/common/ExileFromZoneTargetEffect.java index cb1ce027a35..48be98f6899 100644 --- a/Mage/src/mage/abilities/effects/common/ExileFromZoneTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/ExileFromZoneTargetEffect.java @@ -89,7 +89,7 @@ public class ExileFromZoneTargetEffect extends OneShotEffect { break; default: } - if (target != null && target.canChoose(player.getId(), game)) { + if (target != null && target.canChoose(source.getSourceId(), player.getId(), game)) { if (target.choose(Outcome.Exile, player.getId(), source.getSourceId(), game)) { for (UUID cardId : target.getTargets()) { Card card = game.getCard(cardId); diff --git a/Mage/src/mage/abilities/effects/common/UntapLandsEffect.java b/Mage/src/mage/abilities/effects/common/UntapLandsEffect.java index bc46e3f58bc..7567336713a 100644 --- a/Mage/src/mage/abilities/effects/common/UntapLandsEffect.java +++ b/Mage/src/mage/abilities/effects/common/UntapLandsEffect.java @@ -60,7 +60,7 @@ public class UntapLandsEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { TargetLandPermanent target = new TargetLandPermanent(0, amount, new FilterLandPermanent(), true); - if (target.canChoose(source.getControllerId(), game)) { + if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) { if (target.choose(Outcome.Untap, source.getControllerId(), source.getSourceId(), game)) { for (Object targetId : target.getTargets()) { Permanent p = game.getPermanent((UUID) targetId); diff --git a/Mage/src/mage/game/events/GameEvent.java b/Mage/src/mage/game/events/GameEvent.java index bec94b870d6..6b23fbc942e 100644 --- a/Mage/src/mage/game/events/GameEvent.java +++ b/Mage/src/mage/game/events/GameEvent.java @@ -332,9 +332,11 @@ public class GameEvent { } public void setAppliedEffects(ArrayList appliedEffects) { - if (appliedEffects == null) { - appliedEffects = new ArrayList<>(); + if (this.appliedEffects == null) { + this.appliedEffects = new ArrayList<>(); + } + if (appliedEffects != null) { + this.appliedEffects.addAll(appliedEffects); } - this.appliedEffects = appliedEffects; } }