From 9aae8c8db7bbb34c3a4cf1c6b3dd0a94d6ef4204 Mon Sep 17 00:00:00 2001 From: Jeff Date: Thu, 14 Mar 2019 11:34:56 -0500 Subject: [PATCH] - Fixed #5632 --- .../mage/cards/l/LudevicNecroAlchemist.java | 47 ++++++++----------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/Mage.Sets/src/mage/cards/l/LudevicNecroAlchemist.java b/Mage.Sets/src/mage/cards/l/LudevicNecroAlchemist.java index 67b4a4bde5..0dfd90b3e2 100644 --- a/Mage.Sets/src/mage/cards/l/LudevicNecroAlchemist.java +++ b/Mage.Sets/src/mage/cards/l/LudevicNecroAlchemist.java @@ -1,6 +1,5 @@ package mage.cards.l; -import java.util.Objects; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; @@ -13,7 +12,6 @@ import mage.cards.CardSetInfo; import mage.constants.*; import mage.game.Game; import mage.players.Player; -import mage.players.PlayerList; import mage.watchers.common.PlayerLostLifeWatcher; /** @@ -32,8 +30,12 @@ public final class LudevicNecroAlchemist extends CardImpl { this.toughness = new MageInt(4); // At the beginning of each player's end step, that player may draw a card if a player other than you lost life this turn. - this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, - new LudevicNecroAlchemistEffect(), TargetController.EACH_PLAYER, new LudevicNecroAlchemistCondition(), false)); + this.addAbility(new BeginningOfEndStepTriggeredAbility( + Zone.BATTLEFIELD, + new LudevicNecroAlchemistEffect(), + TargetController.EACH_PLAYER, + new LudevicNecroAlchemistCondition(), + false)); // Partner this.addAbility(PartnerAbility.getInstance()); @@ -54,24 +56,15 @@ class LudevicNecroAlchemistCondition implements Condition { @Override public boolean apply(Game game, Ability source) { PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class); - PlayerList playerList = game.getState().getPlayerList().copy(); - Player currentPlayer; - UUID sourcePlayerId = source.getControllerId(); - Player firstPlayer; - if (playerList == null) { - return false; - } - firstPlayer = playerList.getCurrent(game); - currentPlayer = playerList.getNext(game); - - while (watcher != null && currentPlayer != null) { - if (!Objects.equals(currentPlayer.getId(), sourcePlayerId) && watcher.getLifeLost(currentPlayer.getId()) > 0) { - return true; + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null + && watcher != null + && watcher.getLifeLost(controller.getId()) == 0) { + for (UUID playerId : controller.getInRange()) { + if (watcher.getLifeLost(playerId) > 0) { + return true; + } } - if (Objects.equals(currentPlayer, firstPlayer)) { - return false; - } - currentPlayer = playerList.getNext(game); } return false; } @@ -100,13 +93,11 @@ class LudevicNecroAlchemistEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - UUID playerId = game.getActivePlayerId(); - if (playerId != null) { - Player player = game.getPlayer(playerId); - if (player != null && player.chooseUse(outcome, "Draw a card?", source, game)) { - player.drawCards(1, game); - return true; - } + Player player = game.getPlayer(game.getActivePlayerId()); + if (player != null + && player.chooseUse(Outcome.DrawCard, "Draw a card?", source, game)) { + player.drawCards(1, game); + return true; } return false; }