- The number of counters shown on a card is now based on the sum of all counters.

This commit is contained in:
Sloth
2011-10-03 17:04:43 +00:00
parent 4b61355663
commit 30ca292fe1
2 changed files with 18 additions and 11 deletions

View File

@@ -289,17 +289,16 @@ public class CardPanel extends JPanel implements CardContainer {
if (getCard().isPhasedOut())
ManaSymbols.drawSymbol("phasing", g, cardXOffset + cardWidth / 2 - 16, cardYOffset + cardHeight - (cardHeight / 8) - 16);
Map<Counters,Integer> counters = getCard().getCounters();
if (counters != null && !counters.isEmpty()) {
if(counters.containsValue(1)) {
ManaSymbols.drawSymbol("counters1", g, cardXOffset + cardWidth - 65, cardYOffset + cardHeight - (cardHeight / 3) - 40);
} else if(counters.containsValue(2)) {
ManaSymbols.drawSymbol("counters2", g, cardXOffset + cardWidth - 65, cardYOffset + cardHeight - (cardHeight / 3) - 40);
} else if(counters.containsValue(3)) {
ManaSymbols.drawSymbol("counters3", g, cardXOffset + cardWidth - 65, cardYOffset + cardHeight - (cardHeight / 3) - 40);
} else {
ManaSymbols.drawSymbol("countersMulti", g, cardXOffset + cardWidth - 65, cardYOffset + cardHeight - (cardHeight / 3) - 40);
}
int counters = getCard().getNumberOfCounters();
if(counters == 1) {
ManaSymbols.drawSymbol("counters1", g, cardXOffset + cardWidth - 65, cardYOffset + cardHeight - (cardHeight / 3) - 40);
} else if(counters == 2) {
ManaSymbols.drawSymbol("counters2", g, cardXOffset + cardWidth - 65, cardYOffset + cardHeight - (cardHeight / 3) - 40);
} else if(counters == 3) {
ManaSymbols.drawSymbol("counters3", g, cardXOffset + cardWidth - 65, cardYOffset + cardHeight - (cardHeight / 3) - 40);
} else if(counters > 3) {
ManaSymbols.drawSymbol("countersMulti", g, cardXOffset + cardWidth - 65, cardYOffset + cardHeight - (cardHeight / 3) - 40);
}
if (getCard() != null) {

View File

@@ -1014,6 +1014,14 @@ public class Card extends GameEntity implements Comparable<Card> {
public final boolean hasCounters() {
return counters.size() > 0;
}
public final int getNumberOfCounters() {
int number = 0;
for(Integer i : counters.values()) {
number += i.intValue();
}
return number;
}
/**
* <p>setCounter.</p>