Refactor: added missing getPlayersInRange in cards code (to ignore leaved/lost players);

This commit is contained in:
Oleg Agafonov 2019-12-26 05:24:44 +04:00
parent 04cceb9b62
commit 61a58d36c2
15 changed files with 75 additions and 110 deletions

View file

@ -1,8 +1,5 @@
package mage.game;
import java.io.Serializable;
import java.util.*;
import java.util.stream.Collectors;
import mage.MageItem;
import mage.MageObject;
import mage.abilities.Ability;
@ -44,6 +41,10 @@ import mage.players.Players;
import mage.util.MessageToClient;
import mage.util.functions.ApplyToPermanent;
import java.io.Serializable;
import java.util.*;
import java.util.stream.Collectors;
public interface Game extends MageItem, Serializable {
MatchType getGameType();
@ -127,7 +128,6 @@ public interface Game extends MageItem, Serializable {
return player.getInRange().stream()
.filter(opponentId -> !opponentId.equals(playerId))
.collect(Collectors.toSet());
}
default boolean isActivePlayer(UUID playerId) {
@ -298,9 +298,9 @@ public interface Game extends MageItem, Serializable {
/**
* Creates and fires an damage prevention event
*
* @param damageEvent damage event that will be replaced (instanceof check
* will be done)
* @param source ability that's the source of the prevention effect
* @param damageEvent damage event that will be replaced (instanceof check
* will be done)
* @param source ability that's the source of the prevention effect
* @param game
* @param amountToPrevent max preventable amount
* @return true prevention was successfull / false prevention was replaced
@ -310,12 +310,12 @@ public interface Game extends MageItem, Serializable {
/**
* Creates and fires an damage prevention event
*
* @param event damage event that will be replaced (instanceof check will be
* done)
* @param source ability that's the source of the prevention effect
* @param event damage event that will be replaced (instanceof check will be
* done)
* @param source ability that's the source of the prevention effect
* @param game
* @param preventAllDamage true if there is no limit to the damage that can
* be prevented
* be prevented
* @return true prevention was successfull / false prevention was replaced
*/
PreventionEffectData preventDamage(GameEvent event, Ability source, Game game, boolean preventAllDamage);