mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Fixed some problems with possible ConcurrentModificationExceptions and some minor changes.
This commit is contained in:
parent
d97f6c6cd1
commit
81af372bc1
144 changed files with 410 additions and 429 deletions
|
@ -144,10 +144,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
private static final String TITLE_NAME = "XMage";
|
||||
|
||||
private static final Logger logger = Logger.getLogger(MageFrame.class);
|
||||
private static final String liteModeArg = "-lite";
|
||||
private static final String grayModeArg = "-gray";
|
||||
private static final String fullscreenArg = "-fullscreen";
|
||||
private static final Logger LOGGER = Logger.getLogger(MageFrame.class);
|
||||
private static final String LITE_MODE_ARG = "-lite";
|
||||
private static final String GRAY_MODE_ARG = "-gray";
|
||||
private static final String FILL_SCREEN_ARG = "-fullscreen";
|
||||
|
||||
private static MageFrame instance;
|
||||
|
||||
|
@ -155,10 +155,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
private ConnectDialog connectDialog;
|
||||
private final ErrorDialog errorDialog;
|
||||
private static CallbackClient callbackClient;
|
||||
private static final Preferences prefs = Preferences.userNodeForPackage(MageFrame.class);
|
||||
private static final Preferences PREFS = Preferences.userNodeForPackage(MageFrame.class);
|
||||
private JLabel title;
|
||||
private Rectangle titleRectangle;
|
||||
private static final MageVersion version = new MageVersion(MageVersion.MAGE_VERSION_MAJOR, MageVersion.MAGE_VERSION_MINOR, MageVersion.MAGE_VERSION_PATCH, MageVersion.MAGE_VERSION_MINOR_PATCH, MageVersion.MAGE_VERSION_INFO);
|
||||
private static final MageVersion VERSION = new MageVersion(MageVersion.MAGE_VERSION_MAJOR, MageVersion.MAGE_VERSION_MINOR, MageVersion.MAGE_VERSION_PATCH, MageVersion.MAGE_VERSION_MINOR_PATCH, MageVersion.MAGE_VERSION_INFO);
|
||||
private UUID clientId;
|
||||
private static MagePane activeFrame;
|
||||
private static boolean liteMode = false;
|
||||
|
@ -166,12 +166,12 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
private static boolean grayMode = false;
|
||||
private static boolean fullscreenMode = false;
|
||||
|
||||
private static final Map<UUID, ChatPanelBasic> chats = new HashMap<>();
|
||||
private static final Map<UUID, GamePanel> games = new HashMap<>();
|
||||
private static final Map<UUID, DraftPanel> drafts = new HashMap<>();
|
||||
private static final MageUI ui = new MageUI();
|
||||
private static final Map<UUID, ChatPanelBasic> CHATS = new HashMap<>();
|
||||
private static final Map<UUID, GamePanel> GAMES = new HashMap<>();
|
||||
private static final Map<UUID, DraftPanel> DRAFTS = new HashMap<>();
|
||||
private static final MageUI UI = new MageUI();
|
||||
|
||||
private static final ScheduledExecutorService pingTaskExecutor = Executors.newSingleThreadScheduledExecutor();
|
||||
private static final ScheduledExecutorService PING_TASK_EXECUTOR = Executors.newSingleThreadScheduledExecutor();
|
||||
private static UpdateMemUsageTask updateMemUsageTask;
|
||||
|
||||
private static long startTime;
|
||||
|
@ -188,7 +188,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
|
||||
public static Preferences getPreferences() {
|
||||
return prefs;
|
||||
return PREFS;
|
||||
}
|
||||
|
||||
public static boolean isLite() {
|
||||
|
@ -201,7 +201,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
@Override
|
||||
public MageVersion getVersion() {
|
||||
return version;
|
||||
return VERSION;
|
||||
}
|
||||
|
||||
public static MageFrame getInstance() {
|
||||
|
@ -231,7 +231,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
UIManager.put("desktop", new Color(0, 0, 0, 0));
|
||||
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
|
||||
} catch (Exception ex) {
|
||||
logger.fatal(null, ex);
|
||||
LOGGER.fatal(null, ex);
|
||||
}
|
||||
|
||||
ManaSymbols.loadImages();
|
||||
|
@ -253,9 +253,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
errorDialog = new ErrorDialog();
|
||||
errorDialog.setLocation(100, 100);
|
||||
desktopPane.add(errorDialog, JLayeredPane.POPUP_LAYER);
|
||||
ui.addComponent(MageComponents.DESKTOP_PANE, desktopPane);
|
||||
UI.addComponent(MageComponents.DESKTOP_PANE, desktopPane);
|
||||
|
||||
pingTaskExecutor.scheduleAtFixedRate(new Runnable() {
|
||||
PING_TASK_EXECUTOR.scheduleAtFixedRate(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
session.ping();
|
||||
|
@ -269,7 +269,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
desktopPane.add(tablesPane, javax.swing.JLayeredPane.DEFAULT_LAYER);
|
||||
tablesPane.setMaximum(true);
|
||||
} catch (PropertyVetoException ex) {
|
||||
logger.fatal(null, ex);
|
||||
LOGGER.fatal(null, ex);
|
||||
}
|
||||
|
||||
addTooltipContainer();
|
||||
|
@ -343,7 +343,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
label.setBounds(0, 0, 180, 30);
|
||||
}
|
||||
|
||||
ui.addButton(MageComponents.TABLES_MENU_BUTTON, btnGames);
|
||||
UI.addButton(MageComponents.TABLES_MENU_BUTTON, btnGames);
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
|
@ -353,7 +353,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
checkForNewImages();
|
||||
}
|
||||
updateMemUsageTask.execute();
|
||||
logger.info("Client start up time: " + ((System.currentTimeMillis() - startTime) / 1000 + " seconds"));
|
||||
LOGGER.info("Client start up time: " + ((System.currentTimeMillis() - startTime) / 1000 + " seconds"));
|
||||
if (autoConnect()) {
|
||||
enableButtons();
|
||||
} else {
|
||||
|
@ -373,7 +373,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
private void setWindowTitle() {
|
||||
setTitle(TITLE_NAME + " Client: "
|
||||
+ (version == null ? "<not available>" : version.toString()) + " Server: "
|
||||
+ (VERSION == null ? "<not available>" : VERSION.toString()) + " Server: "
|
||||
+ ((session != null && session.isConnected()) ? session.getVersionInfo() : "<not connected>"));
|
||||
}
|
||||
|
||||
|
@ -397,8 +397,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
desktopPane.add(popupContainer, JLayeredPane.POPUP_LAYER);
|
||||
|
||||
ui.addComponent(MageComponents.CARD_INFO_PANE, cardInfoPane);
|
||||
ui.addComponent(MageComponents.POPUP_CONTAINER, popupContainer);
|
||||
UI.addComponent(MageComponents.CARD_INFO_PANE, cardInfoPane);
|
||||
UI.addComponent(MageComponents.POPUP_CONTAINER, popupContainer);
|
||||
|
||||
// preview panel normal
|
||||
JPanel cardPreviewContainer = new JPanel();
|
||||
|
@ -413,8 +413,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
cardPreviewContainer.setVisible(false);
|
||||
cardPreviewContainer.setBounds(0, 0, 320 + 80, 500 + 30);
|
||||
|
||||
ui.addComponent(MageComponents.CARD_PREVIEW_PANE, bigCard);
|
||||
ui.addComponent(MageComponents.CARD_PREVIEW_CONTAINER, cardPreviewContainer);
|
||||
UI.addComponent(MageComponents.CARD_PREVIEW_PANE, bigCard);
|
||||
UI.addComponent(MageComponents.CARD_PREVIEW_CONTAINER, cardPreviewContainer);
|
||||
|
||||
desktopPane.add(cardPreviewContainer, JLayeredPane.POPUP_LAYER);
|
||||
|
||||
|
@ -430,8 +430,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
cardPreviewContainerRotated.setVisible(false);
|
||||
cardPreviewContainerRotated.setBounds(0, 0, 500 + 80, 420 + 30);
|
||||
|
||||
ui.addComponent(MageComponents.CARD_PREVIEW_PANE_ROTATED, bigCard);
|
||||
ui.addComponent(MageComponents.CARD_PREVIEW_CONTAINER_ROTATED, cardPreviewContainerRotated);
|
||||
UI.addComponent(MageComponents.CARD_PREVIEW_PANE_ROTATED, bigCard);
|
||||
UI.addComponent(MageComponents.CARD_PREVIEW_CONTAINER_ROTATED, cardPreviewContainerRotated);
|
||||
|
||||
desktopPane.add(cardPreviewContainerRotated, JLayeredPane.POPUP_LAYER);
|
||||
|
||||
|
@ -453,7 +453,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
backgroundPane.setSize(1024, 768);
|
||||
desktopPane.add(backgroundPane, JLayeredPane.DEFAULT_LAYER);
|
||||
} catch (IOException e) {
|
||||
logger.fatal("Error while setting background.", e);
|
||||
LOGGER.fatal("Error while setting background.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -476,7 +476,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
backgroundPane.add(title);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.fatal("Error while adding mage label.", e);
|
||||
LOGGER.fatal("Error while adding mage label.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -546,11 +546,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
private void checkForNewImages() {
|
||||
long beforeCall = System.currentTimeMillis();
|
||||
List<CardInfo> cards = CardRepository.instance.findCards(new CardCriteria());
|
||||
logger.info("Card pool load time: " + ((System.currentTimeMillis() - beforeCall) / 1000 + " seconds"));
|
||||
LOGGER.info("Card pool load time: " + ((System.currentTimeMillis() - beforeCall) / 1000 + " seconds"));
|
||||
|
||||
beforeCall = System.currentTimeMillis();
|
||||
if (DownloadPictures.checkForNewCards(cards)) {
|
||||
logger.info("Card images checking time: " + ((System.currentTimeMillis() - beforeCall) / 1000 + " seconds"));
|
||||
LOGGER.info("Card images checking time: " + ((System.currentTimeMillis() - beforeCall) / 1000 + " seconds"));
|
||||
if (JOptionPane.showConfirmDialog(this, "New cards are available. Do you want to download the images?", "New images available", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
DownloadPictures.startDownload(null, cards);
|
||||
}
|
||||
|
@ -574,7 +574,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
activeFrame = null;
|
||||
return;
|
||||
}
|
||||
logger.debug("Setting " + frame.getTitle() + " active");
|
||||
LOGGER.debug("Setting " + frame.getTitle() + " active");
|
||||
if (activeFrame != null) {
|
||||
activeFrame.deactivated();
|
||||
}
|
||||
|
@ -584,7 +584,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
try {
|
||||
activeFrame.setSelected(true);
|
||||
} catch (PropertyVetoException ex) {
|
||||
logger.error("Error setting " + frame.getTitle() + " active");
|
||||
LOGGER.error("Error setting " + frame.getTitle() + " active");
|
||||
}
|
||||
activeFrame.activated();
|
||||
ArrowBuilder.getBuilder().hideAllPanels();
|
||||
|
@ -737,7 +737,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
|
||||
public boolean autoConnect() {
|
||||
boolean autoConnectParamValue = Boolean.parseBoolean(prefs.get("autoConnect", "false"));
|
||||
boolean autoConnectParamValue = Boolean.parseBoolean(PREFS.get("autoConnect", "false"));
|
||||
boolean status = false;
|
||||
if (autoConnectParamValue) {
|
||||
status = performConnect();
|
||||
|
@ -750,11 +750,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
int port = MagePreferences.getServerPort();
|
||||
String userName = MagePreferences.getUserName(server);
|
||||
String password = MagePreferences.getPassword(server);
|
||||
String proxyServer = prefs.get("proxyAddress", "");
|
||||
int proxyPort = Integer.parseInt(prefs.get("proxyPort", "0"));
|
||||
ProxyType proxyType = ProxyType.valueByText(prefs.get("proxyType", "None"));
|
||||
String proxyUsername = prefs.get("proxyUsername", "");
|
||||
String proxyPassword = prefs.get("proxyPassword", "");
|
||||
String proxyServer = PREFS.get("proxyAddress", "");
|
||||
int proxyPort = Integer.parseInt(PREFS.get("proxyPort", "0"));
|
||||
ProxyType proxyType = ProxyType.valueByText(PREFS.get("proxyType", "None"));
|
||||
String proxyUsername = PREFS.get("proxyUsername", "");
|
||||
String proxyPassword = PREFS.get("proxyPassword", "");
|
||||
try {
|
||||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||
Connection connection = new Connection();
|
||||
|
@ -770,7 +770,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
setUserPrefsToConnection(connection);
|
||||
|
||||
logger.debug("connecting (auto): " + proxyType + " " + proxyServer + " " + proxyPort + " " + proxyUsername);
|
||||
LOGGER.debug("connecting (auto): " + proxyType + " " + proxyServer + " " + proxyPort + " " + proxyUsername);
|
||||
if (MageFrame.connect(connection)) {
|
||||
showGames(false);
|
||||
return true;
|
||||
|
@ -981,7 +981,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
AboutDialog aboutDialog = new AboutDialog();
|
||||
desktopPane.add(aboutDialog, JLayeredPane.POPUP_LAYER);
|
||||
aboutDialog.showDialog(version);
|
||||
aboutDialog.showDialog(VERSION);
|
||||
}//GEN-LAST:event_btnAboutActionPerformed
|
||||
|
||||
private void btnCollectionViewerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCollectionViewerActionPerformed
|
||||
|
@ -1006,10 +1006,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
return;
|
||||
}
|
||||
session.disconnect(false);
|
||||
} else {
|
||||
if (JOptionPane.showConfirmDialog(this, "Are you sure you want to exit?", "Confirm exit", JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
|
||||
return;
|
||||
}
|
||||
} else if (JOptionPane.showConfirmDialog(this, "Are you sure you want to exit?", "Confirm exit", JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
|
||||
return;
|
||||
}
|
||||
CardRepository.instance.closeDB();
|
||||
tablesPane.cleanUp();
|
||||
|
@ -1044,8 +1042,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
if (setActive) {
|
||||
setActive(tablesPane);
|
||||
} else {
|
||||
// if other panel was already shown, mamke sure it's topmost again
|
||||
} else // if other panel was already shown, mamke sure it's topmost again
|
||||
{
|
||||
if (topPanebefore != null) {
|
||||
setActive(topPanebefore);
|
||||
}
|
||||
|
@ -1107,7 +1105,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
deckEditorPane.show(mode, deck, name, tableId, time);
|
||||
setActive(deckEditorPane);
|
||||
} catch (PropertyVetoException ex) {
|
||||
logger.fatal(null, ex);
|
||||
LOGGER.fatal(null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1158,7 +1156,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
collectionViewerPane.setVisible(true);
|
||||
setActive(collectionViewerPane);
|
||||
} catch (PropertyVetoException ex) {
|
||||
logger.fatal(null, ex);
|
||||
LOGGER.fatal(null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1176,27 +1174,27 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
public static void main(final String args[]) {
|
||||
// Workaround for #451
|
||||
System.setProperty("java.util.Arrays.useLegacyMergeSort", "true");
|
||||
logger.info("Starting MAGE client version " + version);
|
||||
logger.info("Logging level: " + logger.getEffectiveLevel());
|
||||
LOGGER.info("Starting MAGE client version " + VERSION);
|
||||
LOGGER.info("Logging level: " + LOGGER.getEffectiveLevel());
|
||||
|
||||
startTime = System.currentTimeMillis();
|
||||
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||
@Override
|
||||
public void uncaughtException(Thread t, Throwable e) {
|
||||
logger.fatal(null, e);
|
||||
LOGGER.fatal(null, e);
|
||||
}
|
||||
});
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (String arg : args) {
|
||||
if (arg.startsWith(liteModeArg)) {
|
||||
if (arg.startsWith(LITE_MODE_ARG)) {
|
||||
liteMode = true;
|
||||
}
|
||||
if (arg.startsWith(grayModeArg)) {
|
||||
if (arg.startsWith(GRAY_MODE_ARG)) {
|
||||
grayMode = true;
|
||||
}
|
||||
if (arg.startsWith(fullscreenArg)) {
|
||||
if (arg.startsWith(FILL_SCREEN_ARG)) {
|
||||
fullscreenMode = true;
|
||||
}
|
||||
}
|
||||
|
@ -1250,47 +1248,47 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
|
||||
public static MageUI getUI() {
|
||||
return ui;
|
||||
return UI;
|
||||
}
|
||||
|
||||
public static ChatPanelBasic getChat(UUID chatId) {
|
||||
return chats.get(chatId);
|
||||
return CHATS.get(chatId);
|
||||
}
|
||||
|
||||
public static void addChat(UUID chatId, ChatPanelBasic chatPanel) {
|
||||
chats.put(chatId, chatPanel);
|
||||
CHATS.put(chatId, chatPanel);
|
||||
}
|
||||
|
||||
public static void removeChat(UUID chatId) {
|
||||
chats.remove(chatId);
|
||||
CHATS.remove(chatId);
|
||||
}
|
||||
|
||||
public static void addGame(UUID gameId, GamePanel gamePanel) {
|
||||
games.put(gameId, gamePanel);
|
||||
GAMES.put(gameId, gamePanel);
|
||||
}
|
||||
|
||||
public static GamePanel getGame(UUID gameId) {
|
||||
return games.get(gameId);
|
||||
return GAMES.get(gameId);
|
||||
}
|
||||
|
||||
public static void removeGame(UUID gameId) {
|
||||
games.remove(gameId);
|
||||
GAMES.remove(gameId);
|
||||
}
|
||||
|
||||
public static DraftPanel getDraft(UUID draftId) {
|
||||
return drafts.get(draftId);
|
||||
return DRAFTS.get(draftId);
|
||||
}
|
||||
|
||||
public static void removeDraft(UUID draftId) {
|
||||
DraftPanel draftPanel = drafts.get(draftId);
|
||||
DraftPanel draftPanel = DRAFTS.get(draftId);
|
||||
if (draftPanel != null) {
|
||||
drafts.remove(draftId);
|
||||
DRAFTS.remove(draftId);
|
||||
draftPanel.hideDraft();
|
||||
}
|
||||
}
|
||||
|
||||
public static void addDraft(UUID draftId, DraftPanel draftPanel) {
|
||||
drafts.put(draftId, draftPanel);
|
||||
DRAFTS.put(draftId, draftPanel);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1312,13 +1310,13 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
@Override
|
||||
public void disconnected(final boolean errorCall) {
|
||||
if (SwingUtilities.isEventDispatchThread()) { // Returns true if the current thread is an AWT event dispatching thread.
|
||||
logger.info("DISCONNECTED (Event Dispatch Thread)");
|
||||
LOGGER.info("DISCONNECTED (Event Dispatch Thread)");
|
||||
setStatusText("Not connected");
|
||||
disableButtons();
|
||||
hideGames();
|
||||
hideTables();
|
||||
} else {
|
||||
logger.info("DISCONNECTED (NO Event Dispatch Thread)");
|
||||
LOGGER.info("DISCONNECTED (NO Event Dispatch Thread)");
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* TablesPanel.java
|
||||
*
|
||||
* Created on 15-Dec-2009, 10:54:01 PM
|
||||
|
@ -384,10 +384,8 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
updateMatchesTask = new UpdateMatchesTask(session, roomId, this);
|
||||
updateMatchesTask.execute();
|
||||
}
|
||||
} else {
|
||||
if (updateMatchesTask != null) {
|
||||
updateMatchesTask.cancel(true);
|
||||
}
|
||||
} else if (updateMatchesTask != null) {
|
||||
updateMatchesTask.cancel(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1138,6 +1136,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
options.setFreeMulligans(2);
|
||||
options.setSkillLevel(SkillLevel.CASUAL);
|
||||
options.setRollbackTurnsAllowed(true);
|
||||
options.setQuitRatio(100);
|
||||
table = session.createTable(roomId, options);
|
||||
|
||||
session.joinTable(roomId, table.getTableId(), "Human", "Human", 1, DeckImporterUtil.importDeck("test.dck"), "");
|
||||
|
@ -1499,12 +1498,10 @@ class MatchesTableModel extends AbstractTableModel {
|
|||
case 6:
|
||||
if (matches[arg0].isTournament()) {
|
||||
return "Show";
|
||||
} else if (matches[arg0].isReplayAvailable()) {
|
||||
return "Replay";
|
||||
} else {
|
||||
if (matches[arg0].isReplayAvailable()) {
|
||||
return "Replay";
|
||||
} else {
|
||||
return "None";
|
||||
}
|
||||
return "None";
|
||||
}
|
||||
case 7:
|
||||
return matches[arg0].getGames();
|
||||
|
|
|
@ -54,12 +54,12 @@ public class UserManager {
|
|||
|
||||
protected static ScheduledExecutorService expireExecutor = Executors.newSingleThreadScheduledExecutor();
|
||||
|
||||
private static final Logger logger = Logger.getLogger(UserManager.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(UserManager.class);
|
||||
|
||||
private final ConcurrentHashMap<UUID, User> users = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<String, User> usersByName = new ConcurrentHashMap<>();
|
||||
|
||||
private static final ExecutorService callExecutor = ThreadExecutor.getInstance().getCallExecutor();
|
||||
private static final ExecutorService CALL_EXECUTOR = ThreadExecutor.getInstance().getCallExecutor();
|
||||
|
||||
private static final UserManager INSTANCE = new UserManager();
|
||||
|
||||
|
@ -136,14 +136,14 @@ public class UserManager {
|
|||
if (userId != null) {
|
||||
final User user = users.get(userId);
|
||||
if (user != null) {
|
||||
callExecutor.execute(
|
||||
CALL_EXECUTOR.execute(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
logger.info("USER REMOVE - " + user.getName() + " (" + reason.toString() + ") userId: " + userId);
|
||||
LOGGER.info("USER REMOVE - " + user.getName() + " (" + reason.toString() + ") userId: " + userId);
|
||||
user.remove(reason);
|
||||
logger.debug("USER REMOVE END - " + user.getName());
|
||||
LOGGER.debug("USER REMOVE END - " + user.getName());
|
||||
} catch (Exception ex) {
|
||||
handleException(ex);
|
||||
} finally {
|
||||
|
@ -154,7 +154,7 @@ public class UserManager {
|
|||
}
|
||||
);
|
||||
} else {
|
||||
logger.warn("Trying to remove userId: " + userId + " - but it does not exist.");
|
||||
LOGGER.warn("Trying to remove userId: " + userId + " - but it does not exist.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -188,13 +188,13 @@ public class UserManager {
|
|||
|
||||
public void handleException(Exception ex) {
|
||||
if (ex != null) {
|
||||
logger.fatal("User manager exception " + (ex.getMessage() == null ? "null" : ex.getMessage()));
|
||||
LOGGER.fatal("User manager exception " + (ex.getMessage() == null ? "null" : ex.getMessage()));
|
||||
if (ex.getCause() != null) {
|
||||
logger.debug("- Cause: " + (ex.getCause().getMessage() == null ? "null" : ex.getCause().getMessage()));
|
||||
LOGGER.debug("- Cause: " + (ex.getCause().getMessage() == null ? "null" : ex.getCause().getMessage()));
|
||||
}
|
||||
ex.printStackTrace();
|
||||
} else {
|
||||
logger.fatal("User manager exception - null");
|
||||
LOGGER.fatal("User manager exception - null");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ public class UserManager {
|
|||
}
|
||||
|
||||
public void updateUserHistory() {
|
||||
callExecutor.execute(new Runnable() {
|
||||
CALL_EXECUTOR.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (String updatedUser : UserStatsRepository.instance.updateUserStats()) {
|
||||
|
|
|
@ -75,7 +75,7 @@ class LordOfExtinctionDynamicCount implements DynamicValue {
|
|||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
int count = 0;
|
||||
for (UUID playerId : game.getPlayer(sourceAbility.getControllerId()).getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(sourceAbility.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
count += player.getGraveyard().size();
|
||||
|
|
|
@ -95,7 +95,7 @@ class SoulquakeEffect extends OneShotEffect {
|
|||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||
permanent.moveToZone(Zone.HAND, source.getSourceId(), game, true);
|
||||
}
|
||||
for (UUID playerId : game.getPlayer(source.getControllerId()).getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (Card card : player.getGraveyard().getCards(filter2, game)) {
|
||||
|
|
|
@ -78,7 +78,7 @@ class DiminishingReturnsEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (Card card: player.getHand().getCards(game)) {
|
||||
|
@ -95,7 +95,7 @@ class DiminishingReturnsEffect extends OneShotEffect {
|
|||
controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true);
|
||||
}
|
||||
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int cardsToDrawCount = player.getAmount(0, 7, "How many cards to draw (up to 7)?", game);
|
||||
|
|
|
@ -132,7 +132,7 @@ class PutridWarriorGainLifeEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for(UUID playerId: game.getPlayer(source.getControllerId()).getInRange()) {
|
||||
for(UUID playerId: game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if(player != null) {
|
||||
player.gainLife(1, game);
|
||||
|
|
|
@ -98,7 +98,7 @@ class KillingWaveEffect extends OneShotEffect {
|
|||
HashMap<UUID, Integer> lifePaidAmounts = new HashMap<UUID, Integer>();
|
||||
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(filter, playerId, game);
|
||||
|
||||
|
@ -117,7 +117,7 @@ class KillingWaveEffect extends OneShotEffect {
|
|||
lifePaidAmounts.put(playerId, lifePaid);
|
||||
}
|
||||
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
int lifePaid = lifePaidAmounts.get(playerId);
|
||||
if (lifePaid > 0) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
|
|
|
@ -93,7 +93,7 @@ class OtherworldAtlasDrawEffect extends OneShotEffect {
|
|||
if (permanent != null) {
|
||||
int amount = permanent.getCounters().getCount(CounterType.CHARGE);
|
||||
if (amount > 0) {
|
||||
for (UUID playerId : sourcePlayer.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(sourcePlayer.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.drawCards(amount, game);
|
||||
|
|
|
@ -113,7 +113,7 @@ class RiteOfRuinEffect extends OneShotEffect {
|
|||
FilterControlledPermanent filter = new FilterControlledPermanent(cardType + " permanent you control");
|
||||
filter.add(new CardTypePredicate(cardType));
|
||||
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
int amount = Math.min(count, game.getBattlefield().countAll(filter, playerId, game));
|
||||
TargetControlledPermanent target = new TargetControlledPermanent(amount, amount, filter, false);
|
||||
Player player = game.getPlayer(playerId);
|
||||
|
|
|
@ -92,7 +92,7 @@ class HeartlessHidetsuguDamageEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int damage = player.getLife() / 2;
|
||||
|
|
|
@ -98,7 +98,7 @@ class KitsunePalliatorEffect extends OneShotEffect {
|
|||
effect.setTargetPointer(new FixedTarget(permanent.getId()));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
for (UUID playerId: game.getPlayer(source.getControllerId()).getInRange()) {
|
||||
for (UUID playerId: game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
effect.setTargetPointer(new FixedTarget(player.getId()));
|
||||
|
|
|
@ -99,7 +99,7 @@ class TwentyGraveyardCreatureCondition implements Condition {
|
|||
MageObject target = game.getObject(source.getSourceId());
|
||||
if (target != null) {
|
||||
HashSet<CardType> foundCardTypes = new HashSet<>();
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (Card card : player.getGraveyard().getCards(game)) {
|
||||
|
|
|
@ -120,7 +120,7 @@ class WhimsOfTheFateEffect extends OneShotEffect {
|
|||
continue;
|
||||
}
|
||||
// if player is in range of controller he chooses 3 piles with all its permanents
|
||||
if (currentPlayer != null && controller.getInRange().contains(currentPlayer.getId())) {
|
||||
if (currentPlayer != null && game.getState().getPlayersInRange(controller.getId(), game).contains(currentPlayer.getId())) {
|
||||
Map<Integer, Set<UUID>> playerPiles = new HashMap<>();
|
||||
for (int i = 1; i < 4; i++) {
|
||||
playerPiles.put(i, new LinkedHashSet<UUID>());
|
||||
|
|
|
@ -88,14 +88,14 @@ class ReverseTheSandsEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
Choice lifeChoice = new ChoiceImpl(true);
|
||||
Set<String> choices = new HashSet<String>();
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
choices.add(new StringBuilder(Integer.toString(player.getLife())).append(" life of ").append(player.getLogName()).toString());
|
||||
}
|
||||
}
|
||||
lifeChoice.setChoices(choices);
|
||||
for (UUID playersId : controller.getInRange()) {
|
||||
for (UUID playersId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playersId);
|
||||
if (player != null) {
|
||||
String selectedChoice;
|
||||
|
|
|
@ -90,7 +90,7 @@ class AllianceOfArmsEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
int xSum = 0;
|
||||
xSum += playerPaysXGenericMana(controller, source, game);
|
||||
for(UUID playerId : controller.getInRange()) {
|
||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (playerId != controller.getId()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
|
@ -100,7 +100,7 @@ class AllianceOfArmsEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
if (xSum > 0) {
|
||||
for(UUID playerId : controller.getInRange()) {
|
||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Effect effect = new CreateTokenTargetEffect(new SoldierToken(), xSum);
|
||||
effect.setTargetPointer(new FixedTarget(playerId));
|
||||
effect.apply(game, source);
|
||||
|
|
|
@ -90,7 +90,7 @@ class CollectiveVoyageEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
int xSum = 0;
|
||||
xSum += playerPaysXGenericMana(controller, source, game);
|
||||
for(UUID playerId : controller.getInRange()) {
|
||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (playerId != controller.getId()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
|
@ -99,7 +99,7 @@ class CollectiveVoyageEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
}
|
||||
for(UUID playerId : controller.getInRange()) {
|
||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(0, xSum, new FilterBasicLandCard());
|
||||
|
|
|
@ -87,7 +87,7 @@ class DeathByDragonsEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (!playerId.equals(this.getTargetPointer().getFirst(game, source))) {
|
||||
Token token = new DragonToken2();
|
||||
token.putOntoBattlefield(1, game, source.getSourceId(), playerId);
|
||||
|
|
|
@ -129,7 +129,7 @@ class ManaChargedDragonEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
int xSum = 0;
|
||||
xSum += playerPaysXGenericMana(controller, source, game);
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (playerId != controller.getId()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
|
|
|
@ -87,7 +87,7 @@ class MindsAglowEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
int xSum = 0;
|
||||
xSum += playerPaysXGenericMana(controller, source, game);
|
||||
for(UUID playerId : controller.getInRange()) {
|
||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (playerId != controller.getId()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
|
@ -97,7 +97,7 @@ class MindsAglowEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
if (xSum > 0) {
|
||||
for(UUID playerId : controller.getInRange()) {
|
||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.drawCards(xSum, game);
|
||||
|
|
|
@ -89,7 +89,7 @@ class SharedTraumaEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
int xSum = 0;
|
||||
xSum += playerPaysXGenericMana(controller, source, game);
|
||||
for(UUID playerId : controller.getInRange()) {
|
||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (playerId != controller.getId()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
|
@ -99,7 +99,7 @@ class SharedTraumaEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
if (xSum > 0) {
|
||||
for(UUID playerId : controller.getInRange()) {
|
||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Effect effect = new PutTopCardOfLibraryIntoGraveTargetEffect(xSum);
|
||||
effect.setTargetPointer(new FixedTarget(playerId));
|
||||
effect.apply(game, source);
|
||||
|
|
|
@ -97,7 +97,7 @@ class VeteranExplorerEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
List<Player> usingPlayers = new ArrayList<>();
|
||||
this.chooseAndSearchLibrary(usingPlayers, controller, source, game);
|
||||
for (UUID playerId: controller.getInRange()) {
|
||||
for (UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (!playerId.equals(controller.getId())) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
|
|
|
@ -106,7 +106,7 @@ class BroodingSaurianControlEffect extends ContinuousEffectImpl {
|
|||
// add all creatures in range
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
FilterPermanent playerFilter = filter.copy();
|
||||
playerFilter.add(new OwnerIdPredicate(playerId));
|
||||
for (Permanent permanent :game.getBattlefield().getActivePermanents(playerFilter, playerId, game)) {
|
||||
|
|
|
@ -101,7 +101,7 @@ class FromTheAshesEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Map<UUID, Integer> playerAmount = new HashMap<>();
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int amount = 0;
|
||||
|
|
|
@ -103,7 +103,7 @@ class HomewardPathControlEffect extends ContinuousEffectImpl {
|
|||
// add all creatures in range
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
FilterPermanent playerFilter = filter.copy();
|
||||
playerFilter.add(new OwnerIdPredicate(playerId));
|
||||
for (Permanent permanent :game.getBattlefield().getActivePermanents(playerFilter, playerId, game)) {
|
||||
|
|
|
@ -96,7 +96,7 @@ class HoodedHorrorCantBeBlockedEffect extends RestrictionEffect {
|
|||
if (controller != null) {
|
||||
int maxCreatures = 0;
|
||||
UUID playerIdWithMax = null;
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
int creatures = game.getBattlefield().countAll(filter, playerId, game);
|
||||
if (creatures > maxCreatures || (creatures == maxCreatures && playerId.equals(blocker.getControllerId())) ) {
|
||||
maxCreatures = creatures;
|
||||
|
|
|
@ -112,7 +112,7 @@ class JelevaNephaliasScourgeEffect extends OneShotEffect {
|
|||
if (watcher != null) {
|
||||
int xValue = watcher.getManaSpentToCastLastTime(sourceCard.getZoneChangeCounter(game) - 1);
|
||||
if (xValue > 0) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int cardsToExile = Math.min(player.getLibrary().size(), xValue);
|
||||
|
|
|
@ -186,7 +186,7 @@ class MysticBarrierReplacementEffect extends ReplacementEffectImpl {
|
|||
if (game.getPlayers().size() > 2) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.getInRange().contains(event.getPlayerId())) {
|
||||
if (game.getState().getPlayersInRange(controller.getId(), game).contains(event.getPlayerId())) {
|
||||
String allowedDirection = (String) game.getState().getValue(new StringBuilder("attack_direction_").append(source.getSourceId()).toString());
|
||||
if (allowedDirection != null) {
|
||||
Player defender = game.getPlayer(event.getTargetId());
|
||||
|
|
|
@ -105,7 +105,7 @@ class NayaSoulbeastCastEffect extends OneShotEffect {
|
|||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (controller != null && sourceObject != null) {
|
||||
int cmc = 0;
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
if (player.getLibrary().size() > 0) {
|
||||
|
|
|
@ -120,7 +120,7 @@ class OrderOfSuccessionEffect extends OneShotEffect {
|
|||
continue;
|
||||
}
|
||||
// if player is in range he chooses a creature to control
|
||||
if (currentPlayer != null && controller.getInRange().contains(currentPlayer.getId())) {
|
||||
if (currentPlayer != null && game.getState().getPlayersInRange(controller.getId(), game).contains(currentPlayer.getId())) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent(new StringBuilder("creature controlled by ").append(nextPlayer.getLogName()).toString());
|
||||
filter.add(new ControllerIdPredicate(nextPlayer.getId()));
|
||||
Target target = new TargetCreaturePermanent(filter);
|
||||
|
|
|
@ -120,7 +120,7 @@ class ShattergangBrothersEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for(UUID playerId : controller.getInRange()) {
|
||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (playerId != source.getControllerId()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
|
|
|
@ -93,7 +93,7 @@ class SurveyorsScopeEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
int numberOfLands = 0;
|
||||
int ownLands = game.getBattlefield().countAll(new FilterLandPermanent(), controller.getId(), game);
|
||||
for (UUID playerId: controller.getInRange()) {
|
||||
for (UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (!playerId.equals(controller.getId())) {
|
||||
if (game.getBattlefield().countAll(new FilterLandPermanent(), playerId, game) > ownLands + 1) {
|
||||
numberOfLands++;
|
||||
|
|
|
@ -94,7 +94,7 @@ class BrineElementalEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId: controller.getInRange()) {
|
||||
for (UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (controller.hasOpponent(playerId, game)) {
|
||||
game.getState().getTurnMods().add(new TurnMod(playerId, PhaseStep.UNTAP));
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class GraveSifterEffect extends OneShotEffect {
|
|||
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
typeChoice.clearChoice();
|
||||
|
|
|
@ -86,7 +86,7 @@ class InciteRebellionEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId: controller.getInRange()) {
|
||||
for (UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int count = game.getBattlefield().countAll(filter, playerId, game);
|
||||
|
|
|
@ -102,7 +102,7 @@ class StitcherGeralfEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
for (UUID playerId: controller.getInRange()) {
|
||||
for (UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
cards.addAll(player.getLibrary().getTopCards(game, 3));
|
||||
|
|
|
@ -111,7 +111,7 @@ class WaveOfVitriolEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Map<Player, Integer> sacrificedLands = new HashMap<>();
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int count = 0;
|
||||
|
|
|
@ -88,7 +88,7 @@ class WolfcallersHowlEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
int count = 0;
|
||||
for(UUID playerId :controller.getInRange()) {
|
||||
for(UUID playerId :game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (controller.hasOpponent(playerId, game)) {
|
||||
Player opponent = game.getPlayer(playerId);
|
||||
if (opponent != null) {
|
||||
|
|
|
@ -139,7 +139,7 @@ class BloodTyrantEffect extends OneShotEffect {
|
|||
int counters = 0;
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
if (player.loseLife(1, game) > 0) {
|
||||
|
|
|
@ -82,7 +82,7 @@ class StrongholdDisciplineEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
final int count = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), playerId, game).size();
|
||||
if (count > 0) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
|
|
|
@ -88,7 +88,7 @@ class ChillOfForebodingEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player sourcePlayer = game.getPlayer(source.getControllerId());
|
||||
for (UUID playerId : sourcePlayer.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(sourcePlayer.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.moveCards(player.getLibrary().getTopCards(game, 5), Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
|
|
|
@ -139,7 +139,7 @@ class EverythingIsColorlessEffect extends ContinuousEffectImpl {
|
|||
for (CommandObject commandObject : game.getState().getCommand()) {
|
||||
commandObject.getColor(game).setColor(colorless);
|
||||
}
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
// hand
|
||||
|
@ -186,7 +186,7 @@ class ManaCanBeSpentAsAnyColorEffect extends AsThoughEffectImpl implements AsTho
|
|||
@Override
|
||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
return controller != null && controller.getInRange().contains(affectedControllerId);
|
||||
return controller != null && game.getState().getPlayersInRange(controller.getId(), game).contains(affectedControllerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -85,7 +85,7 @@ class PulseOfTheFieldsReturnToHandEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null && player.getLife() > controller.getLife()) {
|
||||
Card card = game.getCard(source.getSourceId());
|
||||
|
|
|
@ -85,7 +85,7 @@ class PulseOfTheGridReturnToHandEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null && player.getHand().size() > controller.getHand().size()) {
|
||||
Card card = game.getCard(source.getSourceId());
|
||||
|
|
|
@ -131,10 +131,10 @@ class BloodBaronOfVizkopaEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
|
||||
protected boolean conditionState(Ability source, Game game) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null && player.getLife() >= 30) {
|
||||
for (UUID opponentId : player.getInRange()) {
|
||||
if (player.hasOpponent(opponentId, game)) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null && controller.getLife() >= 30) {
|
||||
for (UUID opponentId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (controller.hasOpponent(opponentId, game)) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null && opponent.getLife() < 11) {
|
||||
return true;
|
||||
|
|
|
@ -109,7 +109,7 @@ class ReleaseSacrificeEffect extends OneShotEffect {
|
|||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
|
||||
Target target1 = new TargetControlledPermanent(1, 1, new FilterControlledArtifactPermanent(), true);
|
||||
|
|
|
@ -91,7 +91,7 @@ class SireOfInsanityEffect extends OneShotEffect {
|
|||
if (sourcePlayer == null) {
|
||||
return false;
|
||||
}
|
||||
for (UUID playerId : sourcePlayer.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(sourcePlayer.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (Card c : player.getHand().getCards(game)) {
|
||||
|
|
|
@ -143,7 +143,7 @@ class ShamanOfForgottenWaysEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
FilterPermanent filter = new FilterCreaturePermanent();
|
||||
for(UUID playerId : controller.getInRange()) {
|
||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null){
|
||||
int numberCreatures = game.getBattlefield().getAllActivePermanents(filter, playerId, game).size();
|
||||
|
|
|
@ -97,7 +97,7 @@ class BatwingBrumeEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
final int amount = game.getBattlefield().getAllActivePermanents(new FilterAttackingCreature(), playerId, game).size();
|
||||
if (amount > 0) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
|
|
|
@ -91,7 +91,7 @@ class PriceOfProgressEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
int amount = game.getBattlefield().countAll(filter , playerId, game);
|
||||
if (amount > 0) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
|
|
|
@ -65,6 +65,6 @@ class SkipUpkeepStepEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
return controller != null && controller.getInRange().contains(event.getPlayerId());
|
||||
return controller != null && game.getState().getPlayersInRange(controller.getId(), game).contains(event.getPlayerId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ class PoxEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
// Each player loses a third of his or her life,
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int lifeToLose = (int) Math.ceil(player.getLife() / 3.0);
|
||||
|
@ -98,7 +98,7 @@ class PoxEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
// then discards a third of the cards in his or her hand,
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int cardsToDiscard = (int) Math.ceil(player.getHand().size() / 3.0);
|
||||
|
@ -108,7 +108,7 @@ class PoxEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
// then sacrifices a third of the creatures he or she controls,
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
|
||||
|
@ -126,7 +126,7 @@ class PoxEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
// then sacrifices a third of the lands he or she controls.
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
FilterControlledLandPermanent filter = new FilterControlledLandPermanent();
|
||||
|
|
|
@ -94,6 +94,6 @@ class SkipUntapStepEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
return event.getType() == GameEvent.EventType.UNTAP_STEP
|
||||
&& controller != null
|
||||
&& controller.getInRange().contains(event.getPlayerId());
|
||||
&& game.getState().getPlayersInRange(controller.getId(), game).contains(event.getPlayerId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ class HomingSliverEffect extends ContinuousEffectImpl {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId: controller.getInRange()) {
|
||||
for (UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (Card card : player.getHand().getCards(filter, game)) {
|
||||
|
|
|
@ -97,7 +97,7 @@ class TarmogoyfEffect extends ContinuousEffectImpl {
|
|||
MageObject target = game.getObject(source.getSourceId());
|
||||
if (target != null) {
|
||||
HashSet<CardType> foundCardTypes = new HashSet<>();
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (Card card : player.getGraveyard().getCards(game)) {
|
||||
|
|
|
@ -94,7 +94,7 @@ public class YixlidJailer extends CardImpl {
|
|||
if (layer == Layer.AbilityAddingRemovingEffects_6) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (Card card : player.getGraveyard().getCards(game)) {
|
||||
|
|
|
@ -84,7 +84,7 @@ class WhisperingMadnessEffect extends OneShotEffect {
|
|||
if (sourcePlayer == null) {
|
||||
return false;
|
||||
}
|
||||
for (UUID playerId : sourcePlayer.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(sourcePlayer.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int discarded = 0;
|
||||
|
@ -98,7 +98,7 @@ class WhisperingMadnessEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
}
|
||||
for (UUID playerId : sourcePlayer.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(sourcePlayer.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.drawCards(maxDiscarded, game);
|
||||
|
|
|
@ -96,7 +96,7 @@ class LhurgoyfEffect extends ContinuousEffectImpl {
|
|||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (mageObject != null) {
|
||||
int number = 0;
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
number += player.getGraveyard().count(new FilterCreatureCard(), game);
|
||||
|
|
|
@ -103,7 +103,7 @@ class YawgmothsAgendaCanPlayCardsFromGraveyardEffect extends ContinuousEffectImp
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId: controller.getInRange()) {
|
||||
for (UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null)
|
||||
{
|
||||
|
|
|
@ -90,7 +90,7 @@ class WidespreadPanicEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId: controller.getInRange()) {
|
||||
for (UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
if (player.getHand().size() > 0) {
|
||||
|
|
|
@ -97,14 +97,14 @@ class DakraMysticEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for(UUID playerId: controller.getInRange()) {
|
||||
for(UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null && player.getLibrary().size() > 0) {
|
||||
player.revealCards(player.getLogName(), new CardsImpl(player.getLibrary().getFromTop(game)), game);
|
||||
}
|
||||
}
|
||||
if (controller.chooseUse(outcome, "Put revealed cards into graveyard?", source, game)) {
|
||||
for(UUID playerId: controller.getInRange()) {
|
||||
for(UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null && player.getLibrary().size() > 0) {
|
||||
player.moveCards(player.getLibrary().getFromTop(game), Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
|
|
|
@ -95,7 +95,7 @@ class CracklingDoomEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
ArrayList<Permanent> toSacrifice = new ArrayList<>();
|
||||
for (UUID playerId: controller.getInRange()) {
|
||||
for (UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (controller.hasOpponent(playerId, game)) {
|
||||
Player opponent = game.getPlayer(playerId);
|
||||
if (opponent != null) {
|
||||
|
|
|
@ -123,7 +123,7 @@ class GoblinAssassinTriggeredEffect extends OneShotEffect {
|
|||
List<UUID> perms = new ArrayList<>();
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null && !player.flipCoin(game)) {
|
||||
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent();
|
||||
|
|
|
@ -57,7 +57,6 @@ public class Balance extends CardImpl {
|
|||
super(ownerId, 188, "Balance", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{1}{W}");
|
||||
this.expansionSetCode = "LEB";
|
||||
|
||||
|
||||
// Each player chooses a number of lands he or she controls equal to the number of lands controlled by the player who controls the fewest, then sacrifices the rest. Players discard cards and sacrifice creatures the same way.
|
||||
this.getSpellAbility().addEffect(new BalanceEffect());
|
||||
}
|
||||
|
@ -95,7 +94,7 @@ class BalanceEffect extends OneShotEffect {
|
|||
//Lands
|
||||
int minLand = Integer.MAX_VALUE;
|
||||
Cards landsToSacrifice = new CardsImpl();
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int count = game.getBattlefield().countAll(new FilterControlledLandPermanent(), player.getId(), game);
|
||||
|
@ -105,7 +104,7 @@ class BalanceEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
TargetControlledPermanent target = new TargetControlledPermanent(minLand, minLand, new FilterControlledLandPermanent("lands to keep"), true);
|
||||
|
@ -129,7 +128,7 @@ class BalanceEffect extends OneShotEffect {
|
|||
//Creatures
|
||||
int minCreature = Integer.MAX_VALUE;
|
||||
Cards creaturesToSacrifice = new CardsImpl();
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int count = game.getBattlefield().countAll(new FilterControlledCreaturePermanent(), player.getId(), game);
|
||||
|
@ -139,7 +138,7 @@ class BalanceEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
TargetControlledPermanent target = new TargetControlledPermanent(minCreature, minCreature, new FilterControlledCreaturePermanent("creatures to keep"), true);
|
||||
|
@ -163,7 +162,7 @@ class BalanceEffect extends OneShotEffect {
|
|||
//Cards in hand
|
||||
int minCard = Integer.MAX_VALUE;
|
||||
HashMap<UUID, Cards> cardsToDiscard = new HashMap<>(2);
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int count = player.getHand().size();
|
||||
|
@ -173,7 +172,7 @@ class BalanceEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
|
@ -189,7 +188,7 @@ class BalanceEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null && cardsToDiscard.get(playerId) != null) {
|
||||
for (UUID cardId : cardsToDiscard.get(playerId)) {
|
||||
|
|
|
@ -97,7 +97,7 @@ class LilianaVessEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
Set<Card> creatureCards = new LinkedHashSet<>();
|
||||
|
|
|
@ -78,7 +78,7 @@ class VisionsOfBeyondEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player sourcePlayer = game.getPlayer(source.getControllerId());
|
||||
int count = 1;
|
||||
for (UUID playerId: sourcePlayer.getInRange()) {
|
||||
for (UUID playerId: game.getState().getPlayersInRange(sourcePlayer.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
if (player.getGraveyard().size() >= 20) {
|
||||
|
|
|
@ -82,7 +82,7 @@ class RiseOfTheDarkRealmsEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
|
||||
Set<Card> creatureCards = new LinkedHashSet<>();
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (Card card : player.getGraveyard().getCards(game)) {
|
||||
|
|
|
@ -110,7 +110,7 @@ class JaceTheLivingGuildpactEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (Card card : player.getHand().getCards(game)) {
|
||||
|
|
|
@ -173,7 +173,7 @@ class MagisterOfWorthReturnFromGraveyardEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && sourceObject != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.moveCards(player.getGraveyard().getCards(new FilterCreatureCard(), game), Zone.BATTLEFIELD, source, game);
|
||||
|
|
|
@ -96,7 +96,7 @@ class WaitingInTheWeedsEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Token token = new CatToken();
|
||||
int amount = game.getBattlefield().getAllActivePermanents(filter, playerId, game).size();
|
||||
token.putOntoBattlefield(amount, game, source.getSourceId(), playerId);
|
||||
|
|
|
@ -87,7 +87,7 @@ class TemporalCascadeShuffleEffect extends OneShotEffect {
|
|||
@java.lang.Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player sourcePlayer = game.getPlayer(source.getControllerId());
|
||||
for (UUID playerId: sourcePlayer.getInRange()) {
|
||||
for (UUID playerId: game.getState().getPlayersInRange(sourcePlayer.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (Card card: player.getHand().getCards(game)) {
|
||||
|
@ -124,7 +124,7 @@ class TemporalCascadeDrawEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player sourcePlayer = game.getPlayer(source.getControllerId());
|
||||
game.getState().handleSimultaneousEvent(game); // needed here so state based triggered effects
|
||||
for (UUID playerId: sourcePlayer.getInRange()) {
|
||||
for (UUID playerId: game.getState().getPlayersInRange(sourcePlayer.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.drawCards(7, game);
|
||||
|
|
|
@ -97,7 +97,7 @@ class KnowledgePoolEffect1 extends OneShotEffect {
|
|||
if (controller == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.moveCardsToExile(player.getLibrary().getTopCards(game, 3), source, game, true,
|
||||
|
|
|
@ -159,7 +159,7 @@ class MoltenDisasterEffect extends OneShotEffect {
|
|||
for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
|
||||
permanent.damage(amount, source.getSourceId(), game, false, true);
|
||||
}
|
||||
for (UUID playerId: game.getPlayer(source.getControllerId()).getInRange()) {
|
||||
for (UUID playerId: game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.damage(amount, source.getSourceId(), game, false, true);
|
||||
|
|
|
@ -130,7 +130,7 @@ class GravePactEffect extends OneShotEffect {
|
|||
List<UUID> perms = new ArrayList<>();
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null && !playerId.equals(source.getControllerId())) {
|
||||
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent();
|
||||
|
|
|
@ -92,7 +92,7 @@ class HuntedWumpusEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for(UUID playerId: controller.getInRange()) {
|
||||
for(UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (!playerId.equals(controller.getId())) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
|
|
|
@ -72,7 +72,7 @@ public class AEtherBurst extends CardImpl {
|
|||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
int amount = 0;
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
amount += player.getGraveyard().getCards(filter, game).size();
|
||||
|
|
|
@ -93,7 +93,7 @@ class BalancingActEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
int minPermanent = Integer.MAX_VALUE, minCard = Integer.MAX_VALUE;
|
||||
// count minimal permanets
|
||||
for(UUID playerId : controller.getInRange()){
|
||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)){
|
||||
Player player = game.getPlayer(playerId);
|
||||
if(player != null){
|
||||
int count = game.getBattlefield().getActivePermanents(new FilterControlledPermanent(), player.getId(), source.getSourceId(), game).size();
|
||||
|
@ -103,7 +103,7 @@ class BalancingActEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
// sacrifice permanents over the minimum
|
||||
for(UUID playerId : controller.getInRange()){
|
||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)){
|
||||
Player player = game.getPlayer(playerId);
|
||||
if(player != null){
|
||||
TargetControlledPermanent target = new TargetControlledPermanent(minPermanent, minPermanent, new FilterControlledPermanent(), true);
|
||||
|
@ -118,7 +118,7 @@ class BalancingActEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
// count minimal cards in hand
|
||||
for(UUID playerId : controller.getInRange()){
|
||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)){
|
||||
Player player = game.getPlayer(playerId);
|
||||
if(player != null){
|
||||
int count = player.getHand().size();
|
||||
|
@ -129,7 +129,7 @@ class BalancingActEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
// discard cards over the minimum
|
||||
for(UUID playerId : controller.getInRange()){
|
||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)){
|
||||
Player player = game.getPlayer(playerId);
|
||||
if(player != null){
|
||||
TargetCardInHand target = new TargetCardInHand(minCard, new FilterCard());
|
||||
|
|
|
@ -85,7 +85,7 @@ class WordsOfWisdomEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for(UUID playerId: controller.getInRange()) {
|
||||
for(UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (!playerId.equals(controller.getId())) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
|
|
|
@ -85,7 +85,7 @@ class SoullessOneDynamicCount implements DynamicValue {
|
|||
zombiesInGraveyard.add(new SubtypePredicate("Zombie"));
|
||||
|
||||
int count = game.getBattlefield().count(zombiesBattlefield, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game);
|
||||
for (UUID playerId : game.getPlayer(sourceAbility.getControllerId()).getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(sourceAbility.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
count += player.getGraveyard().count(zombiesInGraveyard, game);
|
||||
|
|
|
@ -94,7 +94,7 @@ class WeirdHarvestEffect extends OneShotEffect {
|
|||
if (xValue > 0) {
|
||||
List<Player> usingPlayers = new ArrayList<>();
|
||||
this.chooseAndSearchLibrary(usingPlayers, controller, xValue, source, sourceObject, game);
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (!playerId.equals(controller.getId())) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
|
|
|
@ -137,7 +137,7 @@ class NonBasicLandsInOpponentsGraveyards implements DynamicValue {
|
|||
int amount = 0;
|
||||
Player controller = game.getPlayer(sourceAbility.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerUUID : controller.getInRange()) {
|
||||
for (UUID playerUUID : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (controller.hasOpponent(playerUUID, game)) {
|
||||
Player player = game.getPlayer(playerUUID);
|
||||
if (player != null) {
|
||||
|
|
|
@ -129,7 +129,7 @@ class RoilingHorrorDynamicValue implements DynamicValue {
|
|||
int opponentsMostLife = Integer.MIN_VALUE;
|
||||
Player controller = game.getPlayer(sourceAbility.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerUUID : controller.getInRange()) {
|
||||
for (UUID playerUUID : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (controller.hasOpponent(playerUUID, game)) {
|
||||
Player opponent = game.getPlayer(playerUUID);
|
||||
if (opponent != null && opponent.getLife() > opponentsMostLife) {
|
||||
|
|
|
@ -95,7 +95,7 @@ class ShivanWumpusEffect extends PutOnLibrarySourceEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
boolean costPaid = false;
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Cost cost = new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledLandPermanent()));
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null
|
||||
|
|
|
@ -77,7 +77,7 @@ class MnemonicNexusEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player sourcePlayer = game.getPlayer(source.getControllerId());
|
||||
for (UUID playerId: sourcePlayer.getInRange()) {
|
||||
for (UUID playerId: game.getState().getPlayersInRange(sourcePlayer.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (Card card: player.getGraveyard().getCards(game)) {
|
||||
|
|
|
@ -138,7 +138,7 @@ class SavraSacrificeEffect extends OneShotEffect {
|
|||
List<UUID> perms = new ArrayList<>();
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null && !playerId.equals(source.getControllerId())) {
|
||||
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent();
|
||||
|
|
|
@ -297,7 +297,7 @@ class JaceArchitectOfThoughtEffect3 extends OneShotEffect {
|
|||
if (controller == null || sourcePermanent == null) {
|
||||
return false;
|
||||
}
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
String playerName = new StringBuilder(player.getLogName()).append("'s").toString();
|
||||
if (source.getControllerId().equals(player.getId())) {
|
||||
|
|
|
@ -79,7 +79,7 @@ public class SkullRend extends CardImpl {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId: controller.getInRange()) {
|
||||
for (UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (playerId != source.getControllerId()) {
|
||||
Player opponent = game.getPlayer(playerId);
|
||||
if (opponent != null) {
|
||||
|
|
|
@ -109,7 +109,7 @@ class SokenzanRenegadeEffect extends OneShotEffect {
|
|||
if (controller != null && sourcePermanent != null) {
|
||||
int max = Integer.MIN_VALUE;
|
||||
Player newController = null;
|
||||
for(UUID playerId : controller.getInRange()) {
|
||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
if (player.getLife() > max) {
|
||||
|
@ -146,7 +146,7 @@ class OnePlayerHasTheMostCards implements Condition {
|
|||
if (controller != null) {
|
||||
int max = Integer.MIN_VALUE;
|
||||
boolean onlyOnePlayer = false;
|
||||
for(UUID playerId : controller.getInRange()) {
|
||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
if (player.getLife() > max) {
|
||||
|
|
|
@ -96,7 +96,7 @@ class ThoughtsOfRuinEffect extends OneShotEffect {
|
|||
if (amount > 0) {
|
||||
List<Permanent> permanentsToSacrifice = new ArrayList<Permanent>();
|
||||
// select all lands to sacrifice
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int lands = game.getState().getBattlefield().countAll(filter, playerId, game);
|
||||
|
|
|
@ -86,7 +86,7 @@ class NaturesResurgenceEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player sourcePlayer = game.getPlayer(source.getControllerId());
|
||||
if (sourcePlayer != null) {
|
||||
for (UUID playerId : sourcePlayer.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(sourcePlayer.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int amount = player.getGraveyard().count(filter, game);
|
||||
|
|
|
@ -102,7 +102,7 @@ class AdviceFromTheFaeEffect extends OneShotEffect {
|
|||
}
|
||||
controller.lookAtCards(mageObject.getIdName(), cardsFromLibrary, game);
|
||||
int max = 0;
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
filter.add(new ControllerIdPredicate(playerId));
|
||||
if (playerId != controller.getId()) {
|
||||
|
|
|
@ -119,7 +119,7 @@ class PaintersServantEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
}
|
||||
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
// Hand
|
||||
|
|
|
@ -103,7 +103,7 @@ class PlagueOfVerminEffect extends OneShotEffect {
|
|||
if (firstInactivePlayer == null) {
|
||||
firstInactivePlayer = currentPlayer.getId();
|
||||
}
|
||||
if (currentPlayer != null && currentPlayer.canRespond() && controller.getInRange().contains(currentPlayer.getId())) {
|
||||
if (currentPlayer != null && currentPlayer.canRespond() && game.getState().getPlayersInRange(controller.getId(), game).contains(currentPlayer.getId())) {
|
||||
currentLifePaid = 0;
|
||||
totalPaidLife = 0;
|
||||
if (currentPlayer.chooseUse(Outcome.AIDontUseIt, "Pay life?", source, game)) {
|
||||
|
|
|
@ -95,7 +95,7 @@ class SphinxSovereignEffect extends OneShotEffect {
|
|||
if (!permanent.isTapped()) {
|
||||
controller.gainLife(3, game);
|
||||
} else {
|
||||
for (UUID opponentId : controller.getInRange()) {
|
||||
for (UUID opponentId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (controller.hasOpponent(opponentId, game)) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
|
|
|
@ -101,7 +101,7 @@ class DreamHallsEffect extends ContinuousEffectImpl {
|
|||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.getAlternativeSourceCosts().add(alternativeCastingCostAbility);
|
||||
|
|
|
@ -123,7 +123,7 @@ class AlurenRuleEffect extends ContinuousEffectImpl {
|
|||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId: controller.getInRange()){
|
||||
for (UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)){
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.getAlternativeSourceCosts().add(alternativeCastingCostAbility);
|
||||
|
|
|
@ -90,7 +90,7 @@ class UpwellingRuleEffect extends ContinuousEffectImpl {
|
|||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId: controller.getInRange()) {
|
||||
for (UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null){
|
||||
ManaPool pool = player.getManaPool();
|
||||
|
|
|
@ -111,7 +111,7 @@ class PyxisOfPandemoniumExileEffect extends OneShotEffect {
|
|||
game.getState().setValue(valueKey, exileIds);
|
||||
}
|
||||
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
|
|
|
@ -111,7 +111,7 @@ class HypergenesisEffect extends OneShotEffect {
|
|||
Target target = new TargetCardInHand(filter);
|
||||
|
||||
while (controller.canRespond()) {
|
||||
if (currentPlayer != null && currentPlayer.canRespond() && controller.getInRange().contains(currentPlayer.getId())) {
|
||||
if (currentPlayer != null && currentPlayer.canRespond() && game.getState().getPlayersInRange(controller.getId(), game).contains(currentPlayer.getId())) {
|
||||
if (firstInactivePlayer == null) {
|
||||
firstInactivePlayer = currentPlayer.getId();
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ class RestoreBalanceEffect extends OneShotEffect {
|
|||
//Lands
|
||||
int minLand = Integer.MAX_VALUE;
|
||||
Cards landsToSacrifice = new CardsImpl();
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int count = game.getBattlefield().countAll(new FilterControlledLandPermanent(), player.getId(), game);
|
||||
|
@ -112,7 +112,7 @@ class RestoreBalanceEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
TargetControlledPermanent target = new TargetControlledPermanent(minLand, minLand, new FilterControlledLandPermanent(), true);
|
||||
|
@ -136,7 +136,7 @@ class RestoreBalanceEffect extends OneShotEffect {
|
|||
//Creatures
|
||||
int minCreature = Integer.MAX_VALUE;
|
||||
Cards creaturesToSacrifice = new CardsImpl();
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int count = game.getBattlefield().countAll(new FilterControlledCreaturePermanent(), player.getId(), game);
|
||||
|
@ -146,7 +146,7 @@ class RestoreBalanceEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
TargetControlledPermanent target = new TargetControlledPermanent(minCreature, minCreature, new FilterControlledCreaturePermanent(), true);
|
||||
|
@ -170,7 +170,7 @@ class RestoreBalanceEffect extends OneShotEffect {
|
|||
//Cards in hand
|
||||
int minCard = Integer.MAX_VALUE;
|
||||
HashMap<UUID, Cards> cardsToDiscard = new HashMap<>(2);
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int count = player.getHand().size();
|
||||
|
@ -180,7 +180,7 @@ class RestoreBalanceEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
|
@ -196,7 +196,7 @@ class RestoreBalanceEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null && cardsToDiscard.get(playerId) != null) {
|
||||
for (UUID cardId : cardsToDiscard.get(playerId)) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue