From c34826611be410ffc4986f31beeca7674b8ed491 Mon Sep 17 00:00:00 2001 From: spjspj Date: Tue, 7 Mar 2017 01:20:35 +1100 Subject: [PATCH] spjspj - Implement Land Equilibrium (LEG, ME3) --- Mage.Sets/src/mage/cards/l/LandEquilibrium.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Mage.Sets/src/mage/cards/l/LandEquilibrium.java b/Mage.Sets/src/mage/cards/l/LandEquilibrium.java index bfad7bfc9d..33027bb781 100644 --- a/Mage.Sets/src/mage/cards/l/LandEquilibrium.java +++ b/Mage.Sets/src/mage/cards/l/LandEquilibrium.java @@ -28,12 +28,10 @@ package mage.cards.l; import java.util.UUID; -import static jdk.nashorn.internal.objects.NativeRegExp.source; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.SacrificeEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import static mage.cards.m.ManaVortex.filter; import mage.constants.CardType; import mage.constants.Zone; import mage.filter.common.FilterLandPermanent; @@ -50,7 +48,7 @@ public class LandEquilibrium extends CardImpl { public LandEquilibrium(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}{U}"); - + // If an opponent who controls at least as many lands as you do would put a land onto the battlefield, that player instead puts that land onto the battlefield then sacrifices a land. this.addAbility(new LandEquilibriumAbility()); } @@ -67,6 +65,8 @@ public class LandEquilibrium extends CardImpl { class LandEquilibriumAbility extends TriggeredAbilityImpl { + private static final FilterLandPermanent filter = new FilterLandPermanent("land"); + public LandEquilibriumAbility() { super(Zone.BATTLEFIELD, new SacrificeEffect(new FilterLandPermanent(), 1, ""), false); } @@ -88,11 +88,12 @@ class LandEquilibriumAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { int numMyLands = game.getBattlefield().countAll(filter, this.getControllerId(), game); - if (numMyLands < game.getBattlefield().countAll(filter, event.getPlayerId(), game)) { + int theirLands = game.getBattlefield().countAll(filter, event.getPlayerId(), game); + if (numMyLands < theirLands) { this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); return true; } - return false; + return false; } @Override