diff --git a/Mage/src/main/java/mage/abilities/condition/common/CorruptedCondition.java b/Mage/src/main/java/mage/abilities/condition/common/CorruptedCondition.java index a01806a78b..315e78c9b7 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/CorruptedCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/CorruptedCondition.java @@ -6,7 +6,6 @@ import mage.abilities.hint.ConditionHint; import mage.abilities.hint.Hint; import mage.counters.CounterType; import mage.game.Game; -import mage.game.stack.Spell; import mage.players.Player; import java.util.Objects; @@ -21,7 +20,7 @@ public enum CorruptedCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - return game.getOpponents(source.getControllerId()) + return game.getOpponents(source.getControllerId(), true) .stream() .map(game::getPlayer) .filter(Objects::nonNull) diff --git a/Mage/src/main/java/mage/abilities/condition/common/OneOpponentCondition.java b/Mage/src/main/java/mage/abilities/condition/common/OneOpponentCondition.java index bc63a4a55a..103b657b5b 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/OneOpponentCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/OneOpponentCondition.java @@ -15,11 +15,10 @@ public enum OneOpponentCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - return game.getOpponents(source.getControllerId()) + return game.getOpponents(source.getControllerId(), true) .stream() .map(game::getPlayer) .filter(Objects::nonNull) - .filter(player -> !player.hasLost()) .count() <= 1; } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/OpponentsPoisonCountersCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/OpponentsPoisonCountersCount.java index 76f16fe6ad..9d672b3587 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/OpponentsPoisonCountersCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/OpponentsPoisonCountersCount.java @@ -16,7 +16,7 @@ public enum OpponentsPoisonCountersCount implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { int amount = 0; - Set playerList = game.getOpponents(sourceAbility.getControllerId()); + Set playerList = game.getOpponents(sourceAbility.getControllerId(), true); for (UUID playerUUID : playerList) { Player player = game.getPlayer(playerUUID); if (player != null) { diff --git a/Mage/src/main/java/mage/game/Game.java b/Mage/src/main/java/mage/game/Game.java index 96d34899d7..39f035d5d2 100644 --- a/Mage/src/main/java/mage/game/Game.java +++ b/Mage/src/main/java/mage/game/Game.java @@ -136,14 +136,18 @@ public interface Game extends MageItem, Serializable, Copyable { PlayerList getPlayerList(); + default Set getOpponents(UUID playerId) { + return getOpponents(playerId, false); + } + /** - * Returns a Set of opponents in range for the given playerId This return - * also a player, that has dies this turn. + * Returns a Set of opponents in range for the given playerId * * @param playerId + * @param excludeDeadPlayers Determines if players who have lost are excluded from the list * @return */ - default Set getOpponents(UUID playerId) { + default Set getOpponents(UUID playerId, boolean excludeDeadPlayers) { Player player = getPlayer(playerId); if (player == null) { return new HashSet<>(); @@ -151,6 +155,7 @@ public interface Game extends MageItem, Serializable, Copyable { return player.getInRange().stream() .filter(opponentId -> !opponentId.equals(playerId)) + .filter(opponentId -> !excludeDeadPlayers || !getPlayer(opponentId).hasLost()) .collect(Collectors.toSet()); }