* Fixed that the becomes land effects of Gaea's Liege and Graceful Antelope did not end when the source left the battlefield.

This commit is contained in:
LevelX2 2019-01-06 11:11:09 +01:00
parent ca18c6a283
commit 554e8076cf
4 changed files with 23 additions and 24 deletions

View file

@ -1,14 +1,13 @@
package mage.abilities.effects;
import java.util.*;
import mage.abilities.Ability;
import mage.abilities.MageSingleton;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.game.Game;
import org.apache.log4j.Logger;
import java.util.*;
/**
* @param <T>
* @author BetaSteward_at_googlemail.com
@ -42,7 +41,7 @@ public class ContinuousEffectsList<T extends ContinuousEffect> extends ArrayList
}
public void removeEndOfTurnEffects() {
for (Iterator<T> i = this.iterator(); i.hasNext(); ) {
for (Iterator<T> i = this.iterator(); i.hasNext();) {
T entry = i.next();
if (entry.getDuration() == Duration.EndOfTurn) {
i.remove();
@ -53,7 +52,7 @@ public class ContinuousEffectsList<T extends ContinuousEffect> extends ArrayList
public void removeEndOfCombatEffects() {
for (Iterator<T> i = this.iterator(); i.hasNext(); ) {
for (Iterator<T> i = this.iterator(); i.hasNext();) {
T entry = i.next();
if (entry.getDuration() == Duration.EndOfCombat) {
i.remove();
@ -63,7 +62,7 @@ public class ContinuousEffectsList<T extends ContinuousEffect> extends ArrayList
}
public void removeInactiveEffects(Game game) {
for (Iterator<T> i = this.iterator(); i.hasNext(); ) {
for (Iterator<T> i = this.iterator(); i.hasNext();) {
T entry = i.next();
if (isInactive(entry, game)) {
i.remove();
@ -106,6 +105,11 @@ public class ContinuousEffectsList<T extends ContinuousEffect> extends ArrayList
if (effect.isInactive(ability, game)) {
it.remove();
}
break;
case UntilSourceLeavesBattlefield:
if (Zone.BATTLEFIELD != game.getState().getZone(ability.getSourceId())) {
it.remove();
}
}
}
}
@ -147,7 +151,7 @@ public class ContinuousEffectsList<T extends ContinuousEffect> extends ArrayList
abilities.removeAll(abilitiesToRemove);
}
if (abilities == null || abilities.isEmpty()) {
for (Iterator<T> iterator = this.iterator(); iterator.hasNext(); ) {
for (Iterator<T> iterator = this.iterator(); iterator.hasNext();) {
ContinuousEffect effect = iterator.next();
if (effect.getId().equals(effectIdToRemove)) {
iterator.remove();

View file

@ -12,6 +12,7 @@ public enum Duration {
WhileInGraveyard("", false),
EndOfTurn("until end of turn", true),
UntilYourNextTurn("until your next turn", true),
UntilSourceLeavesBattlefield("until {source} leaves the battlefield", true), // supported for continuous layered effects
EndOfCombat("until end of combat", true),
EndOfStep("until end of phase step", true),
Custom("", true);