forked from External/mage
added SimpleCardView - will reduce the amount of data passed between client and server
This commit is contained in:
parent
91124ad813
commit
aecdbe0778
20 changed files with 273 additions and 74 deletions
|
|
@ -41,7 +41,6 @@ import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import mage.cards.CardDimensions;
|
|
||||||
import mage.cards.MageCard;
|
import mage.cards.MageCard;
|
||||||
import mage.client.plugins.impl.Plugins;
|
import mage.client.plugins.impl.Plugins;
|
||||||
import mage.client.util.Config;
|
import mage.client.util.Config;
|
||||||
|
|
@ -50,9 +49,11 @@ import mage.view.CardsView;
|
||||||
import mage.view.PermanentView;
|
import mage.view.PermanentView;
|
||||||
import mage.view.StackAbilityView;
|
import mage.view.StackAbilityView;
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import javax.swing.border.Border;
|
import javax.swing.border.Border;
|
||||||
import javax.swing.border.EmptyBorder;
|
import mage.client.util.CardsViewUtil;
|
||||||
|
import mage.sets.Sets;
|
||||||
|
import mage.view.SimpleCardView;
|
||||||
|
import mage.view.SimpleCardsView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -113,6 +114,10 @@ public class Cards extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean loadCards(SimpleCardsView cardsView, BigCard bigCard, UUID gameId) {
|
||||||
|
return loadCards(CardsViewUtil.convertSimple(cardsView), bigCard, gameId);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean loadCards(CardsView cardsView, BigCard bigCard, UUID gameId) {
|
public boolean loadCards(CardsView cardsView, BigCard bigCard, UUID gameId) {
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,8 @@ import java.awt.*;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.client.util.CardsViewUtil;
|
||||||
|
import mage.view.SimpleCardsView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
|
@ -67,7 +69,11 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
|
||||||
this.setModal(false);
|
this.setModal(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadCards(String name, CardsView showCards, BigCard bigCard, CardDimensions dimension, UUID gameId, boolean modal) {
|
public void loadCards(String name, SimpleCardsView showCards, BigCard bigCard, CardDimensions dimension, UUID gameId, boolean modal) {
|
||||||
|
loadCards(name, CardsViewUtil.convertSimple(showCards), bigCard, dimension, gameId, modal);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadCards(String name, CardsView showCards, BigCard bigCard, CardDimensions dimension, UUID gameId, boolean modal) {
|
||||||
this.reloaded = true;
|
this.reloaded = true;
|
||||||
this.title = name;
|
this.title = name;
|
||||||
cardArea.removeAll();
|
cardArea.removeAll();
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ import javax.swing.Timer;
|
||||||
import mage.client.MageFrame;
|
import mage.client.MageFrame;
|
||||||
import mage.client.constants.Constants.SortBy;
|
import mage.client.constants.Constants.SortBy;
|
||||||
import mage.client.plugins.impl.Plugins;
|
import mage.client.plugins.impl.Plugins;
|
||||||
|
import mage.client.util.CardsViewUtil;
|
||||||
import mage.remote.Session;
|
import mage.remote.Session;
|
||||||
import mage.client.util.Event;
|
import mage.client.util.Event;
|
||||||
import mage.client.util.Listener;
|
import mage.client.util.Listener;
|
||||||
|
|
@ -101,8 +102,8 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadBooster(DraftPickView draftPickView) {
|
public void loadBooster(DraftPickView draftPickView) {
|
||||||
draftBooster.loadBooster(draftPickView.getBooster(), bigCard);
|
draftBooster.loadBooster(CardsViewUtil.convertSimple(draftPickView.getBooster()), bigCard);
|
||||||
draftPicks.loadCards(draftPickView.getPicks(), bigCard, null);
|
draftPicks.loadCards(CardsViewUtil.convertSimple(draftPickView.getPicks()), bigCard, null);
|
||||||
this.draftBooster.clearCardEventListeners();
|
this.draftBooster.clearCardEventListeners();
|
||||||
this.draftBooster.addCardEventListener(
|
this.draftBooster.addCardEventListener(
|
||||||
new Listener<Event> () {
|
new Listener<Event> () {
|
||||||
|
|
@ -113,7 +114,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
//draftBooster.loadBooster(view.getBooster(), bigCard);
|
//draftBooster.loadBooster(view.getBooster(), bigCard);
|
||||||
draftBooster.loadBooster(emptyView, bigCard);
|
draftBooster.loadBooster(emptyView, bigCard);
|
||||||
draftPicks.loadCards(view.getPicks(), bigCard, null);
|
draftPicks.loadCards(CardsViewUtil.convertSimple(view.getPicks()), bigCard, null);
|
||||||
Plugins.getInstance().getActionCallback().hidePopup();
|
Plugins.getInstance().getActionCallback().hidePopup();
|
||||||
setMessage("Waiting for other players");
|
setMessage("Waiting for other players");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -307,7 +307,7 @@ public class GamePanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
// Get opponents hand cards if available
|
// Get opponents hand cards if available
|
||||||
if (game.getOpponentHands() != null) {
|
if (game.getOpponentHands() != null) {
|
||||||
for (Map.Entry<String, CardsView> hand: game.getOpponentHands().entrySet()) {
|
for (Map.Entry<String, SimpleCardsView> hand: game.getOpponentHands().entrySet()) {
|
||||||
handCards.put(hand.getKey(), hand.getValue());
|
handCards.put(hand.getKey(), hand.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -577,7 +577,7 @@ public class GamePanel extends javax.swing.JPanel {
|
||||||
jTabbedPane1 = new JTabbedPane();
|
jTabbedPane1 = new JTabbedPane();
|
||||||
|
|
||||||
hand.setCardDimension(getHandCardDimension());
|
hand.setCardDimension(getHandCardDimension());
|
||||||
handCards = new HashMap<String, CardsView>();
|
handCards = new HashMap<String, SimpleCardsView>();
|
||||||
|
|
||||||
jSplitPane1.setBorder(null);
|
jSplitPane1.setBorder(null);
|
||||||
jSplitPane1.setDividerSize(7);
|
jSplitPane1.setDividerSize(7);
|
||||||
|
|
@ -882,7 +882,7 @@ public class GamePanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
if (chosenHandKey != null && chosenHandKey.length() > 0) {
|
if (chosenHandKey != null && chosenHandKey.length() > 0) {
|
||||||
this.chosenHandKey = chosenHandKey;
|
this.chosenHandKey = chosenHandKey;
|
||||||
CardsView cards = handCards.get(chosenHandKey);
|
SimpleCardsView cards = handCards.get(chosenHandKey);
|
||||||
this.hand.loadCards(cards, bigCard, gameId);
|
this.hand.loadCards(cards, bigCard, gameId);
|
||||||
hand.setPreferredSize(new java.awt.Dimension((getHandCardDimension().width + 5) * cards.size() + 5, getHandCardDimension().height + 20)); // for scroll
|
hand.setPreferredSize(new java.awt.Dimension((getHandCardDimension().width + 5) * cards.size() + 5, getHandCardDimension().height + 20)); // for scroll
|
||||||
}
|
}
|
||||||
|
|
@ -983,8 +983,6 @@ public class GamePanel extends javax.swing.JPanel {
|
||||||
private mage.client.chat.ChatPanel gameChatPanel;
|
private mage.client.chat.ChatPanel gameChatPanel;
|
||||||
private mage.client.game.FeedbackPanel feedbackPanel;
|
private mage.client.game.FeedbackPanel feedbackPanel;
|
||||||
private mage.client.chat.ChatPanel userChatPanel;
|
private mage.client.chat.ChatPanel userChatPanel;
|
||||||
private mage.client.cards.Cards hand;
|
|
||||||
private Map<String, CardsView> handCards;
|
|
||||||
private javax.swing.JPanel jPanel3;
|
private javax.swing.JPanel jPanel3;
|
||||||
private javax.swing.JSplitPane jSplitPane1;
|
private javax.swing.JSplitPane jSplitPane1;
|
||||||
private javax.swing.JLabel lblActivePlayer;
|
private javax.swing.JLabel lblActivePlayer;
|
||||||
|
|
@ -995,7 +993,6 @@ public class GamePanel extends javax.swing.JPanel {
|
||||||
private javax.swing.JPanel pnlBattlefield;
|
private javax.swing.JPanel pnlBattlefield;
|
||||||
private javax.swing.JPanel pnlGameInfo;
|
private javax.swing.JPanel pnlGameInfo;
|
||||||
private javax.swing.JPanel pnlReplay;
|
private javax.swing.JPanel pnlReplay;
|
||||||
private mage.client.cards.Cards stack;
|
|
||||||
private javax.swing.JLabel txtActivePlayer;
|
private javax.swing.JLabel txtActivePlayer;
|
||||||
private javax.swing.JLabel txtPhase;
|
private javax.swing.JLabel txtPhase;
|
||||||
private javax.swing.JLabel txtPriority;
|
private javax.swing.JLabel txtPriority;
|
||||||
|
|
@ -1003,6 +1000,10 @@ public class GamePanel extends javax.swing.JPanel {
|
||||||
private javax.swing.JLabel txtTurn;
|
private javax.swing.JLabel txtTurn;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
|
private mage.client.cards.Cards hand;
|
||||||
|
private Map<String, SimpleCardsView> handCards;
|
||||||
|
private mage.client.cards.Cards stack;
|
||||||
|
|
||||||
private JTabbedPane jTabbedPane1;
|
private JTabbedPane jTabbedPane1;
|
||||||
private Border emptyBorder = new EmptyBorder(0,0,0,0);
|
private Border emptyBorder = new EmptyBorder(0,0,0,0);
|
||||||
private Color prevBGColor;
|
private Color prevBGColor;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2011 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.client.util;
|
||||||
|
|
||||||
|
import mage.sets.Sets;
|
||||||
|
import mage.view.CardView;
|
||||||
|
import mage.view.CardsView;
|
||||||
|
import mage.view.SimpleCardView;
|
||||||
|
import mage.view.SimpleCardsView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
*/
|
||||||
|
public class CardsViewUtil {
|
||||||
|
|
||||||
|
public static CardsView convertSimple(SimpleCardsView view) {
|
||||||
|
CardsView cards = new CardsView();
|
||||||
|
|
||||||
|
for (SimpleCardView simple: view.values()) {
|
||||||
|
mage.cards.Card card = Sets.findCard(simple.getExpansionSetCode(), simple.getCardNumber());
|
||||||
|
if (card != null) {
|
||||||
|
|
||||||
|
cards.put(simple.getId(), new CardView(card, simple.getId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cards;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -34,6 +34,7 @@ import mage.cards.decks.Deck;
|
||||||
import mage.sets.Sets;
|
import mage.sets.Sets;
|
||||||
import mage.view.CardView;
|
import mage.view.CardView;
|
||||||
import mage.view.DeckView;
|
import mage.view.DeckView;
|
||||||
|
import mage.view.SimpleCardView;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -50,25 +51,25 @@ public class DeckUtil {
|
||||||
|
|
||||||
public static Deck construct(DeckView view) {
|
public static Deck construct(DeckView view) {
|
||||||
Deck deck = new Deck();
|
Deck deck = new Deck();
|
||||||
for (CardView cardView : view.getCards().values()) {
|
for (SimpleCardView cardView : view.getCards().values()) {
|
||||||
ExpansionSet set = Sets.findSet(cardView.getExpansionSetCode());
|
ExpansionSet set = Sets.findSet(cardView.getExpansionSetCode());
|
||||||
if (set != null) {
|
if (set != null) {
|
||||||
Card card = set.findCard(cardView.getName(), cardView.getCardNumber());
|
Card card = set.findCard(cardView.getCardNumber());
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
deck.getCards().add(card);
|
deck.getCards().add(card);
|
||||||
} else {
|
} else {
|
||||||
log.fatal("(Deck constructing) Couldn't find card: " + cardView.getName() + ", set=" + cardView.getExpansionSetCode() + ", cid=" + Integer.valueOf(cardView.getCardNumber()));
|
log.fatal("(Deck constructing) Couldn't find card: set=" + cardView.getExpansionSetCode() + ", cid=" + Integer.valueOf(cardView.getCardNumber()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (CardView cardView : view.getSideboard().values()) {
|
for (SimpleCardView cardView : view.getSideboard().values()) {
|
||||||
ExpansionSet set = Sets.findSet(cardView.getExpansionSetCode());
|
ExpansionSet set = Sets.findSet(cardView.getExpansionSetCode());
|
||||||
if (set != null) {
|
if (set != null) {
|
||||||
Card card = set.findCard(cardView.getName(), cardView.getCardNumber());
|
Card card = set.findCard(cardView.getCardNumber());
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
deck.getSideboard().add(card);
|
deck.getSideboard().add(card);
|
||||||
} else {
|
} else {
|
||||||
log.fatal("(Deck constructing) Couldn't find card: " + cardView.getName() + ", set=" + cardView.getExpansionSetCode() + ", cid=" + Integer.valueOf(cardView.getCardNumber()));
|
log.fatal("(Deck constructing) Couldn't find card: set=" + cardView.getExpansionSetCode() + ", cid=" + Integer.valueOf(cardView.getCardNumber()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,10 +49,9 @@ import mage.target.Targets;
|
||||||
/**
|
/**
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class CardView implements Serializable {
|
public class CardView extends SimpleCardView {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
protected UUID id;
|
|
||||||
protected UUID parentId;
|
protected UUID parentId;
|
||||||
protected String name;
|
protected String name;
|
||||||
protected List<String> rules;
|
protected List<String> rules;
|
||||||
|
|
@ -66,17 +65,18 @@ public class CardView implements Serializable {
|
||||||
protected List<String> manaCost;
|
protected List<String> manaCost;
|
||||||
protected int convertedManaCost;
|
protected int convertedManaCost;
|
||||||
protected Rarity rarity;
|
protected Rarity rarity;
|
||||||
protected String expansionSetCode;
|
|
||||||
protected int cardNumber;
|
|
||||||
protected boolean isAbility;
|
protected boolean isAbility;
|
||||||
protected CardView ability;
|
protected CardView ability;
|
||||||
protected boolean faceDown;
|
|
||||||
|
|
||||||
public List<UUID> targets;
|
public List<UUID> targets;
|
||||||
|
|
||||||
|
public CardView(Card card, UUID cardId) {
|
||||||
|
this(card);
|
||||||
|
this.id = cardId;
|
||||||
|
}
|
||||||
|
|
||||||
public CardView(Card card) {
|
public CardView(Card card) {
|
||||||
this.id = card.getId();
|
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.isFaceDown());
|
||||||
this.faceDown = card.isFaceDown();
|
|
||||||
|
|
||||||
// no information available for face down cards
|
// no information available for face down cards
|
||||||
if (this.faceDown) {
|
if (this.faceDown) {
|
||||||
|
|
@ -106,8 +106,6 @@ public class CardView implements Serializable {
|
||||||
} else {
|
} else {
|
||||||
this.rarity = card.getRarity();
|
this.rarity = card.getRarity();
|
||||||
}
|
}
|
||||||
this.expansionSetCode = card.getExpansionSetCode();
|
|
||||||
this.cardNumber = card.getCardNumber();
|
|
||||||
|
|
||||||
if (card instanceof Spell) {
|
if (card instanceof Spell) {
|
||||||
Spell<?> spell = (Spell<?>) card;
|
Spell<?> spell = (Spell<?>) card;
|
||||||
|
|
@ -118,7 +116,7 @@ public class CardView implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardView(MageObject card) {
|
public CardView(MageObject card) {
|
||||||
this.id = card.getId();
|
super(card.getId(), "", 0, false);
|
||||||
|
|
||||||
this.name = card.getName();
|
this.name = card.getName();
|
||||||
if (card instanceof Permanent) {
|
if (card instanceof Permanent) {
|
||||||
|
|
@ -144,9 +142,10 @@ public class CardView implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CardView() {
|
protected CardView() {
|
||||||
|
super(null, "", 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillEmpty() {
|
private void fillEmpty() {
|
||||||
this.name = "Face Down";
|
this.name = "Face Down";
|
||||||
this.rules = new ArrayList<String>();
|
this.rules = new ArrayList<String>();
|
||||||
this.power = "";
|
this.power = "";
|
||||||
|
|
@ -164,6 +163,7 @@ public class CardView implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
CardView(Token token) {
|
CardView(Token token) {
|
||||||
|
super(token.getId(), "", 0, false);
|
||||||
this.id = token.getId();
|
this.id = token.getId();
|
||||||
this.name = token.getName();
|
this.name = token.getName();
|
||||||
this.rules = token.getAbilities().getRules(this.name);
|
this.rules = token.getAbilities().getRules(this.name);
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ import mage.abilities.Ability;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.GameState;
|
import mage.game.GameState;
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -27,13 +27,9 @@
|
||||||
*/
|
*/
|
||||||
package mage.view;
|
package mage.view;
|
||||||
|
|
||||||
import mage.cards.Card;
|
|
||||||
import mage.cards.Cards;
|
|
||||||
import mage.cards.decks.Deck;
|
import mage.cards.decks.Deck;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
|
|
@ -41,24 +37,24 @@ import java.util.Set;
|
||||||
public class DeckView implements Serializable {
|
public class DeckView implements Serializable {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private CardsView cards;
|
private SimpleCardsView cards;
|
||||||
private CardsView sideboard;
|
private SimpleCardsView sideboard;
|
||||||
|
|
||||||
public DeckView(Deck deck) {
|
public DeckView(Deck deck) {
|
||||||
name = deck.getName();
|
name = deck.getName();
|
||||||
cards = new CardsView(deck.getCards());
|
cards = new SimpleCardsView(deck.getCards());
|
||||||
sideboard = new CardsView(deck.getSideboard());
|
sideboard = new SimpleCardsView(deck.getSideboard());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardsView getCards() {
|
public SimpleCardsView getCards() {
|
||||||
return cards;
|
return cards;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardsView getSideboard() {
|
public SimpleCardsView getSideboard() {
|
||||||
return sideboard;
|
return sideboard;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,23 +38,23 @@ import mage.game.draft.DraftPlayer;
|
||||||
public class DraftPickView implements Serializable {
|
public class DraftPickView implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
protected CardsView booster;
|
protected SimpleCardsView booster;
|
||||||
protected CardsView picks;
|
protected SimpleCardsView picks;
|
||||||
protected boolean picking;
|
protected boolean picking;
|
||||||
protected int timeout;
|
protected int timeout;
|
||||||
|
|
||||||
public DraftPickView(DraftPlayer player, int timeout) {
|
public DraftPickView(DraftPlayer player, int timeout) {
|
||||||
this.booster = new CardsView(player.getBooster());
|
this.booster = new SimpleCardsView(player.getBooster());
|
||||||
this.picks = new CardsView(player.getDeck().getSideboard());
|
this.picks = new SimpleCardsView(player.getDeck().getSideboard());
|
||||||
this.picking = player.isPicking();
|
this.picking = player.isPicking();
|
||||||
this.timeout = timeout;
|
this.timeout = timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardsView getBooster() {
|
public SimpleCardsView getBooster() {
|
||||||
return booster;
|
return booster;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardsView getPicks() {
|
public SimpleCardsView getPicks() {
|
||||||
return picks;
|
return picks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ import mage.game.Game;
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class ExileView extends CardsView {
|
public class ExileView extends SimpleCardsView {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
@ -47,7 +47,7 @@ public class ExileView extends CardsView {
|
||||||
this.name = exileZone.getName();
|
this.name = exileZone.getName();
|
||||||
this.id = exileZone.getId();
|
this.id = exileZone.getId();
|
||||||
for (Card card: exileZone.getCards(game)) {
|
for (Card card: exileZone.getCards(game)) {
|
||||||
this.put(card.getId(), new CardView(card));
|
this.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.isFaceDown()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,11 @@ import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.Constants.PhaseStep;
|
import mage.Constants.PhaseStep;
|
||||||
import mage.Constants.TurnPhase;
|
import mage.Constants.TurnPhase;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.Cards;
|
|
||||||
import mage.game.ExileZone;
|
import mage.game.ExileZone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.GameState;
|
import mage.game.GameState;
|
||||||
|
|
@ -56,8 +54,8 @@ public class GameView implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private List<PlayerView> players = new ArrayList<PlayerView>();
|
private List<PlayerView> players = new ArrayList<PlayerView>();
|
||||||
private CardsView hand;
|
private SimpleCardsView hand;
|
||||||
private Map<String, CardsView> opponentHands;
|
private Map<String, SimpleCardsView> opponentHands;
|
||||||
private CardsView stack = new CardsView();
|
private CardsView stack = new CardsView();
|
||||||
private List<ExileView> exiles = new ArrayList<ExileView>();
|
private List<ExileView> exiles = new ArrayList<ExileView>();
|
||||||
private List<RevealedView> revealed = new ArrayList<RevealedView>();
|
private List<RevealedView> revealed = new ArrayList<RevealedView>();
|
||||||
|
|
@ -118,19 +116,19 @@ public class GameView implements Serializable {
|
||||||
return players;
|
return players;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardsView getHand() {
|
public SimpleCardsView getHand() {
|
||||||
return hand;
|
return hand;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHand(CardsView hand) {
|
public void setHand(SimpleCardsView hand) {
|
||||||
this.hand = hand;
|
this.hand = hand;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, CardsView> getOpponentHands() {
|
public Map<String, SimpleCardsView> getOpponentHands() {
|
||||||
return opponentHands;
|
return opponentHands;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOpponentHands(Map<String, CardsView> opponentHands) {
|
public void setOpponentHands(Map<String, SimpleCardsView> opponentHands) {
|
||||||
this.opponentHands = opponentHands;
|
this.opponentHands = opponentHands;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,12 +41,12 @@ import java.io.Serializable;
|
||||||
public class LookedAtView implements Serializable {
|
public class LookedAtView implements Serializable {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private CardsView cards = new CardsView();
|
private SimpleCardsView cards = new SimpleCardsView();
|
||||||
|
|
||||||
public LookedAtView(String name, Cards cards, Game game) {
|
public LookedAtView(String name, Cards cards, Game game) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
for (Card card: cards.getCards(game)) {
|
for (Card card: cards.getCards(game)) {
|
||||||
this.cards.put(card.getId(), new CardView(card));
|
this.cards.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.isFaceDown()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,7 +54,7 @@ public class LookedAtView implements Serializable {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardsView getCards() {
|
public SimpleCardsView getCards() {
|
||||||
return cards;
|
return cards;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ public class PlayerView implements Serializable {
|
||||||
private boolean isActive;
|
private boolean isActive;
|
||||||
private boolean hasLeft;
|
private boolean hasLeft;
|
||||||
private ManaPoolView manaPool;
|
private ManaPoolView manaPool;
|
||||||
private CardsView graveyard = new CardsView();
|
private SimpleCardsView graveyard = new SimpleCardsView();
|
||||||
private Map<UUID, PermanentView> battlefield = new HashMap<UUID, PermanentView>();
|
private Map<UUID, PermanentView> battlefield = new HashMap<UUID, PermanentView>();
|
||||||
|
|
||||||
public PlayerView(Player player, GameState state, Game game) {
|
public PlayerView(Player player, GameState state, Game game) {
|
||||||
|
|
@ -69,7 +69,7 @@ public class PlayerView implements Serializable {
|
||||||
this.isActive = (player.getId().equals(state.getActivePlayerId()));
|
this.isActive = (player.getId().equals(state.getActivePlayerId()));
|
||||||
this.hasLeft = player.hasLeft();
|
this.hasLeft = player.hasLeft();
|
||||||
for (Card card: player.getGraveyard().getCards(game)) {
|
for (Card card: player.getGraveyard().getCards(game)) {
|
||||||
graveyard.put(card.getId(), new CardView(card));
|
graveyard.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.isFaceDown()));
|
||||||
}
|
}
|
||||||
for (Permanent permanent: state.getBattlefield().getAllPermanents()) {
|
for (Permanent permanent: state.getBattlefield().getAllPermanents()) {
|
||||||
if (showInBattlefield(permanent, state)) {
|
if (showInBattlefield(permanent, state)) {
|
||||||
|
|
@ -113,7 +113,7 @@ public class PlayerView implements Serializable {
|
||||||
return this.manaPool;
|
return this.manaPool;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardsView getGraveyard() {
|
public SimpleCardsView getGraveyard() {
|
||||||
return this.graveyard;
|
return this.graveyard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,12 +40,12 @@ import mage.game.Game;
|
||||||
public class RevealedView implements Serializable {
|
public class RevealedView implements Serializable {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private CardsView cards = new CardsView();
|
private SimpleCardsView cards = new SimpleCardsView();
|
||||||
|
|
||||||
public RevealedView(String name, Cards cards, Game game) {
|
public RevealedView(String name, Cards cards, Game game) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
for (Card card: cards.getCards(game)) {
|
for (Card card: cards.getCards(game)) {
|
||||||
this.cards.put(card.getId(), new CardView(card));
|
this.cards.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.isFaceDown()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -53,7 +53,7 @@ public class RevealedView implements Serializable {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardsView getCards() {
|
public SimpleCardsView getCards() {
|
||||||
return cards;
|
return cards;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
66
Mage.Common/src/mage/view/SimpleCardView.java
Normal file
66
Mage.Common/src/mage/view/SimpleCardView.java
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* 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.view;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
*/
|
||||||
|
public class SimpleCardView implements Serializable {
|
||||||
|
protected UUID id;
|
||||||
|
protected String expansionSetCode;
|
||||||
|
protected int cardNumber;
|
||||||
|
protected boolean faceDown;
|
||||||
|
|
||||||
|
public SimpleCardView(UUID id, String expansionSetCode, int cardNumber, boolean faceDown) {
|
||||||
|
this.id = id;
|
||||||
|
this.expansionSetCode = expansionSetCode;
|
||||||
|
this.cardNumber = cardNumber;
|
||||||
|
this.faceDown = faceDown;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExpansionSetCode() {
|
||||||
|
return expansionSetCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCardNumber() {
|
||||||
|
return cardNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFaceDown() {
|
||||||
|
return faceDown;
|
||||||
|
}
|
||||||
|
}
|
||||||
50
Mage.Common/src/mage/view/SimpleCardsView.java
Normal file
50
Mage.Common/src/mage/view/SimpleCardsView.java
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* 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.view;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.cards.Card;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
*/
|
||||||
|
public class SimpleCardsView extends HashMap<UUID, SimpleCardView> {
|
||||||
|
|
||||||
|
public SimpleCardsView() {}
|
||||||
|
|
||||||
|
public SimpleCardsView(Collection<Card> cards) {
|
||||||
|
for (Card card: cards) {
|
||||||
|
this.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.isFaceDown()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -47,6 +47,7 @@ import mage.view.CardsView;
|
||||||
import mage.view.GameClientMessage;
|
import mage.view.GameClientMessage;
|
||||||
import mage.view.GameView;
|
import mage.view.GameView;
|
||||||
import mage.view.LookedAtView;
|
import mage.view.LookedAtView;
|
||||||
|
import mage.view.SimpleCardsView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -196,13 +197,13 @@ public class GameSession extends GameWatcher {
|
||||||
public GameView getGameView() {
|
public GameView getGameView() {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
GameView gameView = new GameView(game.getState(), game);
|
GameView gameView = new GameView(game.getState(), game);
|
||||||
gameView.setHand(new CardsView(player.getHand().getCards(game)));
|
gameView.setHand(new SimpleCardsView(player.getHand().getCards(game)));
|
||||||
|
|
||||||
if (player.getPlayersUnderYourControl().size() > 0) {
|
if (player.getPlayersUnderYourControl().size() > 0) {
|
||||||
Map<String, CardsView> handCards = new HashMap<String, CardsView>();
|
Map<String, SimpleCardsView> handCards = new HashMap<String, SimpleCardsView>();
|
||||||
for (UUID playerId : player.getPlayersUnderYourControl()) {
|
for (UUID playerId : player.getPlayersUnderYourControl()) {
|
||||||
Player opponent = game.getPlayer(playerId);
|
Player opponent = game.getPlayer(playerId);
|
||||||
handCards.put(opponent.getName(), new CardsView(opponent.getHand().getCards(game)));
|
handCards.put(opponent.getName(), new SimpleCardsView(opponent.getHand().getCards(game)));
|
||||||
}
|
}
|
||||||
gameView.setOpponentHands(handCards);
|
gameView.setOpponentHands(handCards);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
||||||
private static Set<String> nonLandNames;
|
private static Set<String> nonLandNames;
|
||||||
private static Set<String> creatureTypes;
|
private static Set<String> creatureTypes;
|
||||||
private static List<Card> cards;
|
private static List<Card> cards;
|
||||||
|
private static Map<String, Card> cardMap;
|
||||||
protected static Random rnd = new Random();
|
protected static Random rnd = new Random();
|
||||||
|
|
||||||
public static Sets getInstance() {
|
public static Sets getInstance() {
|
||||||
|
|
@ -67,6 +68,7 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
||||||
names = new TreeSet<String>();
|
names = new TreeSet<String>();
|
||||||
nonLandNames = new TreeSet<String>();
|
nonLandNames = new TreeSet<String>();
|
||||||
cards = new ArrayList<Card>();
|
cards = new ArrayList<Card>();
|
||||||
|
cardMap = new HashMap<String, Card>();
|
||||||
creatureTypes = new TreeSet<String>();
|
creatureTypes = new TreeSet<String>();
|
||||||
this.addSet(AlaraReborn.getInstance());
|
this.addSet(AlaraReborn.getInstance());
|
||||||
this.addSet(Apocalypse.getInstance());
|
this.addSet(Apocalypse.getInstance());
|
||||||
|
|
@ -243,6 +245,23 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Card findCard(String expansionsetCode, int cardNum) {
|
||||||
|
if (cardMap.containsKey(expansionsetCode + Integer.toString(cardNum))) {
|
||||||
|
return cardMap.get(expansionsetCode + Integer.toString(cardNum));
|
||||||
|
}
|
||||||
|
if (fINSTANCE.containsKey(expansionsetCode)) {
|
||||||
|
ExpansionSet set = fINSTANCE.get(expansionsetCode);
|
||||||
|
Card card = set.findCard(cardNum);
|
||||||
|
if (card != null) {
|
||||||
|
cardMap.put(expansionsetCode + Integer.toString(cardNum), card);
|
||||||
|
return card;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.warn("Could not find card: set=" + expansionsetCode + "cardNum=" + Integer.toString(cardNum));
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static Card createCard(Class clazz) {
|
public static Card createCard(Class clazz) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -280,7 +299,7 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
||||||
String setCode = m.group(3);
|
String setCode = m.group(3);
|
||||||
int cardNum = Integer.parseInt(m.group(4));
|
int cardNum = Integer.parseInt(m.group(4));
|
||||||
ExpansionSet set = Sets.findSet(setCode);
|
ExpansionSet set = Sets.findSet(setCode);
|
||||||
String card = set.findCard(cardNum);
|
String card = set.findCardName(cardNum);
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
if (!sideboard) {
|
if (!sideboard) {
|
||||||
deckList.getCards().add(card);
|
deckList.getCards().add(card);
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ import java.net.URL;
|
||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
import java.util.jar.JarInputStream;
|
import java.util.jar.JarInputStream;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
@ -132,9 +131,9 @@ public abstract class ExpansionSet implements Serializable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Card findCard(String name, int cardNum) {
|
public Card findCard(int cardNum) {
|
||||||
for (Card card : cards) {
|
for (Card card : cards) {
|
||||||
if (cardNum == card.getCardNumber() && name.equalsIgnoreCase(card.getName())) {
|
if (cardNum == card.getCardNumber()) {
|
||||||
Card newCard = card.copy();
|
Card newCard = card.copy();
|
||||||
newCard.assignNewId();
|
newCard.assignNewId();
|
||||||
return newCard;
|
return newCard;
|
||||||
|
|
@ -158,7 +157,7 @@ public abstract class ExpansionSet implements Serializable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String findCard(int cardNum) {
|
public String findCardName(int cardNum) {
|
||||||
for (Card card : cards) {
|
for (Card card : cards) {
|
||||||
if (card.getCardNumber() == cardNum)
|
if (card.getCardNumber() == cardNum)
|
||||||
return card.getClass().getCanonicalName();
|
return card.getClass().getCanonicalName();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue