mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Merge branch 'master' of https://github.com/spjspj/mage
This commit is contained in:
commit
735a7cebb3
18 changed files with 59 additions and 167 deletions
|
|
@ -58,7 +58,7 @@ public enum CardRepository {
|
|||
// raise this if db structure was changed
|
||||
private static final long CARD_DB_VERSION = 51;
|
||||
// raise this if new cards were added to the server
|
||||
private static final long CARD_CONTENT_VERSION = 111;
|
||||
private static final long CARD_CONTENT_VERSION = 112;
|
||||
private Dao<CardInfo, Object> cardDao;
|
||||
private Set<String> classNames;
|
||||
|
||||
|
|
|
|||
|
|
@ -139,21 +139,37 @@ public interface Game extends MageItem, Serializable {
|
|||
PlayerList getPlayerList();
|
||||
|
||||
/**
|
||||
* Returns a Set of opponents in range for the given playerId
|
||||
* Returns a Set of opponents in range for the given playerId This return
|
||||
* also a player, that has dies this turn.
|
||||
*
|
||||
* @param playerId
|
||||
* @return
|
||||
*/
|
||||
Set<UUID> getOpponents(UUID playerId);
|
||||
default public Set<UUID> getOpponents(UUID playerId) {
|
||||
Set<UUID> opponents = new HashSet<>();
|
||||
Player player = getPlayer(playerId);
|
||||
for (UUID opponentId : player.getInRange()) {
|
||||
if (!opponentId.equals(playerId)) {
|
||||
opponents.add(opponentId);
|
||||
}
|
||||
}
|
||||
return opponents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given playerToCheckId is an opponent of player
|
||||
* Checks if the given playerToCheckId is an opponent of player As long as
|
||||
* no team formats are implemented, this method returns always true for each
|
||||
* playerId not equal to the player it is checked for. Also if this player
|
||||
* is out of range. This method can't handle that only players in range are
|
||||
* processed because it can only return TRUE or FALSE.
|
||||
*
|
||||
* @param player
|
||||
* @param playerToCheckId
|
||||
* @return
|
||||
*/
|
||||
boolean isOpponent(Player player, UUID playerToCheckId);
|
||||
default public boolean isOpponent(Player player, UUID playerToCheckId) {
|
||||
return !player.getId().equals(playerToCheckId);
|
||||
}
|
||||
|
||||
Turn getTurn();
|
||||
|
||||
|
|
|
|||
|
|
@ -27,14 +27,13 @@
|
|||
*/
|
||||
package mage.game;
|
||||
|
||||
import java.util.*;
|
||||
import mage.constants.MultiplayerAttackOption;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.RangeOfInfluence;
|
||||
import mage.game.turn.TurnMod;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public abstract class GameCanadianHighlanderImpl extends GameImpl {
|
||||
|
||||
protected boolean startingPlayerSkipsDraw = true;
|
||||
|
|
@ -160,19 +159,4 @@ public abstract class GameCanadianHighlanderImpl extends GameImpl {
|
|||
super.endMulligan(playerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> getOpponents(UUID playerId) {
|
||||
Set<UUID> opponents = new HashSet<>();
|
||||
for (UUID opponentId : getState().getPlayersInRange(playerId, this)) {
|
||||
if (!opponentId.equals(playerId)) {
|
||||
opponents.add(opponentId);
|
||||
}
|
||||
}
|
||||
return opponents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpponent(Player player, UUID playerToCheck) {
|
||||
return !player.getId().equals(playerToCheck);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,9 +27,7 @@
|
|||
*/
|
||||
package mage.game;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
|
@ -200,22 +198,6 @@ public abstract class GameCommanderImpl extends GameImpl {
|
|||
return super.checkStateBasedActions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> getOpponents(UUID playerId) {
|
||||
Set<UUID> opponents = new HashSet<>();
|
||||
for (UUID opponentId : getState().getPlayersInRange(playerId, this)) {
|
||||
if (!opponentId.equals(playerId)) {
|
||||
opponents.add(opponentId);
|
||||
}
|
||||
}
|
||||
return opponents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpponent(Player player, UUID playerToCheck) {
|
||||
return !player.getId().equals(playerToCheck);
|
||||
}
|
||||
|
||||
public void setAlsoHand(boolean alsoHand) {
|
||||
this.alsoHand = alsoHand;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,22 +132,6 @@ public abstract class GameTinyLeadersImpl extends GameImpl {
|
|||
return commander;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> getOpponents(UUID playerId) {
|
||||
Set<UUID> opponents = new HashSet<>();
|
||||
for (UUID opponentId : getState().getPlayersInRange(playerId, this)) {
|
||||
if (!opponentId.equals(playerId)) {
|
||||
opponents.add(opponentId);
|
||||
}
|
||||
}
|
||||
return opponents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpponent(Player player, UUID playerToCheck) {
|
||||
return !player.getId().equals(playerToCheck);
|
||||
}
|
||||
|
||||
public void setAlsoHand(boolean alsoHand) {
|
||||
this.alsoHand = alsoHand;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -795,6 +795,7 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
* @param withName
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId, Game game, Zone fromZone, boolean withName);
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue