- a bunch of small fixes

This commit is contained in:
Jeff 2019-03-14 10:33:19 -05:00
parent bab673adf7
commit 8826dd6f0f
9 changed files with 130 additions and 91 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.b; package mage.cards.b;
import java.util.UUID; import java.util.UUID;
@ -61,7 +60,7 @@ public final class BubblingCauldron extends CardImpl {
class BubblingCauldronEffect extends OneShotEffect { class BubblingCauldronEffect extends OneShotEffect {
public BubblingCauldronEffect() { public BubblingCauldronEffect() {
super(Outcome.Damage); super(Outcome.GainLife);
staticText = "Each opponent loses 4 life. You gain life equal to the life lost this way"; staticText = "Each opponent loses 4 life. You gain life equal to the life lost this way";
} }
@ -71,16 +70,16 @@ class BubblingCauldronEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
int damage = 0; int lostLife = 0;
Player you = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
for (UUID opponentId : game.getOpponents(source.getControllerId())) { for (UUID opponentId : game.getOpponents(source.getControllerId())) {
Player opponent = game.getPlayer(opponentId); Player opponent = game.getPlayer(opponentId);
if(opponent != null) { if (opponent != null) {
damage += opponent.loseLife(4, game, false); lostLife += opponent.loseLife(4, game, false);
} }
} }
if(you != null){ if (controller != null) {
you.gainLife(damage, game, source); controller.gainLife(lostLife, game, source);
} }
return true; return true;
} }

View file

@ -1,4 +1,3 @@
package mage.cards.e; package mage.cards.e;
import java.util.UUID; import java.util.UUID;
@ -27,7 +26,7 @@ import mage.target.common.TargetOpponent;
public final class EbonyCharm extends CardImpl { public final class EbonyCharm extends CardImpl {
public EbonyCharm(UUID ownerId, CardSetInfo setInfo) { public EbonyCharm(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{B}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B}");
// Choose one - Target opponent loses 1 life and you gain 1 life; // Choose one - Target opponent loses 1 life and you gain 1 life;
this.getSpellAbility().addEffect(new EbonyCharmDrainEffect()); this.getSpellAbility().addEffect(new EbonyCharmDrainEffect());
@ -69,11 +68,13 @@ class EbonyCharmDrainEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(source.getFirstTarget()); Player targetOpponent = game.getPlayer(source.getFirstTarget());
Player controllerPlayer = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (targetPlayer != null && controllerPlayer != null) { if (targetOpponent != null
targetPlayer.damage(1, source.getSourceId(), game, false, true); && controller != null) {
controllerPlayer.gainLife(1, game, source); targetOpponent.loseLife(1, game, false);
controller.gainLife(1, game, source);
return true;
} }
return false; return false;
} }

View file

@ -1,4 +1,3 @@
package mage.cards.e; package mage.cards.e;
import java.util.List; import java.util.List;
@ -57,10 +56,12 @@ class EssenceHarvestEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Player targetPlayer = game.getPlayer(source.getFirstTarget()); Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (player != null && targetPlayer != null) { if (controller != null
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, player.getId(), game); && targetPlayer != null) {
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(
StaticFilters.FILTER_PERMANENT_CREATURE, controller.getId(), game);
int amount = 0; int amount = 0;
for (Permanent creature : creatures) { for (Permanent creature : creatures) {
int power = creature.getPower().getValue(); int power = creature.getPower().getValue();
@ -71,7 +72,7 @@ class EssenceHarvestEffect extends OneShotEffect {
if (amount > 0) { if (amount > 0) {
targetPlayer.loseLife(amount, game, false); targetPlayer.loseLife(amount, game, false);
player.gainLife(amount, game, source); controller.gainLife(amount, game, source);
} }
return true; return true;
} }

View file

@ -1,5 +1,3 @@
package mage.cards.e; package mage.cards.e;
import java.util.UUID; import java.util.UUID;
@ -17,13 +15,13 @@ import mage.game.Game;
*/ */
public final class Exsanguinate extends CardImpl { public final class Exsanguinate extends CardImpl {
public Exsanguinate (UUID ownerId, CardSetInfo setInfo) { public Exsanguinate(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{B}{B}");
this.getSpellAbility().addEffect(new ExsanguinateEffect()); this.getSpellAbility().addEffect(new ExsanguinateEffect());
} }
public Exsanguinate (final Exsanguinate card) { public Exsanguinate(final Exsanguinate card) {
super(card); super(card);
} }
@ -35,8 +33,9 @@ public final class Exsanguinate extends CardImpl {
} }
class ExsanguinateEffect extends OneShotEffect { class ExsanguinateEffect extends OneShotEffect {
public ExsanguinateEffect() { public ExsanguinateEffect() {
super(Outcome.Damage); super(Outcome.GainLife);
staticText = "Each opponent loses X life. You gain life equal to the life lost this way"; staticText = "Each opponent loses X life. You gain life equal to the life lost this way";
} }
@ -46,13 +45,14 @@ class ExsanguinateEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
int loseLife = 0; int totalLostLife = 0;
int damage = source.getManaCostsToPay().getX(); int loseLife = source.getManaCostsToPay().getX();
for (UUID opponentId : game.getOpponents(source.getControllerId())) { for (UUID opponentId : game.getOpponents(source.getControllerId())) {
loseLife += game.getPlayer(opponentId).loseLife(damage, game, false); totalLostLife += game.getPlayer(opponentId).loseLife(loseLife, game, false);
}
if (totalLostLife > 0) {
game.getPlayer(source.getControllerId()).gainLife(totalLostLife, game, source);
} }
if (loseLife > 0)
game.getPlayer(source.getControllerId()).gainLife(loseLife, game, source);
return true; return true;
} }

View file

@ -1,4 +1,3 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID; import java.util.UUID;
@ -43,8 +42,13 @@ public final class GhostCouncilOfOrzhova extends CardImpl {
this.addAbility(ability); this.addAbility(ability);
// {1}, Sacrifice a creature: Exile Ghost Council of Orzhova. Return it to the battlefield under its owner's control at the beginning of the next end step. // {1}, Sacrifice a creature: Exile Ghost Council of Orzhova. Return it to the battlefield under its owner's control at the beginning of the next end step.
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileReturnBattlefieldOwnerNextEndStepSourceEffect(true), new GenericManaCost(1)); ability = new SimpleActivatedAbility(
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT))); Zone.BATTLEFIELD,
new ExileReturnBattlefieldOwnerNextEndStepSourceEffect(true),
new GenericManaCost(1));
ability.addCost(new SacrificeTargetCost(
new TargetControlledCreaturePermanent(
FILTER_CONTROLLED_CREATURE_SHORT_TEXT)));
this.addAbility(ability); this.addAbility(ability);
} }
@ -62,7 +66,7 @@ public final class GhostCouncilOfOrzhova extends CardImpl {
class GhostCouncilOfOrzhovaEffect extends OneShotEffect { class GhostCouncilOfOrzhovaEffect extends OneShotEffect {
GhostCouncilOfOrzhovaEffect() { GhostCouncilOfOrzhovaEffect() {
super(Outcome.Damage); super(Outcome.GainLife);
staticText = "target opponent loses 1 life and you gain 1 life"; staticText = "target opponent loses 1 life and you gain 1 life";
} }
@ -73,10 +77,12 @@ class GhostCouncilOfOrzhovaEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(source.getFirstTarget()); Player targetPlayer = game.getPlayer(source.getFirstTarget());
Player controllerPlayer = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (targetPlayer != null && controllerPlayer != null) { if (targetPlayer != null
&& controller != null) {
targetPlayer.loseLife(1, game, false); targetPlayer.loseLife(1, game, false);
controllerPlayer.gainLife(1, game, source); controller.gainLife(1, game, source);
return true;
} }
return false; return false;
} }

View file

@ -1,4 +1,3 @@
package mage.cards.g; package mage.cards.g;
import java.util.HashMap; import java.util.HashMap;
@ -19,6 +18,7 @@ import mage.constants.WatcherScope;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.players.Player;
import mage.watchers.Watcher; import mage.watchers.Watcher;
/** /**
@ -30,10 +30,14 @@ public final class GontisMachinations extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{B}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{B}");
// Whenever you lose life for the first time each turn, you get {E}. // Whenever you lose life for the first time each turn, you get {E}.
this.addAbility(new GontisMachinationsTriggeredAbility(), new GontisMachinationsFirstLostLifeThisTurnWatcher()); this.addAbility(new GontisMachinationsTriggeredAbility(),
new GontisMachinationsFirstLostLifeThisTurnWatcher());
// Pay {E}{E}, Sacrifice Gonti's Machinations: Each opponent loses 3 life. You gain life equal to the life lost this way. // Pay {E}{E}, Sacrifice Gonti's Machinations: Each opponent loses 3 life. You gain life equal to the life lost this way.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GontisMachinationsEffect(), new PayEnergyCost(2)); Ability ability = new SimpleActivatedAbility(
Zone.BATTLEFIELD,
new GontisMachinationsEffect(),
new PayEnergyCost(2));
ability.addCost(new SacrificeSourceCost()); ability.addCost(new SacrificeSourceCost());
this.addAbility(ability); this.addAbility(ability);
@ -69,7 +73,8 @@ class GontisMachinationsTriggeredAbility extends TriggeredAbilityImpl {
if (event.getPlayerId().equals(getControllerId())) { if (event.getPlayerId().equals(getControllerId())) {
GontisMachinationsFirstLostLifeThisTurnWatcher watcher GontisMachinationsFirstLostLifeThisTurnWatcher watcher
= game.getState().getWatcher(GontisMachinationsFirstLostLifeThisTurnWatcher.class); = game.getState().getWatcher(GontisMachinationsFirstLostLifeThisTurnWatcher.class);
if (watcher != null && watcher.timesLostLifeThisTurn(event.getTargetId()) < 2) { if (watcher != null
&& watcher.timesLostLifeThisTurn(event.getTargetId()) < 2) {
return true; return true;
} }
} }
@ -129,7 +134,7 @@ class GontisMachinationsFirstLostLifeThisTurnWatcher extends Watcher {
class GontisMachinationsEffect extends OneShotEffect { class GontisMachinationsEffect extends OneShotEffect {
public GontisMachinationsEffect() { public GontisMachinationsEffect() {
super(Outcome.Damage); super(Outcome.GainLife);
staticText = "Each opponent loses 3 life. You gain life equal to the life lost this way"; staticText = "Each opponent loses 3 life. You gain life equal to the life lost this way";
} }
@ -139,13 +144,20 @@ class GontisMachinationsEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
int damage = 0; int totalLostLife = 0;
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
for (UUID opponentId : game.getOpponents(source.getControllerId())) { for (UUID opponentId : game.getOpponents(source.getControllerId())) {
damage += game.getPlayer(opponentId).loseLife(3, game, false); Player opponent = game.getPlayer(opponentId);
if (opponent != null) {
totalLostLife += game.getPlayer(opponentId).loseLife(3, game, false);
} }
game.getPlayer(source.getControllerId()).gainLife(damage, game, source); }
game.getPlayer(source.getControllerId()).gainLife(totalLostLife, game, source);
return true; return true;
} }
return false;
}
@Override @Override
public GontisMachinationsEffect copy() { public GontisMachinationsEffect copy() {

View file

@ -30,7 +30,9 @@ public final class GrayMerchantOfAsphodel extends CardImpl {
this.toughness = new MageInt(4); this.toughness = new MageInt(4);
// When Gray Merchant of Asphodel enters the battlefield, each opponent loses X life, where X is your devotion to black. You gain life equal to the life lost this way. // When Gray Merchant of Asphodel enters the battlefield, each opponent loses X life, where X is your devotion to black. You gain life equal to the life lost this way.
this.addAbility(new EntersBattlefieldTriggeredAbility(new GrayMerchantOfAsphodelEffect(), false)); this.addAbility(new EntersBattlefieldTriggeredAbility(
new GrayMerchantOfAsphodelEffect(),
false));
} }
public GrayMerchantOfAsphodel(final GrayMerchantOfAsphodel card) { public GrayMerchantOfAsphodel(final GrayMerchantOfAsphodel card) {
@ -46,8 +48,11 @@ public final class GrayMerchantOfAsphodel extends CardImpl {
class GrayMerchantOfAsphodelEffect extends OneShotEffect { class GrayMerchantOfAsphodelEffect extends OneShotEffect {
public GrayMerchantOfAsphodelEffect() { public GrayMerchantOfAsphodelEffect() {
super(Outcome.Benefit); super(Outcome.GainLife);
this.staticText = "each opponent loses X life, where X is your devotion to black. You gain life equal to the life lost this way. <i>(Each {B} in the mana costs of permanents you control counts towards your devotion to black.)</i>"; this.staticText = "each opponent loses X life, where X is your devotion to black. "
+ "You gain life equal to the life lost this way. "
+ "<i>(Each {B} in the mana costs of permanents you control "
+ "counts towards your devotion to black.)</i>";
} }
public GrayMerchantOfAsphodelEffect(final GrayMerchantOfAsphodelEffect effect) { public GrayMerchantOfAsphodelEffect(final GrayMerchantOfAsphodelEffect effect) {
@ -63,17 +68,17 @@ class GrayMerchantOfAsphodelEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
int lifeLost = 0; int totalLifeLost = 0;
int damage = new DevotionCount(ColoredManaSymbol.B).calculate(game, source, this); int lifeLost = new DevotionCount(ColoredManaSymbol.B).calculate(game, source, this);
if (damage > 0) { if (lifeLost > 0) {
for (UUID playerId : game.getOpponents(source.getControllerId())) { for (UUID playerId : game.getOpponents(source.getControllerId())) {
Player opponent = game.getPlayer(playerId); Player opponent = game.getPlayer(playerId);
if (opponent != null) { if (opponent != null) {
lifeLost += opponent.loseLife(damage, game, false); totalLifeLost += opponent.loseLife(lifeLost, game, false);
} }
} }
} }
controller.gainLife(lifeLost, game, source); controller.gainLife(totalLifeLost, game, source);
return true; return true;
} }
return false; return false;

View file

@ -1,4 +1,3 @@
package mage.cards.h; package mage.cards.h;
import java.util.UUID; import java.util.UUID;
@ -11,6 +10,7 @@ import mage.abilities.condition.Condition;
import mage.abilities.condition.common.CardsInHandCondition; import mage.abilities.condition.common.CardsInHandCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
@ -23,6 +23,7 @@ import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType; import mage.game.events.GameEvent.EventType;
import mage.players.Player; import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/** /**
* *
@ -33,7 +34,7 @@ public final class HollowbornBarghest extends CardImpl {
private static final String rule = "At the beginning of your upkeep, if you have no cards in hand, each opponent loses 2 life."; private static final String rule = "At the beginning of your upkeep, if you have no cards in hand, each opponent loses 2 life.";
public HollowbornBarghest(UUID ownerId, CardSetInfo setInfo) { public HollowbornBarghest(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{B}{B}");
this.subtype.add(SubType.DEMON); this.subtype.add(SubType.DEMON);
this.subtype.add(SubType.HOUND); this.subtype.add(SubType.HOUND);
@ -42,8 +43,14 @@ public final class HollowbornBarghest extends CardImpl {
// At the beginning of your upkeep, if you have no cards in hand, each opponent loses 2 life. // At the beginning of your upkeep, if you have no cards in hand, each opponent loses 2 life.
Condition condition = new CardsInHandCondition(ComparisonType.EQUAL_TO, 0); Condition condition = new CardsInHandCondition(ComparisonType.EQUAL_TO, 0);
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new HollowbornBarghestEffect(), TargetController.YOU, false); TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, condition, rule)); new HollowbornBarghestEffect(),
TargetController.YOU,
false);
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
ability,
condition,
rule));
// At the beginning of each opponent's upkeep, if that player has no cards in hand, he or she loses 2 life. // At the beginning of each opponent's upkeep, if that player has no cards in hand, he or she loses 2 life.
this.addAbility(new HollowbornBarghestTriggeredAbility()); this.addAbility(new HollowbornBarghestTriggeredAbility());
@ -62,7 +69,7 @@ public final class HollowbornBarghest extends CardImpl {
class HollowbornBarghestEffect extends OneShotEffect { class HollowbornBarghestEffect extends OneShotEffect {
public HollowbornBarghestEffect() { public HollowbornBarghestEffect() {
super(Outcome.Damage); super(Outcome.Benefit);
staticText = "Each opponent loses 2 life"; staticText = "Each opponent loses 2 life";
} }
@ -73,8 +80,11 @@ class HollowbornBarghestEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
for (UUID opponentId : game.getOpponents(source.getControllerId())) { for (UUID opponentId : game.getOpponents(source.getControllerId())) {
Player opponent = game.getPlayer(opponentId);
if (opponent != null) {
game.getPlayer(opponentId).loseLife(2, game, false); game.getPlayer(opponentId).loseLife(2, game, false);
} }
}
return true; return true;
} }
@ -88,7 +98,7 @@ class HollowbornBarghestEffect extends OneShotEffect {
class HollowbornBarghestTriggeredAbility extends TriggeredAbilityImpl { class HollowbornBarghestTriggeredAbility extends TriggeredAbilityImpl {
public HollowbornBarghestTriggeredAbility() { public HollowbornBarghestTriggeredAbility() {
super(Zone.BATTLEFIELD, null); super(Zone.BATTLEFIELD, new LoseLifeTargetEffect(2));
} }
public HollowbornBarghestTriggeredAbility(final HollowbornBarghestTriggeredAbility ability) { public HollowbornBarghestTriggeredAbility(final HollowbornBarghestTriggeredAbility ability) {
@ -102,18 +112,18 @@ class HollowbornBarghestTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkEventType(GameEvent event, Game game) { public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.UPKEEP_STEP_PRE; return event.getType() == EventType.UPKEEP_STEP_PRE
&& game.getOpponents(controllerId).contains(event.getPlayerId());
} }
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
Player opponent = game.getPlayer(event.getPlayerId()); Player opponent = game.getPlayer(event.getPlayerId());
if (opponent != null && opponent.getHand().isEmpty()) { if (opponent != null
opponent.loseLife(2, game, false); && opponent.getHand().isEmpty()) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(opponent.getId()));
return true; return true;
} }
}
return false; return false;
} }

View file

@ -1,4 +1,3 @@
package mage.cards.l; package mage.cards.l;
import java.util.UUID; import java.util.UUID;
@ -24,14 +23,14 @@ import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.players.Players;
/** /**
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class LeechriddenSwamp extends CardImpl { public final class LeechriddenSwamp extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("you control two or more black permanents"); private static final FilterControlledPermanent filter =
new FilterControlledPermanent("you control two or more black permanents");
static { static {
filter.add(new ColorPredicate(ObjectColor.BLACK)); filter.add(new ColorPredicate(ObjectColor.BLACK));
@ -48,10 +47,14 @@ public final class LeechriddenSwamp extends CardImpl {
this.addAbility(new EntersBattlefieldTappedAbility()); this.addAbility(new EntersBattlefieldTappedAbility());
// {B}, {tap}: Each opponent loses 1 life. Activate this ability only if you control two or more black permanents. // {B}, {tap}: Each opponent loses 1 life. Activate this ability only if you control two or more black permanents.
Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, Ability ability = new ActivateIfConditionActivatedAbility(
Zone.BATTLEFIELD,
new LeechriddenSwampLoseLifeEffect(), new LeechriddenSwampLoseLifeEffect(),
new ManaCostsImpl("{B}"), new ManaCostsImpl("{B}"),
new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 1)); new PermanentsOnTheBattlefieldCondition(
filter,
ComparisonType.MORE_THAN,
1));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
this.addAbility(ability); this.addAbility(ability);
} }
@ -68,11 +71,9 @@ public final class LeechriddenSwamp extends CardImpl {
class LeechriddenSwampLoseLifeEffect extends OneShotEffect { class LeechriddenSwampLoseLifeEffect extends OneShotEffect {
private static final String effectText = "each opponent loses 1 life";
LeechriddenSwampLoseLifeEffect() { LeechriddenSwampLoseLifeEffect() {
super(Outcome.Damage); super(Outcome.Benefit);
staticText = effectText; staticText = "each opponent loses 1 life";
} }
LeechriddenSwampLoseLifeEffect(LeechriddenSwampLoseLifeEffect effect) { LeechriddenSwampLoseLifeEffect(LeechriddenSwampLoseLifeEffect effect) {
@ -81,14 +82,18 @@ class LeechriddenSwampLoseLifeEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Players players = game.getPlayers(); Player controller = game.getPlayer(source.getControllerId());
for (Player player : players.values()) { if (controller != null) {
if (!player.getId().equals(source.getControllerId())) { for (UUID opponentId : game.getOpponents(controller.getId())) {
player.loseLife(1, game, false); Player opponent = game.getPlayer(opponentId);
if (opponent != null) {
opponent.loseLife(1, game, false);
} }
} }
return true; return true;
} }
return false;
}
@Override @Override
public LeechriddenSwampLoseLifeEffect copy() { public LeechriddenSwampLoseLifeEffect copy() {