diff --git a/Mage.Sets/src/mage/cards/k/KeeperOfTheDead.java b/Mage.Sets/src/mage/cards/k/KeeperOfTheDead.java index 045f186afd..e3dce0a192 100644 --- a/Mage.Sets/src/mage/cards/k/KeeperOfTheDead.java +++ b/Mage.Sets/src/mage/cards/k/KeeperOfTheDead.java @@ -83,7 +83,7 @@ public class KeeperOfTheDead extends CardImpl { this.power = new MageInt(1); this.toughness = new MageInt(2); - // {B}, {tap}: Choose target opponent who had at least two fewer creature cards in his or her graveyard than you did as you activated this ability. Destroy target nonblack creature he or she controls. + // {B}, {T}: Choose target opponent who had at least two fewer creature cards in his or her graveyard than you did as you activated this ability. Destroy target nonblack creature he or she controls. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new KeeperOfTheDeadEffect(), new TapSourceCost()); ability.addCost(new ManaCostsImpl("{B}")); ability.addTarget(new TargetPlayer(1, 1, false, filter)); @@ -136,10 +136,10 @@ class KeeperOfDeadPredicate implements ObjectSourcePlayerPredicate availablePossibleTargets = super.possibleTargets(sourceId, sourceControllerId, game); Set possibleTargets = new HashSet<>(); int lifeController = game.getPlayer(sourceControllerId).getLife(); - + for (UUID targetId : availablePossibleTargets) { Player opponent = game.getPlayer(targetId); - if (opponent != null){ + if (opponent != null) { int lifeOpponent = opponent.getLife(); - if (lifeOpponent > lifeController){ + if (lifeOpponent > lifeController) { possibleTargets.add(targetId); } } } return possibleTargets; } - - @Override - public KeeperOfTheLightTarget copy() { - return new KeeperOfTheLightTarget(this); - } - - @Override - public String toString() { - return "opponent who had more life than you did as you activated this ability"; - } -} - -enum KeeperOfTheLightCondition implements Condition { - - instance; @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); + public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) { + int count = 0; + MageObject targetSource = game.getObject(sourceId); + Player controller = game.getPlayer(sourceControllerId); if (controller != null) { - int controllerLife = controller.getLife(); - - for (UUID playerId : game.getPlayerList()){ - if (controllerLife < game.getPlayer(playerId).getLife()){ - return true; + for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) { + Player player = game.getPlayer(playerId); + if (player != null + && controller.getLife() < player.getLife() + && !player.hasLeft() + && filter.match(player, sourceId, sourceControllerId, game) + && player.canBeTargetedBy(targetSource, sourceControllerId, game)) { + count++; + if (count >= this.minNumberOfTargets) { + return true; + } } } } @@ -152,9 +133,7 @@ enum KeeperOfTheLightCondition implements Condition { } @Override - public String toString() { - return "you have less life than an opponent"; + public KeeperOfTheLightTarget copy() { + return new KeeperOfTheLightTarget(this); } - } - diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index 98298e835c..3574836bf9 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -2272,6 +2272,11 @@ public abstract class GameImpl implements Game, Serializable { return state.getPlayers(); } + /** + * Return a list of all players ignoring the range of visible players + * + * @return + */ @Override public PlayerList getPlayerList() { return state.getPlayerList();