mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Merge branch 'master' of https://github.com/magefree/mage.git
This commit is contained in:
commit
8841cca120
9 changed files with 278 additions and 174 deletions
|
@ -74,18 +74,23 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
|
|||
* Max amount of cards in card grid for which card images will be drawn.
|
||||
* Done so to solve issue with memory for big piles of cards.
|
||||
*/
|
||||
private static final int MAX_IMAGES = 250;
|
||||
public static final int MAX_IMAGES = 300;
|
||||
|
||||
public CardGrid() {
|
||||
initComponents();
|
||||
setOpaque(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCards(CardsView showCards, SortBy sortBy, boolean piles, BigCard bigCard, UUID gameId) {
|
||||
this.loadCards(showCards, sortBy, piles, bigCard, gameId, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCards(CardsView showCards, SortBy sortBy, boolean piles, BigCard bigCard, UUID gameId, boolean merge) {
|
||||
boolean drawImage = showCards.size() < MAX_IMAGES;
|
||||
this.bigCard = bigCard;
|
||||
this.gameId = gameId;
|
||||
if (merge) {
|
||||
for (CardView card: showCards.values()) {
|
||||
if (!cards.containsKey(card.getId())) {
|
||||
addCard(card, bigCard, gameId, drawImage);
|
||||
|
@ -98,6 +103,12 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
|
|||
i.remove();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.clear();
|
||||
for (CardView card: showCards.values()) {
|
||||
addCard(card, bigCard, gameId, drawImage);
|
||||
}
|
||||
}
|
||||
System.gc();
|
||||
drawCards(sortBy, piles);
|
||||
this.setVisible(true);
|
||||
|
@ -144,8 +155,9 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
|
|||
MageCard lastCard = null;
|
||||
for (MageCard cardImg: sortedCards) {
|
||||
if (piles) {
|
||||
if (lastCard == null)
|
||||
if (lastCard == null) {
|
||||
lastCard = cardImg;
|
||||
}
|
||||
switch (sortBy) {
|
||||
case NAME:
|
||||
if (!cardImg.getOriginal().getName().equals(lastCard.getOriginal().getName())) {
|
||||
|
@ -203,6 +215,19 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
|
|||
repaint();
|
||||
}
|
||||
|
||||
private void clear() {
|
||||
this.cards.clear();
|
||||
removeAllCardImg();
|
||||
}
|
||||
|
||||
private void removeAllCardImg() {
|
||||
for (Component comp: getComponents()) {
|
||||
if (comp instanceof Card || comp instanceof MageCard) {
|
||||
remove(comp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeCardImg(UUID cardId) {
|
||||
for (Component comp: getComponents()) {
|
||||
if (comp instanceof Card) {
|
||||
|
@ -307,6 +332,11 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
|
|||
revalidate();
|
||||
repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int cardsSize() {
|
||||
return cards.size();
|
||||
}
|
||||
}
|
||||
|
||||
class CardNameComparator implements Comparator<MageCard> {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.1" encoding="UTF-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
|
@ -35,7 +35,7 @@
|
|||
<Group type="102" attributes="0">
|
||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="305" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="23" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
|
|
@ -163,6 +163,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
return list;
|
||||
}
|
||||
|
||||
|
||||
public void loadCards(CardsView showCards, BigCard bigCard, UUID gameId) {
|
||||
this.cards = showCards;
|
||||
this.bigCard = bigCard;
|
||||
|
@ -317,6 +318,11 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
|
||||
@Override
|
||||
public void loadCards(CardsView showCards, SortBy sortBy, boolean piles, BigCard bigCard, UUID gameId) {
|
||||
this.loadCards(showCards, sortBy, piles, bigCard, gameId, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCards(CardsView showCards, SortBy sortBy, boolean piles, BigCard bigCard, UUID gameId, boolean merge) {
|
||||
cards = showCards;
|
||||
this.bigCard = bigCard;
|
||||
this.gameId = gameId;
|
||||
|
@ -534,4 +540,9 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
public void setDisplayNoCopies(boolean value) {
|
||||
mainModel.setDisplayNoCopies(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int cardsSize() {
|
||||
return cards.size();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,5 +46,7 @@ public interface ICardGrid {
|
|||
void addCardEventListener(Listener<Event> listener);
|
||||
void drawCards(Constants.SortBy sortBy, boolean piles);
|
||||
void loadCards(CardsView showCards, Constants.SortBy sortBy, boolean piles, BigCard bigCard, UUID gameId);
|
||||
void loadCards(CardsView showCards, Constants.SortBy sortBy, boolean piles, BigCard bigCard, UUID gameId, boolean merge);
|
||||
void refresh();
|
||||
int cardsSize();
|
||||
}
|
||||
|
|
|
@ -34,7 +34,23 @@
|
|||
|
||||
package mage.client.deckeditor;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import java.awt.Color;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
import mage.cards.Card;
|
||||
|
@ -49,6 +65,7 @@ import mage.client.cards.ICardGrid;
|
|||
import mage.client.constants.Constants.SortBy;
|
||||
import mage.client.deckeditor.table.TableModel;
|
||||
import mage.client.util.sets.ConstructedFormats;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.filter.predicate.Predicates;
|
||||
|
@ -59,12 +76,6 @@ import mage.filter.predicate.other.CardTextPredicate;
|
|||
import mage.filter.predicate.other.ExpansionSetPredicate;
|
||||
import mage.view.CardsView;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import java.awt.Color;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -92,7 +103,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
currentView = mainModel; // by default we use List View
|
||||
}
|
||||
|
||||
public void makeTransparent() {
|
||||
private void makeTransparent() {
|
||||
this.addComponentListener(this);
|
||||
setOpaque(false);
|
||||
cardGrid.setOpaque(false);
|
||||
|
@ -107,7 +118,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
tbTypes.setOpaque(true); // false = transparent
|
||||
}
|
||||
|
||||
public void initListViewComponents() {
|
||||
private void initListViewComponents() {
|
||||
mainTable = new JTable();
|
||||
|
||||
mainModel = new TableModel();
|
||||
|
@ -135,6 +146,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
chkPiles.setEnabled(false);
|
||||
|
||||
mainTable.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (e.getClickCount() == 2 && !e.isConsumed()) {
|
||||
e.consume();
|
||||
|
@ -178,13 +190,17 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
this.btnClear.setVisible(true);
|
||||
this.cbExpansionSet.setVisible(true);
|
||||
cbExpansionSet.setModel(new DefaultComboBoxModel(ConstructedFormats.getTypes()));
|
||||
// Action event on Expansion set triggers loadCards method
|
||||
cbExpansionSet.setSelectedIndex(0);
|
||||
|
||||
filterCards();
|
||||
}
|
||||
|
||||
private FilterCard buildFilter() {
|
||||
FilterCard filter = new FilterCard();
|
||||
|
||||
String name = jTextFieldSearch.getText().trim();
|
||||
filter.add(new CardTextPredicate(name));
|
||||
|
||||
if (limited) {
|
||||
ArrayList<Predicate<MageObject>> predicates = new ArrayList<Predicate<MageObject>>();
|
||||
|
||||
if (this.rdoGreen.isSelected()) {
|
||||
|
@ -231,8 +247,6 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
}
|
||||
filter.add(Predicates.or(predicates));
|
||||
|
||||
String name = jTextFieldSearch.getText().trim();
|
||||
filter.add(new CardTextPredicate(name));
|
||||
|
||||
if (this.cbExpansionSet.isVisible()) {
|
||||
String expansionSelection = this.cbExpansionSet.getSelectedItem().toString();
|
||||
|
@ -244,6 +258,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
filter.add(Predicates.or(expansionPredicates));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
@ -279,11 +294,6 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
criteria.types(CardType.PLANESWALKER);
|
||||
}
|
||||
|
||||
String text = jTextFieldSearch.getText().trim();
|
||||
if (!text.isEmpty()) {
|
||||
// criteria.rules(text);
|
||||
}
|
||||
|
||||
if (this.cbExpansionSet.isVisible()) {
|
||||
String expansionSelection = this.cbExpansionSet.getSelectedItem().toString();
|
||||
if (!expansionSelection.equals("- All Sets")) {
|
||||
|
@ -316,7 +326,10 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
}
|
||||
}
|
||||
}
|
||||
this.currentView.loadCards(new CardsView(filteredCards), (SortBy) cbSortBy.getSelectedItem(), chkPiles.isSelected(), bigCard, null);
|
||||
if (currentView instanceof CardGrid && filteredCards.size() > CardGrid.MAX_IMAGES) {
|
||||
this.toggleViewMode();
|
||||
}
|
||||
this.currentView.loadCards(new CardsView(filteredCards), (SortBy) cbSortBy.getSelectedItem(), chkPiles.isSelected(), bigCard, null, false);
|
||||
this.cardCount.setText(String.valueOf(filteredCards.size()));
|
||||
}
|
||||
finally {
|
||||
|
@ -328,10 +341,6 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
this.cardCount.setText(String.valueOf(value));
|
||||
}
|
||||
|
||||
public ICardGrid getCardsList() {
|
||||
return this.currentView;
|
||||
}
|
||||
|
||||
public List<ICardGrid> getCardGridComponents() {
|
||||
List<ICardGrid> components = new ArrayList<ICardGrid>();
|
||||
components.add(mainModel);
|
||||
|
@ -807,13 +816,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
}//GEN-LAST:event_rdoPlaneswalkersActionPerformed
|
||||
|
||||
private void cbExpansionSetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbExpansionSetActionPerformed
|
||||
if (this.cbExpansionSet.getSelectedItem().equals("-- Standard")) {
|
||||
filterCards();
|
||||
} else {
|
||||
// auto switch for ListView for "All sets" (too many cards to load)
|
||||
jToggleListView.doClick();
|
||||
jToggleListView.setSelected(true);
|
||||
}
|
||||
}//GEN-LAST:event_cbExpansionSetActionPerformed
|
||||
|
||||
private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearActionPerformed
|
||||
|
@ -841,35 +844,39 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
}//GEN-LAST:event_btnBoosterActionPerformed
|
||||
|
||||
private void cbSortByActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbSortByActionPerformed
|
||||
if (cbSortBy.getSelectedItem() instanceof SortBy)
|
||||
if (cbSortBy.getSelectedItem() instanceof SortBy) {
|
||||
this.currentView.drawCards((SortBy) cbSortBy.getSelectedItem(), chkPiles.isSelected());
|
||||
}
|
||||
}//GEN-LAST:event_cbSortByActionPerformed
|
||||
|
||||
private void chkPilesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkPilesActionPerformed
|
||||
if (cbSortBy.getSelectedItem() instanceof SortBy)
|
||||
if (cbSortBy.getSelectedItem() instanceof SortBy) {
|
||||
this.currentView.drawCards((SortBy) cbSortBy.getSelectedItem(), chkPiles.isSelected());
|
||||
}
|
||||
}//GEN-LAST:event_chkPilesActionPerformed
|
||||
|
||||
private void jToggleListViewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleListViewActionPerformed
|
||||
jToggleCardView.setSelected(false);
|
||||
currentView = mainModel;
|
||||
jScrollPane1.setViewportView(mainTable);
|
||||
cbSortBy.setEnabled(false);
|
||||
chkPiles.setEnabled(false);
|
||||
jButtonAddToMain.setEnabled(true);
|
||||
jButtonAddToSideboard.setEnabled(true);
|
||||
if (!(currentView instanceof TableModel)) {
|
||||
toggleViewMode();
|
||||
} else {
|
||||
jToggleListView.setSelected(true);
|
||||
}
|
||||
filterCards();
|
||||
}//GEN-LAST:event_jToggleListViewActionPerformed
|
||||
|
||||
private void jToggleCardViewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleCardViewActionPerformed
|
||||
jToggleListView.setSelected(false);
|
||||
currentView = cardGrid;
|
||||
jScrollPane1.setViewportView(cardGrid);
|
||||
cbSortBy.setEnabled(true);
|
||||
chkPiles.setEnabled(true);
|
||||
jButtonAddToMain.setEnabled(false);
|
||||
jButtonAddToSideboard.setEnabled(false);
|
||||
if (currentView.cardsSize() > CardGrid.MAX_IMAGES) {
|
||||
jToggleCardView.setSelected(false);
|
||||
JOptionPane.showMessageDialog(this, new StringBuilder("The card view can't be used for more than ").append(CardGrid.MAX_IMAGES).append(" cards.").toString());
|
||||
|
||||
} else {
|
||||
if (!(currentView instanceof CardGrid)) {
|
||||
toggleViewMode();
|
||||
} else {
|
||||
jToggleCardView.setSelected(true);
|
||||
}
|
||||
filterCards();
|
||||
}
|
||||
}//GEN-LAST:event_jToggleCardViewActionPerformed
|
||||
|
||||
private void jButtonAddToMainActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddToMainActionPerformed
|
||||
|
@ -881,9 +888,10 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
mainModel.doubleClick(index);
|
||||
}
|
||||
//if (!mode.equals(Constants.DeckEditorMode.Constructed))
|
||||
if (limited)
|
||||
if (limited) {
|
||||
mainModel.fireTableDataChanged();
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_jButtonAddToMainActionPerformed
|
||||
|
||||
private void jButtonAddToSideboardActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddToSideboardActionPerformed
|
||||
|
@ -895,9 +903,10 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
mainModel.shiftDoubleClick(index);
|
||||
}
|
||||
//if (!mode.equals(Constants.DeckEditorMode.Constructed))
|
||||
if (limited)
|
||||
if (limited) {
|
||||
mainModel.fireTableDataChanged();
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_jButtonAddToSideboardActionPerformed
|
||||
|
||||
private void jButtonRemoveFromMainActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRemoveFromMainActionPerformed
|
||||
|
@ -918,9 +927,33 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
filterCards();
|
||||
}//GEN-LAST:event_jButtonCleanActionPerformed
|
||||
|
||||
private void toggleViewMode() {
|
||||
if (currentView instanceof CardGrid) {
|
||||
jToggleListView.setSelected(true);
|
||||
jToggleCardView.setSelected(false);
|
||||
currentView = mainModel;
|
||||
jScrollPane1.setViewportView(mainTable);
|
||||
cbSortBy.setEnabled(false);
|
||||
chkPiles.setEnabled(false);
|
||||
jButtonAddToMain.setEnabled(true);
|
||||
jButtonAddToSideboard.setEnabled(true);
|
||||
} else {
|
||||
jToggleCardView.setSelected(true);
|
||||
jToggleListView.setSelected(false);
|
||||
currentView = cardGrid;
|
||||
jScrollPane1.setViewportView(cardGrid);
|
||||
cbSortBy.setEnabled(true);
|
||||
chkPiles.setEnabled(true);
|
||||
jButtonAddToMain.setEnabled(false);
|
||||
jButtonAddToSideboard.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Integer> asList(final int[] is) {
|
||||
List<Integer> list = new ArrayList<Integer>();
|
||||
for (int i : is) list.add(i);
|
||||
for (int i : is) {
|
||||
list.add(i);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -978,26 +1011,30 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
if (cbSortBy.getSelectedItem() instanceof SortBy)
|
||||
if (cbSortBy.getSelectedItem() instanceof SortBy) {
|
||||
this.currentView.drawCards((SortBy) cbSortBy.getSelectedItem(), chkPiles.isSelected());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentMoved(ComponentEvent e) {
|
||||
if (cbSortBy.getSelectedItem() instanceof SortBy)
|
||||
if (cbSortBy.getSelectedItem() instanceof SortBy) {
|
||||
this.currentView.drawCards((SortBy) cbSortBy.getSelectedItem(), chkPiles.isSelected());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentShown(ComponentEvent e) {
|
||||
if (cbSortBy.getSelectedItem() instanceof SortBy)
|
||||
if (cbSortBy.getSelectedItem() instanceof SortBy) {
|
||||
this.currentView.drawCards((SortBy) cbSortBy.getSelectedItem(), chkPiles.isSelected());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentHidden(ComponentEvent e) {
|
||||
if (cbSortBy.getSelectedItem() instanceof SortBy)
|
||||
if (cbSortBy.getSelectedItem() instanceof SortBy) {
|
||||
this.currentView.drawCards((SortBy) cbSortBy.getSelectedItem(), chkPiles.isSelected());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -84,22 +84,36 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
|
||||
@Override
|
||||
public void loadCards(CardsView showCards, SortBy sortBy, boolean piles, BigCard bigCard, UUID gameId) {
|
||||
this.loadCards(showCards, sortBy, piles, bigCard, gameId, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCards(CardsView showCards, SortBy sortBy, boolean piles, BigCard bigCard, UUID gameId, boolean merge) {
|
||||
this.bigCard = bigCard;
|
||||
this.gameId = gameId;
|
||||
int landCount = 0;
|
||||
int creatureCount = 0;
|
||||
if (!merge) {
|
||||
this.clear();
|
||||
for (CardView card : showCards.values()) {
|
||||
addCard(card, bigCard, gameId);
|
||||
}
|
||||
} else {
|
||||
for (CardView card : showCards.values()) {
|
||||
if (!cards.containsKey(card.getId())) {
|
||||
addCard(card, bigCard, gameId);
|
||||
}
|
||||
if (updateCountsCallback != null) {
|
||||
if (card.getCardTypes().contains(CardType.LAND))
|
||||
if (card.getCardTypes().contains(CardType.LAND)) {
|
||||
landCount++;
|
||||
if (card.getCardTypes().contains(CardType.CREATURE))
|
||||
}
|
||||
if (card.getCardTypes().contains(CardType.CREATURE)) {
|
||||
creatureCount++;
|
||||
}
|
||||
}
|
||||
// not easy logic for merge :)
|
||||
}
|
||||
|
||||
// no easy logic for merge :)
|
||||
for (Iterator<Entry<UUID, CardView>> i = cards.entrySet().iterator(); i.hasNext();) {
|
||||
Entry<UUID, CardView> entry = i.next();
|
||||
if (!showCards.containsKey(entry.getKey())) {
|
||||
|
@ -148,6 +162,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
if (updateCountsCallback != null) {
|
||||
updateCountsCallback.update(cards.size(), creatureCount, landCount);
|
||||
}
|
||||
}
|
||||
|
||||
sort(1, true);
|
||||
drawCards(sortBy, piles);
|
||||
|
@ -384,4 +399,9 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
public void setUpdateCountsCallback(UpdateCountsCallback callback) {
|
||||
this.updateCountsCallback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int cardsSize() {
|
||||
return cards.size();
|
||||
}
|
||||
}
|
|
@ -54,7 +54,7 @@ import mage.watchers.common.DamagedByWatcher;
|
|||
public class KumanosPupils extends CardImpl<KumanosPupils> {
|
||||
|
||||
public KumanosPupils(UUID ownerId) {
|
||||
super(ownerId, 177, "Kumano's Pupils", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{R}");
|
||||
super(ownerId, 177, "Kumano's Pupils", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{4}{R}");
|
||||
this.expansionSetCode = "CHK";
|
||||
this.subtype.add("Human");
|
||||
this.subtype.add("Shaman");
|
||||
|
|
|
@ -204,6 +204,8 @@ public class CardCriteria {
|
|||
clausesCount++;
|
||||
}
|
||||
|
||||
|
||||
if (types.size() != 7) { //if all types selected - no selection needed
|
||||
for (CardType type : types) {
|
||||
where.like("types", new SelectArg('%' + type.name() + '%'));
|
||||
}
|
||||
|
@ -211,6 +213,7 @@ public class CardCriteria {
|
|||
where.or(types.size());
|
||||
clausesCount++;
|
||||
}
|
||||
}
|
||||
|
||||
for (CardType type : notTypes) {
|
||||
where.not().like("types", new SelectArg('%' + type.name() + '%'));
|
||||
|
@ -277,6 +280,6 @@ public class CardCriteria {
|
|||
qb.limit(count);
|
||||
}
|
||||
|
||||
qb.orderBy("cardNumber", true);
|
||||
// qb.orderBy("cardNumber", true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ import java.util.Set;
|
|||
import java.util.TreeSet;
|
||||
import java.util.concurrent.Callable;
|
||||
import mage.constants.CardType;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue