fixed Gyome, Master Chef and Valentin, Dean of the Vein counting noncreature permanents (fixes #7913)

This commit is contained in:
Evan Kranzler 2021-06-16 07:07:17 -04:00
parent 630f28bdf7
commit a5bcf94a21
2 changed files with 10 additions and 3 deletions

View file

@ -22,6 +22,7 @@ import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
import mage.game.permanent.token.FoodToken;
import mage.target.common.TargetControlledPermanent;
@ -110,10 +111,14 @@ class GyomeMasterChefWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD
&& !(((EntersTheBattlefieldEvent) event).getTarget() instanceof PermanentToken)) {
playerMap.compute(event.getPlayerId(), (u, i) -> i != null ? Integer.sum(i, 1) : 1);
if (event.getType() != GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
return;
}
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent == null || permanent instanceof PermanentToken || !permanent.isCreature()) {
return;
}
playerMap.compute(event.getPlayerId(), (u, i) -> i != null ? Integer.sum(i, 1) : 1);
}
@Override

View file

@ -118,7 +118,9 @@ class ValentinDeanOfTheVeinEffect extends ReplacementEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
return zEvent.isDiesEvent()
&& zEvent.getTarget() != null
&& !(zEvent.getTarget() instanceof PermanentToken)
&& zEvent.getTarget().isCreature()
&& game.getOpponents(zEvent.getTarget().getControllerId()).contains(source.getControllerId());
}