mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
Changes to show name and number of counter on a card.
This commit is contained in:
parent
cc96a55523
commit
dc131fa8dd
5 changed files with 60 additions and 13 deletions
|
|
@ -57,10 +57,12 @@ import javax.swing.text.*;
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static mage.constants.Constants.*;
|
||||
import mage.view.CounterView;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -243,7 +245,16 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
}
|
||||
|
||||
protected List<String> getRules() {
|
||||
return card.getRules();
|
||||
if (card.getCounters() != null) {
|
||||
List<String> rules = new ArrayList<String>(card.getRules());
|
||||
for (CounterView counter: card.getCounters()) {
|
||||
rules.add(counter.getCount() + " x " + counter.getName());
|
||||
}
|
||||
return rules;
|
||||
}
|
||||
else {
|
||||
return card.getRules();
|
||||
}
|
||||
}
|
||||
|
||||
protected String getType(CardView card) {
|
||||
|
|
|
|||
|
|
@ -57,8 +57,7 @@ public class ExileZoneDialog extends MageDialog {
|
|||
public void loadCards(ExileView exile, BigCard bigCard, UUID gameId) {
|
||||
this.title = exile.getName();
|
||||
this.setTitelBarToolTip(exile.getName());
|
||||
boolean changed = false;
|
||||
changed = cards.loadCards(exile, bigCard, gameId);
|
||||
boolean changed = cards.loadCards(exile, bigCard, gameId, null);
|
||||
if (exile.size() > 0) {
|
||||
show();
|
||||
if (changed) {
|
||||
|
|
|
|||
|
|
@ -32,15 +32,20 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
|
|||
setBackground(Color.white);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCard(final CardView card, final Component container) {
|
||||
if (card == null) return;
|
||||
if (isCurrentCard(card)) return;
|
||||
if (card == null || isCurrentCard(card)) {
|
||||
return;
|
||||
}
|
||||
currentCard = card;
|
||||
|
||||
ThreadUtils.threadPool.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (!card.equals(currentCard)) return;
|
||||
if (!card.equals(currentCard)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String manaCost = "";
|
||||
for (String m : card.getManaCost()) {
|
||||
|
|
@ -51,8 +56,9 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
|
|||
|
||||
int symbolCount = 0;
|
||||
int offset = 0;
|
||||
while ((offset = castingCost.indexOf("<img", offset) + 1) != 0)
|
||||
while ((offset = castingCost.indexOf("<img", offset) + 1) != 0) {
|
||||
symbolCount++;
|
||||
}
|
||||
|
||||
List<String> rules = card.getRules();
|
||||
List<String> rulings = new ArrayList<String>(rules);
|
||||
|
|
@ -61,24 +67,33 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
|
|||
if (card.getPairedCard() != null) {
|
||||
rulings.add("<span color='green'><i>Paired with another creature</i></span>");
|
||||
}
|
||||
List<CounterView> counters = ((PermanentView) card).getCounters();
|
||||
}
|
||||
if (!card.isAbility() && (card instanceof PermanentView || card instanceof CardView)) {
|
||||
List<CounterView> counters;
|
||||
if (card instanceof PermanentView) {
|
||||
counters = ((PermanentView) card).getCounters();
|
||||
} else {
|
||||
counters = ((CardView) card).getCounters();
|
||||
}
|
||||
int count = counters != null ? counters.size() : 0;
|
||||
if (count > 0) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int index = 0;
|
||||
for (CounterView counter : ((PermanentView) card).getCounters()) {
|
||||
for (CounterView counter : counters) {
|
||||
if (counter.getCount() > 0) {
|
||||
if (index == 0) {
|
||||
sb.append("<b>Counters:</b> ");
|
||||
} else {
|
||||
sb.append(", ");
|
||||
}
|
||||
sb.append(counter.getCount() + "x<i>" + counter.getName() + "</i>");
|
||||
sb.append(counter.getCount()).append("x<i>").append(counter.getName()).append("</i>");
|
||||
index++;
|
||||
}
|
||||
}
|
||||
rulings.add(sb.toString());
|
||||
}
|
||||
}
|
||||
if (card instanceof PermanentView) {
|
||||
int damage = ((PermanentView)card).getDamage();
|
||||
if (damage > 0) {
|
||||
rulings.add("<span color='red'><b>Damage dealt:</b> " + damage + "</span>");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue