[STX] fixed Valentin, Dean of the Vein effect applying to tokens (fixes #7819)

This commit is contained in:
Evan Kranzler 2021-05-14 13:45:23 -04:00
parent 895430b554
commit 2c2b028980

View file

@ -21,6 +21,7 @@ import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent; import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.PermanentToken;
import mage.game.permanent.token.WitherbloomToken; import mage.game.permanent.token.WitherbloomToken;
import java.util.UUID; import java.util.UUID;
@ -115,8 +116,10 @@ class ValentinDeanOfTheVeinEffect extends ReplacementEffectImpl {
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
return ((ZoneChangeEvent) event).isDiesEvent() ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
&& game.getOpponents(game.getControllerId(event.getTargetId())).contains(source.getControllerId()); return zEvent.isDiesEvent()
&& !(zEvent.getTarget() instanceof PermanentToken)
&& game.getOpponents(zEvent.getTarget().getControllerId()).contains(source.getControllerId());
} }
} }