mirror of
https://github.com/correl/mage.git
synced 2024-12-25 19:25:41 +00:00
* 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:
parent
ca18c6a283
commit
554e8076cf
4 changed files with 23 additions and 24 deletions
|
@ -1,6 +1,6 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -28,14 +28,12 @@ import mage.game.combat.CombatGroup;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author anonymous
|
||||
*/
|
||||
public final class GaeasLiege extends CardImpl {
|
||||
|
||||
|
||||
final static FilterControlledPermanent filterLands = new FilterControlledPermanent("Forests you control");
|
||||
|
||||
static {
|
||||
|
@ -44,7 +42,7 @@ public final class GaeasLiege extends CardImpl {
|
|||
|
||||
public GaeasLiege(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}{G}");
|
||||
|
||||
|
||||
this.subtype.add(SubType.AVATAR);
|
||||
this.power = new MageInt(0);
|
||||
this.toughness = new MageInt(0);
|
||||
|
@ -55,8 +53,8 @@ public final class GaeasLiege extends CardImpl {
|
|||
new SetPowerToughnessSourceEffect(new DefendersForestCount(), Duration.EndOfCombat),
|
||||
new InvertCondition(SourceAttackingCondition.instance),
|
||||
"As long as {this} isn't attacking, its power and toughness are each equal to the number of Forests you control. As long as {this} is attacking, its power and toughness are each equal to the number of Forests defending player controls.")));
|
||||
// {tap}: Target land becomes a Forest until Gaea's Liege leaves the battlefield.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesBasicLandTargetEffect(Duration.WhileOnBattlefield, SubType.FOREST), new TapSourceCost());
|
||||
// {T}: Target land becomes a Forest until Gaea's Liege leaves the battlefield.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesBasicLandTargetEffect(Duration.UntilSourceLeavesBattlefield, SubType.FOREST), new TapSourceCost());
|
||||
ability.addTarget(new TargetLandPermanent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
@ -75,7 +73,7 @@ class DefendersForestCount implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
for (CombatGroup group :game.getCombat().getGroups()) {
|
||||
for (CombatGroup group : game.getCombat().getGroups()) {
|
||||
if (group.getAttackers().contains(sourceAbility.getSourceId())) {
|
||||
UUID defenderId = group.getDefenderId();
|
||||
if (group.isDefenderIsPlaneswalker()) {
|
||||
|
@ -84,7 +82,7 @@ class DefendersForestCount implements DynamicValue {
|
|||
defenderId = permanent.getControllerId();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FilterLandPermanent filter = new FilterLandPermanent("forest");
|
||||
filter.add(new SubtypePredicate(SubType.FOREST));
|
||||
return game.getBattlefield().countAll(filter, defenderId, game);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||
|
@ -11,11 +11,8 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cbt33, Loki (Contaminated Ground), Plopman (Larceny)
|
||||
|
@ -23,7 +20,7 @@ import java.util.UUID;
|
|||
public final class GracefulAntelope extends CardImpl {
|
||||
|
||||
public GracefulAntelope(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{W}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{W}");
|
||||
this.subtype.add(SubType.ANTELOPE);
|
||||
|
||||
this.power = new MageInt(1);
|
||||
|
@ -32,9 +29,8 @@ public final class GracefulAntelope extends CardImpl {
|
|||
// Plainswalk
|
||||
this.addAbility(new PlainswalkAbility());
|
||||
// Whenever Graceful Antelope deals combat damage to a player, you may have target land become a Plains until Graceful Antelope leaves the battlefield.
|
||||
Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new BecomesBasicLandTargetEffect(Duration.WhileOnBattlefield, SubType.PLAINS), true);
|
||||
Target target = new TargetLandPermanent();
|
||||
ability.addTarget(target);
|
||||
Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new BecomesBasicLandTargetEffect(Duration.UntilSourceLeavesBattlefield, SubType.PLAINS), true);
|
||||
ability.addTarget(new TargetLandPermanent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue