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