Fixed a problem that DiesTriggeredAbilities from Tokens that were removed by an effect did nevertheless trigger (fixes #5825).

This commit is contained in:
LevelX2 2019-12-15 13:10:11 +01:00
parent d458e73795
commit 8d46f46cf8
2 changed files with 36 additions and 41 deletions

View file

@ -1,4 +1,3 @@
package mage.abilities.common;
import mage.MageObject;
@ -34,11 +33,11 @@ public class DiesTriggeredAbility extends ZoneChangeTriggeredAbility {
if (before == null) {
return false;
}
if (!(before instanceof PermanentToken) && !this.hasSourceObjectAbility(game, before, event)) {
if (!this.hasSourceObjectAbility(game, before, event)) { // the permanent does not have the ability so no trigger
return false;
}
// check now it is in graveyard
if (before.getZoneChangeCounter(game) + 1 == game.getState().getZoneChangeCounter(sourceId)) {
// check now it is in graveyard if it is no token
if (!(before instanceof PermanentToken) && before.getZoneChangeCounter(game) + 1 == game.getState().getZoneChangeCounter(sourceId)) {
Zone after = game.getState().getZone(sourceId);
return after != null && Zone.GRAVEYARD.match(after);
} else {