From f31781e4a4cb35fc113fef860378e1cdce941f82 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 19 Sep 2021 15:27:01 -0400 Subject: [PATCH] [C21] fixed Veyran, Voice of Duality doubling triggers off of other players' spells and permanents (fixes #8287) --- .../mage/cards/v/VeyranVoiceOfDuality.java | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/Mage.Sets/src/mage/cards/v/VeyranVoiceOfDuality.java b/Mage.Sets/src/mage/cards/v/VeyranVoiceOfDuality.java index d9513a2bf4..53075230be 100644 --- a/Mage.Sets/src/mage/cards/v/VeyranVoiceOfDuality.java +++ b/Mage.Sets/src/mage/cards/v/VeyranVoiceOfDuality.java @@ -12,7 +12,9 @@ import mage.constants.*; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.NumberOfTriggersEvent; +import mage.game.permanent.Permanent; import mage.game.stack.Spell; +import mage.util.CardUtil; import java.util.UUID; @@ -71,30 +73,23 @@ class VeyranVoiceOfDualityEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - NumberOfTriggersEvent numberOfTriggersEvent = (NumberOfTriggersEvent) event; - if (!source.isControlledBy(event.getPlayerId())) { - return false; - } - GameEvent sourceEvent = numberOfTriggersEvent.getSourceEvent(); - if (sourceEvent == null) { - return false; - } + GameEvent sourceEvent = ((NumberOfTriggersEvent) event).getSourceEvent(); if (sourceEvent.getType() != GameEvent.EventType.COPIED_STACKOBJECT && sourceEvent.getType() != GameEvent.EventType.SPELL_CAST) { return false; } - // Only for entering artifacts or creatures Spell spell = game.getSpell(sourceEvent.getTargetId()); - if (spell == null || !spell.isInstantOrSorcery(game)) { - return false; - } - // Only for triggers of permanents - return game.getPermanent(numberOfTriggersEvent.getSourceId()) != null; + Permanent permanent = game.getPermanent(sourceEvent.getSourceId()); + return spell != null + && permanent != null + && spell.isInstantOrSorcery(game) + && spell.isControlledBy(source.getControllerId()) + && permanent.isControlledBy(source.getControllerId()); } @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - event.setAmount(event.getAmount() + 1); + event.setAmount(CardUtil.overflowInc(event.getAmount(), 1)); return false; } }