mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Merge origin/master
This commit is contained in:
commit
cda11b280c
14 changed files with 384 additions and 105 deletions
|
@ -34,20 +34,31 @@
|
||||||
|
|
||||||
package mage.client.cards;
|
package mage.client.cards;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.UUID;
|
||||||
|
import javax.swing.border.Border;
|
||||||
|
import javax.swing.border.EmptyBorder;
|
||||||
import mage.cards.MageCard;
|
import mage.cards.MageCard;
|
||||||
import mage.client.plugins.impl.Plugins;
|
import mage.client.plugins.impl.Plugins;
|
||||||
import mage.client.util.CardsViewUtil;
|
import mage.client.util.CardsViewUtil;
|
||||||
import mage.client.util.Config;
|
import mage.client.util.Config;
|
||||||
import mage.view.*;
|
import mage.view.CardView;
|
||||||
|
import mage.view.CardsView;
|
||||||
|
import mage.view.PermanentView;
|
||||||
|
import mage.view.SimpleCardsView;
|
||||||
|
import mage.view.StackAbilityView;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.mage.card.arcane.CardPanel;
|
import org.mage.card.arcane.CardPanel;
|
||||||
|
|
||||||
import javax.swing.border.Border;
|
|
||||||
import javax.swing.border.EmptyBorder;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
@ -58,7 +69,7 @@ public class Cards extends javax.swing.JPanel {
|
||||||
|
|
||||||
private final Map<UUID, MageCard> cards = new LinkedHashMap<>();
|
private final Map<UUID, MageCard> cards = new LinkedHashMap<>();
|
||||||
private boolean dontDisplayTapped = false;
|
private boolean dontDisplayTapped = false;
|
||||||
private static final int GAP_X = 5;
|
private static final int GAP_X = 0;
|
||||||
private String zone;
|
private String zone;
|
||||||
|
|
||||||
private static final Border emptyBorder = new EmptyBorder(0,0,0,0);
|
private static final Border emptyBorder = new EmptyBorder(0,0,0,0);
|
||||||
|
|
|
@ -20,7 +20,7 @@ import java.util.UUID;
|
||||||
public class DialogManager extends JComponent implements MouseListener,
|
public class DialogManager extends JComponent implements MouseListener,
|
||||||
MouseMotionListener {
|
MouseMotionListener {
|
||||||
|
|
||||||
private final static Map<UUID, DialogManager> dialogManagers = new HashMap<UUID, DialogManager>();
|
private final static Map<UUID, DialogManager> dialogManagers = new HashMap<>();
|
||||||
|
|
||||||
public static DialogManager getManager(UUID gameId) {
|
public static DialogManager getManager(UUID gameId) {
|
||||||
if (!dialogManagers.containsKey(gameId)) {
|
if (!dialogManagers.containsKey(gameId)) {
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<Layout>
|
<Layout>
|
||||||
<DimensionLayout dim="0">
|
<DimensionLayout dim="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="cards" alignment="1" pref="418" max="32767" attributes="0"/>
|
<Component id="cards" alignment="1" pref="239" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
|
|
|
@ -34,16 +34,19 @@
|
||||||
|
|
||||||
package mage.client.dialog;
|
package mage.client.dialog;
|
||||||
|
|
||||||
|
import static com.sun.java.accessibility.util.AWTEventMonitor.addWindowListener;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
import java.awt.event.WindowAdapter;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
import java.beans.PropertyVetoException;
|
import java.beans.PropertyVetoException;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
|
|
||||||
import mage.client.cards.BigCard;
|
import mage.client.cards.BigCard;
|
||||||
import mage.client.util.Config;
|
import mage.client.util.Config;
|
||||||
|
import mage.client.util.ImageHelper;
|
||||||
import mage.client.util.SettingsManager;
|
import mage.client.util.SettingsManager;
|
||||||
import mage.client.util.gui.GuiDisplayUtil;
|
import mage.client.util.gui.GuiDisplayUtil;
|
||||||
import mage.view.CardsView;
|
import mage.view.CardsView;
|
||||||
|
@ -57,17 +60,19 @@ import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
||||||
*/
|
*/
|
||||||
public class CardInfoWindowDialog extends MageDialog {
|
public class CardInfoWindowDialog extends MageDialog {
|
||||||
|
|
||||||
public static enum ShowType { REVEAL, LOOKED_AT, EXILE, OTHER };
|
public static enum ShowType { REVEAL, LOOKED_AT, EXILE, GRAVEYARD, OTHER };
|
||||||
|
|
||||||
private ShowType showType;
|
private ShowType showType;
|
||||||
private boolean positioned;
|
private boolean positioned;
|
||||||
|
private String name;
|
||||||
|
|
||||||
public CardInfoWindowDialog(ShowType showType, String name) {
|
public CardInfoWindowDialog(ShowType showType, String name) {
|
||||||
|
this.name = name;
|
||||||
this.title = name;
|
this.title = name;
|
||||||
this.showType = showType;
|
this.showType = showType;
|
||||||
this.positioned = false;
|
this.positioned = false;
|
||||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
||||||
this.setModal(false);
|
this.setModal(false);
|
||||||
switch(this.showType) {
|
switch(this.showType) {
|
||||||
case LOOKED_AT:
|
case LOOKED_AT:
|
||||||
|
@ -78,6 +83,18 @@ public class CardInfoWindowDialog extends MageDialog {
|
||||||
this.setFrameIcon(new ImageIcon(ImageManagerImpl.getInstance().getRevealedImage()));
|
this.setFrameIcon(new ImageIcon(ImageManagerImpl.getInstance().getRevealedImage()));
|
||||||
this.setClosable(true);
|
this.setClosable(true);
|
||||||
break;
|
break;
|
||||||
|
case GRAVEYARD:
|
||||||
|
this.setFrameIcon(new ImageIcon(ImageHelper.getImageFromResources("/info/grave.png")));
|
||||||
|
this.setIconifiable(false);
|
||||||
|
this.setClosable(true);
|
||||||
|
this.setDefaultCloseOperation(HIDE_ON_CLOSE);
|
||||||
|
addWindowListener(new WindowAdapter() {
|
||||||
|
@Override
|
||||||
|
public void windowClosing(WindowEvent e) {
|
||||||
|
CardInfoWindowDialog.this.hideDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
case EXILE:
|
case EXILE:
|
||||||
this.setFrameIcon(new ImageIcon(ImageManagerImpl.getInstance().getExileImage()));
|
this.setFrameIcon(new ImageIcon(ImageManagerImpl.getInstance().getExileImage()));
|
||||||
break;
|
break;
|
||||||
|
@ -92,70 +109,36 @@ public class CardInfoWindowDialog extends MageDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadCards(SimpleCardsView showCards, BigCard bigCard, UUID gameId) {
|
public void loadCards(SimpleCardsView showCards, BigCard bigCard, UUID gameId) {
|
||||||
|
cards.loadCards(showCards, bigCard, gameId);
|
||||||
boolean changed = cards.loadCards(showCards, bigCard, gameId);
|
showAndPositionWindow();
|
||||||
if (showCards.size() > 0) {
|
|
||||||
show();
|
|
||||||
if (changed) {
|
|
||||||
try {
|
|
||||||
if (!positioned) {
|
|
||||||
this.setIcon(false);
|
|
||||||
firstWindowPosition();
|
|
||||||
}
|
|
||||||
} catch (PropertyVetoException ex) {
|
|
||||||
Logger.getLogger(CardInfoWindowDialog.class.getName()).log(Level.SEVERE, null, ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.hideDialog();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadCards(CardsView showCards, BigCard bigCard, UUID gameId) {
|
public void loadCards(CardsView showCards, BigCard bigCard, UUID gameId) {
|
||||||
boolean changed = cards.loadCards(showCards, bigCard, gameId, null);
|
cards.loadCards(showCards, bigCard, gameId, null);
|
||||||
|
if (showType.equals(ShowType.GRAVEYARD)) {
|
||||||
if (showCards.size() > 0) {
|
setTitle(name + "'s Graveyard (" + showCards.size() + ")");
|
||||||
show();
|
this.setTitelBarToolTip(name);
|
||||||
if (changed) {
|
|
||||||
try {
|
|
||||||
if (!positioned) {
|
|
||||||
this.setIcon(false);
|
|
||||||
firstWindowPosition();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (PropertyVetoException ex) {
|
|
||||||
Logger.getLogger(CardInfoWindowDialog.class.getName()).log(Level.SEVERE, null, ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.hideDialog();
|
|
||||||
}
|
}
|
||||||
|
showAndPositionWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void firstWindowPosition() {
|
private void showAndPositionWindow() {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!positioned) {
|
int width = CardInfoWindowDialog.this.getWidth();
|
||||||
int width = CardInfoWindowDialog.this.getWidth();
|
int height = CardInfoWindowDialog.this.getHeight();
|
||||||
int height = CardInfoWindowDialog.this.getHeight();
|
if (width > 0 && height > 0) {
|
||||||
if (width > 0 && height > 0) {
|
Point centered = SettingsManager.getInstance().getComponentPosition(width, height);
|
||||||
|
if (!positioned) {
|
||||||
positioned = true;
|
positioned = true;
|
||||||
Point centered = SettingsManager.getInstance().getComponentPosition(width, height);
|
|
||||||
int xPos = centered.x / 2;
|
int xPos = centered.x / 2;
|
||||||
int yPos = centered.y / 2;
|
int yPos = centered.y / 2;
|
||||||
CardInfoWindowDialog.this.setLocation(xPos, yPos);
|
CardInfoWindowDialog.this.setLocation(xPos, yPos);
|
||||||
GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, CardInfoWindowDialog.this);
|
show();
|
||||||
CardInfoWindowDialog.this.show();
|
|
||||||
}
|
}
|
||||||
|
GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, CardInfoWindowDialog.this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ShowCardsDialog.this.setVisible(true);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -197,7 +180,7 @@ public class CardInfoWindowDialog extends MageDialog {
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(cards, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 418, Short.MAX_VALUE)
|
.addComponent(cards, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
|
|
@ -148,6 +148,8 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
private final Map<UUID, CardInfoWindowDialog> exiles = new HashMap<>();
|
private final Map<UUID, CardInfoWindowDialog> exiles = new HashMap<>();
|
||||||
private final Map<String, CardInfoWindowDialog> revealed = new HashMap<>();
|
private final Map<String, CardInfoWindowDialog> revealed = new HashMap<>();
|
||||||
private final Map<String, CardInfoWindowDialog> lookedAt = new HashMap<>();
|
private final Map<String, CardInfoWindowDialog> lookedAt = new HashMap<>();
|
||||||
|
private final Map<String, CardInfoWindowDialog> graveyardWindows = new HashMap<>();
|
||||||
|
private final Map<String, CardsView> graveyards = new HashMap<>();
|
||||||
private final ArrayList<ShowCardsDialog> pickTarget = new ArrayList<>();
|
private final ArrayList<ShowCardsDialog> pickTarget = new ArrayList<>();
|
||||||
private UUID gameId;
|
private UUID gameId;
|
||||||
private UUID playerId; // playerId of the player
|
private UUID playerId; // playerId of the player
|
||||||
|
@ -261,6 +263,10 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
exileDialog.cleanUp();
|
exileDialog.cleanUp();
|
||||||
exileDialog.removeDialog();
|
exileDialog.removeDialog();
|
||||||
}
|
}
|
||||||
|
for (CardInfoWindowDialog graveyardDialog: graveyardWindows.values()) {
|
||||||
|
graveyardDialog.cleanUp();
|
||||||
|
graveyardDialog.removeDialog();
|
||||||
|
}
|
||||||
for (CardInfoWindowDialog revealDialog: revealed.values()) {
|
for (CardInfoWindowDialog revealDialog: revealed.values()) {
|
||||||
revealDialog.cleanUp();
|
revealDialog.cleanUp();
|
||||||
revealDialog.removeDialog();
|
revealDialog.removeDialog();
|
||||||
|
@ -650,6 +656,17 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
if (player.getPlayerId().equals(playerId)) {
|
if (player.getPlayerId().equals(playerId)) {
|
||||||
updateSkipButtons(player.isPassedTurn(), player.isPassedUntilEndOfTurn(), player.isPassedUntilNextMain(), player.isPassedAllTurns(), player.isPassedUntilStackResolved());
|
updateSkipButtons(player.isPassedTurn(), player.isPassedUntilEndOfTurn(), player.isPassedUntilNextMain(), player.isPassedAllTurns(), player.isPassedUntilStackResolved());
|
||||||
}
|
}
|
||||||
|
// update open or remove closed graveyard windows
|
||||||
|
|
||||||
|
graveyards.put(player.getName(), player.getGraveyard());
|
||||||
|
if (graveyardWindows.containsKey(player.getName())) {
|
||||||
|
CardInfoWindowDialog cardInfoWindowDialog = graveyardWindows.get(player.getName());
|
||||||
|
if (cardInfoWindowDialog.isClosed()) {
|
||||||
|
graveyardWindows.remove(player.getName());
|
||||||
|
} else {
|
||||||
|
cardInfoWindowDialog.loadCards(player.getGraveyard(), bigCard, gameId);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Couldn't find player.");
|
logger.warn("Couldn't find player.");
|
||||||
logger.warn(" uuid:" + player.getPlayerId());
|
logger.warn(" uuid:" + player.getPlayerId());
|
||||||
|
@ -691,6 +708,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
exiles.get(exile.getId()).loadCards(exile, bigCard, gameId);
|
exiles.get(exile.getId()).loadCards(exile, bigCard, gameId);
|
||||||
}
|
}
|
||||||
|
|
||||||
showRevealed(game);
|
showRevealed(game);
|
||||||
showLookedAt(game);
|
showLookedAt(game);
|
||||||
if (game.getCombat().size() > 0) {
|
if (game.getCombat().size() > 0) {
|
||||||
|
@ -808,6 +826,24 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void openGraveyardWindow(String playerName) {
|
||||||
|
if(graveyardWindows.containsKey(playerName)) {
|
||||||
|
CardInfoWindowDialog cardInfoWindowDialog = graveyardWindows.get(playerName);
|
||||||
|
if (cardInfoWindowDialog.isVisible()) {
|
||||||
|
cardInfoWindowDialog.hideDialog();
|
||||||
|
} else {
|
||||||
|
cardInfoWindowDialog.show();
|
||||||
|
}
|
||||||
|
// if (!cardInfoWindowDialog.isClosed()) {
|
||||||
|
return;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
CardInfoWindowDialog newGraveyard = new CardInfoWindowDialog(ShowType.GRAVEYARD, playerName);
|
||||||
|
graveyardWindows.put(playerName, newGraveyard);
|
||||||
|
MageFrame.getDesktop().add(newGraveyard, JLayeredPane.MODAL_LAYER);
|
||||||
|
newGraveyard.loadCards(graveyards.get(playerName), bigCard, gameId);
|
||||||
|
}
|
||||||
|
|
||||||
private void showRevealed(GameView game) {
|
private void showRevealed(GameView game) {
|
||||||
for (RevealedView revealView: game.getRevealed()) {
|
for (RevealedView revealView: game.getRevealed()) {
|
||||||
handleGameInfoWindow(revealed, ShowType.REVEAL, revealView.getName(), revealView.getCards());
|
handleGameInfoWindow(revealed, ShowType.REVEAL, revealView.getName(), revealView.getCards());
|
||||||
|
|
|
@ -226,7 +226,7 @@ public class HelperPanel extends JPanel {
|
||||||
if (message.length() < this.getWidth() / 10) {
|
if (message.length() < this.getWidth() / 10) {
|
||||||
message = getSmallText(message);
|
message = getSmallText(message);
|
||||||
} else {
|
} else {
|
||||||
message = "Use ability?" + getSmallText(message.substring(this.getWidth() / 10));
|
message = "Use ability?" + getSmallText(message.substring(0, this.getWidth() / 10));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
textArea.setText(message);
|
textArea.setText(message);
|
||||||
|
|
|
@ -34,6 +34,28 @@
|
||||||
|
|
||||||
package mage.client.game;
|
package mage.client.game;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Font;
|
||||||
|
import java.awt.Image;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
import javax.swing.BorderFactory;
|
||||||
|
import javax.swing.GroupLayout;
|
||||||
|
import javax.swing.GroupLayout.Alignment;
|
||||||
|
import javax.swing.ImageIcon;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.LayoutStyle.ComponentPlacement;
|
||||||
|
import javax.swing.SwingConstants;
|
||||||
|
import javax.swing.border.Border;
|
||||||
|
import javax.swing.border.LineBorder;
|
||||||
import mage.MageException;
|
import mage.MageException;
|
||||||
import mage.cards.MageCard;
|
import mage.cards.MageCard;
|
||||||
import mage.cards.action.ActionCallback;
|
import mage.cards.action.ActionCallback;
|
||||||
|
@ -60,20 +82,6 @@ import mage.view.ManaPoolView;
|
||||||
import mage.view.PlayerView;
|
import mage.view.PlayerView;
|
||||||
import org.mage.card.arcane.ManaSymbols;
|
import org.mage.card.arcane.ManaSymbols;
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import javax.swing.GroupLayout.Alignment;
|
|
||||||
import javax.swing.LayoutStyle.ComponentPlacement;
|
|
||||||
import javax.swing.border.Border;
|
|
||||||
import javax.swing.border.LineBorder;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enhanced player pane.
|
* Enhanced player pane.
|
||||||
*
|
*
|
||||||
|
@ -787,11 +795,12 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnGraveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGraveActionPerformed
|
private void btnGraveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGraveActionPerformed
|
||||||
|
MageFrame.getGame(gameId).openGraveyardWindow(player.getName());
|
||||||
/*if (graveyard == null) {
|
/*if (graveyard == null) {
|
||||||
graveyard = new ShowCardsDialog();
|
graveyard = new ShowCardsDialog();
|
||||||
}*/
|
}*/
|
||||||
//graveyard.loadCards(player.getName() + " graveyard", player.getGraveyard(), bigCard, Config.dimensions, gameId, false);
|
//graveyard.loadCards(player.getName() + " graveyard", player.getGraveyard(), bigCard, Config.dimensions, gameId, false);
|
||||||
DialogManager.getManager(gameId).showGraveyardDialog(player.getGraveyard(), bigCard, gameId);
|
// DialogManager.getManager(gameId).showGraveyardDialog(player.getGraveyard(), bigCard, gameId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnCommandZoneActionPerformed(java.awt.event.ActionEvent evt) {
|
private void btnCommandZoneActionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
|
68
Mage.Sets/src/mage/sets/apocalypse/UrborgElf.java
Normal file
68
Mage.Sets/src/mage/sets/apocalypse/UrborgElf.java
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
|
*/
|
||||||
|
package mage.sets.apocalypse;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.mana.BlackManaAbility;
|
||||||
|
import mage.abilities.mana.BlueManaAbility;
|
||||||
|
import mage.abilities.mana.GreenManaAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author EvilGeek
|
||||||
|
*/
|
||||||
|
public class UrborgElf extends CardImpl {
|
||||||
|
|
||||||
|
public UrborgElf(UUID ownerId) {
|
||||||
|
super(ownerId, 90, "Urborg Elf", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{G}");
|
||||||
|
this.expansionSetCode = "APC";
|
||||||
|
this.subtype.add("Elf");
|
||||||
|
this.subtype.add("Druid");
|
||||||
|
this.power = new MageInt(1);
|
||||||
|
this.toughness = new MageInt(1);
|
||||||
|
|
||||||
|
// {tap}: Add {G}, {U}, or {B} to your mana pool.
|
||||||
|
this.addAbility(new GreenManaAbility());
|
||||||
|
this.addAbility(new BlueManaAbility());
|
||||||
|
this.addAbility(new BlackManaAbility());
|
||||||
|
}
|
||||||
|
|
||||||
|
public UrborgElf(final UrborgElf card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UrborgElf copy() {
|
||||||
|
return new UrborgElf(this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -28,22 +28,17 @@
|
||||||
package mage.sets.judgment;
|
package mage.sets.judgment;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
|
||||||
import mage.abilities.costs.common.DiscardTargetCost;
|
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.filter.FilterCard;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
import mage.game.stack.StackObject;
|
import mage.game.stack.StackObject;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetPlayer;
|
import mage.target.TargetPlayer;
|
||||||
import mage.target.common.TargetCardInHand;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -55,7 +50,6 @@ public class Browbeat extends CardImpl {
|
||||||
super(ownerId, 82, "Browbeat", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{R}");
|
super(ownerId, 82, "Browbeat", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{R}");
|
||||||
this.expansionSetCode = "JUD";
|
this.expansionSetCode = "JUD";
|
||||||
|
|
||||||
|
|
||||||
// Any player may have Browbeat deal 5 damage to him or her. If no one does, target player draws three cards.
|
// Any player may have Browbeat deal 5 damage to him or her. If no one does, target player draws three cards.
|
||||||
this.getSpellAbility().addEffect(new BrowbeatDrawEffect());
|
this.getSpellAbility().addEffect(new BrowbeatDrawEffect());
|
||||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||||
|
@ -75,6 +69,7 @@ class BrowbeatDrawEffect extends OneShotEffect {
|
||||||
|
|
||||||
public BrowbeatDrawEffect() {
|
public BrowbeatDrawEffect() {
|
||||||
super(Outcome.DrawCard);
|
super(Outcome.DrawCard);
|
||||||
|
staticText = "Any player may have {source} deal 5 damage to him or her. If no one does, target player draws three cards.";
|
||||||
}
|
}
|
||||||
|
|
||||||
public BrowbeatDrawEffect(final BrowbeatDrawEffect effect) {
|
public BrowbeatDrawEffect(final BrowbeatDrawEffect effect) {
|
||||||
|
@ -88,6 +83,10 @@ class BrowbeatDrawEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (controller == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
StackObject spell = null;
|
StackObject spell = null;
|
||||||
for(StackObject object : game.getStack()){
|
for(StackObject object : game.getStack()){
|
||||||
if(object instanceof Spell && object.getSourceId().equals(source.getSourceId())){
|
if(object instanceof Spell && object.getSourceId().equals(source.getSourceId())){
|
||||||
|
@ -96,12 +95,12 @@ class BrowbeatDrawEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
if(spell != null){
|
if(spell != null){
|
||||||
boolean drawCards = true;
|
boolean drawCards = true;
|
||||||
for(UUID uuid : game.getPlayerList()){
|
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)){
|
||||||
Player player = game.getPlayer(uuid);
|
Player player = game.getPlayer(playerId);
|
||||||
if(player != null && player.chooseUse(Outcome.Detriment, "Have " + spell.getName() + " deal 5 damage to you?", game)){
|
if (player != null && player.chooseUse(Outcome.Detriment, "Have " + spell.getLogName() + " deal 5 damage to you?", game)){
|
||||||
drawCards = false;
|
drawCards = false;
|
||||||
player.damage(5, source.getSourceId(), game, false, true);
|
player.damage(5, source.getSourceId(), game, false, true);
|
||||||
game.informPlayers(player.getLogName() + " has " + spell.getName() + " deal 5 to him or her");
|
game.informPlayers(player.getLogName() + " has " + spell.getLogName() + " deal 5 to him or her");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (drawCards) {
|
if (drawCards) {
|
||||||
|
@ -116,11 +115,4 @@ class BrowbeatDrawEffect extends OneShotEffect {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getText(Mode mode) {
|
|
||||||
if (staticText != null && !staticText.isEmpty()) {
|
|
||||||
return staticText;
|
|
||||||
}
|
|
||||||
return "Any player may have {source} deal 5 damage to him or her. If no one does, target player draws three cards.";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
85
Mage.Sets/src/mage/sets/magicorigins/DwynenGiltLeafDaen.java
Normal file
85
Mage.Sets/src/mage/sets/magicorigins/DwynenGiltLeafDaen.java
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
|
*/
|
||||||
|
package mage.sets.magicorigins;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.common.AttacksTriggeredAbility;
|
||||||
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||||
|
import mage.abilities.effects.common.GainLifeEffect;
|
||||||
|
import mage.abilities.effects.common.continuous.BoostControlledEffect;
|
||||||
|
import mage.abilities.keyword.ReachAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
import mage.filter.predicate.permanent.AttackingPredicate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author emerald000
|
||||||
|
*/
|
||||||
|
public class DwynenGiltLeafDaen extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Elf", "attacking Elf you control");
|
||||||
|
static {
|
||||||
|
filter.add(new AttackingPredicate());
|
||||||
|
}
|
||||||
|
|
||||||
|
public DwynenGiltLeafDaen(UUID ownerId) {
|
||||||
|
super(ownerId, 172, "Dwynen, Gilt-Leaf Daen", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{G}{G}");
|
||||||
|
this.expansionSetCode = "ORI";
|
||||||
|
this.supertype.add("Legendary");
|
||||||
|
this.subtype.add("Elf");
|
||||||
|
this.subtype.add("Warrior");
|
||||||
|
this.power = new MageInt(3);
|
||||||
|
this.toughness = new MageInt(4);
|
||||||
|
|
||||||
|
// Reach
|
||||||
|
this.addAbility(ReachAbility.getInstance());
|
||||||
|
|
||||||
|
// Other Elf creatures you control get +1/+1.
|
||||||
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, new FilterCreaturePermanent("Elf", "Elf creatures"), true)));
|
||||||
|
|
||||||
|
// Whenever Dwynen, Gilt-Leaf Daen attacks, you gain 1 life for each attacking Elf you control.
|
||||||
|
this.addAbility(new AttacksTriggeredAbility(new GainLifeEffect(new PermanentsOnBattlefieldCount(filter)), false));
|
||||||
|
}
|
||||||
|
|
||||||
|
public DwynenGiltLeafDaen(final DwynenGiltLeafDaen card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DwynenGiltLeafDaen copy() {
|
||||||
|
return new DwynenGiltLeafDaen(this);
|
||||||
|
}
|
||||||
|
}
|
68
Mage.Sets/src/mage/sets/magicorigins/ElementalBond.java
Normal file
68
Mage.Sets/src/mage/sets/magicorigins/ElementalBond.java
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
|
*/
|
||||||
|
package mage.sets.magicorigins;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
|
||||||
|
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.filter.Filter.ComparisonType;
|
||||||
|
import mage.filter.FilterPermanent;
|
||||||
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
|
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author emerald000
|
||||||
|
*/
|
||||||
|
public class ElementalBond extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterPermanent filter = new FilterControlledCreaturePermanent("creature with power 3 or greater");
|
||||||
|
static {
|
||||||
|
filter.add(new PowerPredicate(ComparisonType.GreaterThan, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ElementalBond(UUID ownerId) {
|
||||||
|
super(ownerId, 174, "Elemental Bond", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
|
||||||
|
this.expansionSetCode = "ORI";
|
||||||
|
|
||||||
|
// Whenever a creature with power 3 or greater enters the battlefield under your control, draw a card.
|
||||||
|
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(new DrawCardSourceControllerEffect(1), filter));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ElementalBond(final ElementalBond card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ElementalBond copy() {
|
||||||
|
return new ElementalBond(this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,6 +33,7 @@ import mage.cards.Card;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.game.stack.Spell;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,9 +59,12 @@ public class ReturnToLibrarySpellEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
Card spellCard = game.getStack().getSpell(source.getSourceId()).getCard();
|
Spell spell = game.getStack().getSpell(source.getSourceId());
|
||||||
if (spellCard != null) {
|
if (spell != null) {
|
||||||
controller.moveCardToLibraryWithInfo(spellCard, source.getSourceId(), game, Zone.STACK, toTop, true);
|
Card spellCard = game.getStack().getSpell(source.getSourceId()).getCard();
|
||||||
|
if (spellCard != null) {
|
||||||
|
controller.moveCardToLibraryWithInfo(spellCard, source.getSourceId(), game, Zone.STACK, toTop, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,9 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo
|
||||||
return kickerCost;
|
return kickerCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetKicker() {
|
public void resetKicker(Game game, Ability source) {
|
||||||
|
String key = getActivationKey(source, "", game);
|
||||||
|
activations.remove(key);
|
||||||
for (OptionalAdditionalCost cost: kickerCosts) {
|
for (OptionalAdditionalCost cost: kickerCosts) {
|
||||||
cost.reset();
|
cost.reset();
|
||||||
}
|
}
|
||||||
|
@ -196,13 +198,13 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo
|
||||||
if (ability instanceof SpellAbility) {
|
if (ability instanceof SpellAbility) {
|
||||||
Player player = game.getPlayer(controllerId);
|
Player player = game.getPlayer(controllerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
this.resetKicker();
|
this.resetKicker(game, ability);
|
||||||
for (OptionalAdditionalCost kickerCost: kickerCosts) {
|
for (OptionalAdditionalCost kickerCost: kickerCosts) {
|
||||||
boolean again = true;
|
boolean again = true;
|
||||||
while (player.isInGame() && again) {
|
while (player.isInGame() && again) {
|
||||||
String times = "";
|
String times = "";
|
||||||
if (kickerCost.isRepeatable()) {
|
if (kickerCost.isRepeatable()) {
|
||||||
int activatedCount = kickerCost.getActivateCount();
|
int activatedCount = getKickedCounter(game, ability);
|
||||||
times = Integer.toString(activatedCount + 1) + (activatedCount == 0 ? " time ":" times ");
|
times = Integer.toString(activatedCount + 1) + (activatedCount == 0 ? " time ":" times ");
|
||||||
}
|
}
|
||||||
if (kickerCost.canPay(ability, sourceId, controllerId, game) &&
|
if (kickerCost.canPay(ability, sourceId, controllerId, game) &&
|
||||||
|
|
|
@ -585,6 +585,27 @@ public class GameState implements Serializable, Copyable<GameState> {
|
||||||
newPlayerList.setCurrent(playerId);
|
newPlayerList.setCurrent(playerId);
|
||||||
return newPlayerList;
|
return newPlayerList;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns a list of all active players of the game in range of playerId,
|
||||||
|
* also setting the playerId to the current player of the list.
|
||||||
|
*
|
||||||
|
* @param playerId
|
||||||
|
* @param game
|
||||||
|
* @return playerList
|
||||||
|
*/
|
||||||
|
public PlayerList getPlayersInRange(UUID playerId, Game game) {
|
||||||
|
PlayerList newPlayerList = new PlayerList();
|
||||||
|
Player currentPlayer = game.getPlayer(playerId);
|
||||||
|
if (currentPlayer != null) {
|
||||||
|
for (Player player: players.values()) {
|
||||||
|
if (!player.hasLeft()&& !player.hasLost() && currentPlayer.getInRange().contains(player.getId())) {
|
||||||
|
newPlayerList.add(player.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newPlayerList.setCurrent(playerId);
|
||||||
|
}
|
||||||
|
return newPlayerList;
|
||||||
|
}
|
||||||
|
|
||||||
public Permanent getPermanent(UUID permanentId) {
|
public Permanent getPermanent(UUID permanentId) {
|
||||||
if (permanentId != null && battlefield.containsPermanent(permanentId)) {
|
if (permanentId != null && battlefield.containsPermanent(permanentId)) {
|
||||||
|
|
Loading…
Reference in a new issue