Displaying player's poison counters. Displaying alls counters info in tooltips.

This commit is contained in:
magenoxx 2011-01-29 10:45:05 +03:00
parent 76b1d94977
commit 93878d4868
5 changed files with 33 additions and 3 deletions

View file

@ -107,6 +107,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
public void update(PlayerView player) {
this.player = player;
lifeLabel.setText(Integer.toString(player.getLife()));
poisonLabel.setText(Integer.toString(player.getPoison()));
handLabel.setText(Integer.toString(player.getHandCount()));
libraryLabel.setText(Integer.toString(player.getLibraryCount()));
graveLabel.setText(Integer.toString(player.getGraveyard().size()));

View file

@ -70,7 +70,6 @@ public class CardView implements Serializable {
protected int cardNumber;
protected boolean isAbility;
protected CardView ability;
protected Counters counters;
public List<UUID> targets;
@ -82,7 +81,6 @@ public class CardView implements Serializable {
this.power = Integer.toString(card.getPower().getValue());
this.toughness = Integer.toString(card.getToughness().getValue());
this.loyalty = Integer.toString(card.getLoyalty().getValue());
this.counters = ((Permanent) card).getCounters().copy();
} else {
this.power = card.getPower().toString();
this.toughness = card.getToughness().toString();

View file

@ -33,6 +33,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import mage.cards.Card;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.GameState;
import mage.game.permanent.Permanent;
@ -48,6 +49,7 @@ public class PlayerView implements Serializable {
private UUID playerId;
private String name;
private int life;
private int poison;
private int libraryCount;
private int handCount;
private boolean isActive;
@ -60,6 +62,7 @@ public class PlayerView implements Serializable {
this.playerId = player.getId();
this.name = player.getName();
this.life = player.getLife();
this.poison = player.getCounters().getCount(CounterType.POISON);
this.libraryCount = player.getLibrary().size();
this.handCount = player.getHand().size();
this.manaPool = new ManaPoolView(player.getManaPool());
@ -94,6 +97,10 @@ public class PlayerView implements Serializable {
return this.life;
}
public int getPoison() {
return this.poison;
}
public int getLibraryCount() {
return this.libraryCount;
}

View file

@ -2,14 +2,18 @@ package org.mage.plugins.card.info;
import mage.Constants;
import mage.components.CardInfoPane;
import mage.game.permanent.Permanent;
import mage.utils.CardUtil;
import mage.utils.ThreadUtils;
import mage.view.CardView;
import mage.view.CounterView;
import mage.view.PermanentView;
import org.mage.card.arcane.ManaSymbols;
import org.mage.card.arcane.UI;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
/**
@ -49,7 +53,27 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
while ((offset = castingCost.indexOf("<img", offset) + 1) != 0)
symbolCount++;
List<String> rulings = card.getRules();
List<String> rules = card.getRules();
List<String> rulings = new ArrayList<String>(rules);
if (card instanceof PermanentView) {
int count = ((PermanentView)card).getCounters().size();
if (count > 0) {
StringBuilder sb = new StringBuilder();
int index = 0;
for (CounterView counter: ((PermanentView)card).getCounters()) {
if (counter.getCount() > 0) {
if (index == 0) {
sb.append("<b>Counters:</b> ");
} else {
sb.append(", ");
}
sb.append(counter.getCount() + "x<i>" + counter.getName() + "</i>");
index++;
}
}
rulings.add(sb.toString());
}
}
boolean smallImages = true;
int fontSize = 11;