mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
[C21] fixed Veyran, Voice of Duality doubling triggers off of other players' spells and permanents (fixes #8287)
This commit is contained in:
parent
eb81ffe92b
commit
f31781e4a4
1 changed files with 10 additions and 15 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue