mirror of
https://github.com/correl/mage.git
synced 2025-01-13 19:11:33 +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.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.NumberOfTriggersEvent;
|
import mage.game.events.NumberOfTriggersEvent;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -71,30 +73,23 @@ class VeyranVoiceOfDualityEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
NumberOfTriggersEvent numberOfTriggersEvent = (NumberOfTriggersEvent) event;
|
GameEvent sourceEvent = ((NumberOfTriggersEvent) event).getSourceEvent();
|
||||||
if (!source.isControlledBy(event.getPlayerId())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
GameEvent sourceEvent = numberOfTriggersEvent.getSourceEvent();
|
|
||||||
if (sourceEvent == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (sourceEvent.getType() != GameEvent.EventType.COPIED_STACKOBJECT
|
if (sourceEvent.getType() != GameEvent.EventType.COPIED_STACKOBJECT
|
||||||
&& sourceEvent.getType() != GameEvent.EventType.SPELL_CAST) {
|
&& sourceEvent.getType() != GameEvent.EventType.SPELL_CAST) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Only for entering artifacts or creatures
|
|
||||||
Spell spell = game.getSpell(sourceEvent.getTargetId());
|
Spell spell = game.getSpell(sourceEvent.getTargetId());
|
||||||
if (spell == null || !spell.isInstantOrSorcery(game)) {
|
Permanent permanent = game.getPermanent(sourceEvent.getSourceId());
|
||||||
return false;
|
return spell != null
|
||||||
}
|
&& permanent != null
|
||||||
// Only for triggers of permanents
|
&& spell.isInstantOrSorcery(game)
|
||||||
return game.getPermanent(numberOfTriggersEvent.getSourceId()) != null;
|
&& spell.isControlledBy(source.getControllerId())
|
||||||
|
&& permanent.isControlledBy(source.getControllerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
event.setAmount(event.getAmount() + 1);
|
event.setAmount(CardUtil.overflowInc(event.getAmount(), 1));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue