- Added a graphic representation of counters.

This commit is contained in:
Sloth
2011-10-03 13:17:41 +00:00
parent 5a3a0fb417
commit 4b61355663
7 changed files with 32 additions and 12 deletions

4
.gitattributes vendored
View File

@@ -9336,6 +9336,10 @@ res/images/symbols-13/X.png -text svneol=unset#image/png
res/images/symbols-13/Y.png -text svneol=unset#image/png res/images/symbols-13/Y.png -text svneol=unset#image/png
res/images/symbols-13/Z.png -text svneol=unset#image/png res/images/symbols-13/Z.png -text svneol=unset#image/png
res/images/symbols-13/attack.png -text svneol=unset#image/png res/images/symbols-13/attack.png -text svneol=unset#image/png
res/images/symbols-13/counters1.png -text
res/images/symbols-13/counters2.png -text
res/images/symbols-13/counters3.png -text
res/images/symbols-13/countersMulti.png -text
res/images/symbols-13/defend.png -text svneol=unset#image/png res/images/symbols-13/defend.png -text svneol=unset#image/png
res/images/symbols-13/foil01.png -text svneol=unset#image/png res/images/symbols-13/foil01.png -text svneol=unset#image/png
res/images/symbols-13/foil02.png -text svneol=unset#image/png res/images/symbols-13/foil02.png -text svneol=unset#image/png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -13,6 +13,7 @@ import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent; import java.awt.event.ComponentEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* <p>CardPanel class.</p> * <p>CardPanel class.</p>
@@ -268,25 +269,40 @@ public class CardPanel extends JPanel implements CardContainer {
super.paintChildren(g); super.paintChildren(g);
boolean canDrawOverCard = showCastingCost && !isAnimationPanel && cardWidth < 200; boolean canDrawOverCard = showCastingCost && !isAnimationPanel && cardWidth < 200;
if (canDrawOverCard) {
int width = ManaSymbols.getWidth(gameCard.getManaCost()); if (!canDrawOverCard)
ManaSymbols.draw(g, gameCard.getManaCost(), cardXOffset + cardWidth / 2 - width / 2, cardYOffset + cardHeight / 2); return;
}
int width = ManaSymbols.getWidth(gameCard.getManaCost());
ManaSymbols.draw(g, gameCard.getManaCost(), cardXOffset + cardWidth / 2 - width / 2, cardYOffset + cardHeight / 2);
//int yOff = (cardHeight/4) + 2; //int yOff = (cardHeight/4) + 2;
if (canDrawOverCard && getCard().isAttacking()) { if (getCard().isAttacking()) {
ManaSymbols.drawSymbol("attack", g, cardXOffset + cardWidth / 4 - 16, cardYOffset + cardHeight - (cardHeight / 8) - 16); ManaSymbols.drawSymbol("attack", g, cardXOffset + cardWidth / 4 - 16, cardYOffset + cardHeight - (cardHeight / 8) - 16);
} else if (canDrawOverCard && getCard().isBlocking()) { } else if (getCard().isBlocking()) {
ManaSymbols.drawSymbol("defend", g, cardXOffset + cardWidth / 4 - 16, cardYOffset + cardHeight - (cardHeight / 8) - 16); ManaSymbols.drawSymbol("defend", g, cardXOffset + cardWidth / 4 - 16, cardYOffset + cardHeight - (cardHeight / 8) - 16);
} }
if (canDrawOverCard && getCard().isCreature() && getCard().hasSickness() && AllZoneUtil.isCardInPlay(getCard())) if (getCard().isCreature() && getCard().hasSickness() && AllZoneUtil.isCardInPlay(getCard()))
ManaSymbols.drawSymbol("summonsick", g, cardXOffset + cardWidth / 2 - 16, cardYOffset + cardHeight - (cardHeight / 8) - 16); ManaSymbols.drawSymbol("summonsick", g, cardXOffset + cardWidth / 2 - 16, cardYOffset + cardHeight - (cardHeight / 8) - 16);
if (canDrawOverCard && getCard().isPhasedOut()) if (getCard().isPhasedOut())
ManaSymbols.drawSymbol("phasing", g, cardXOffset + cardWidth / 2 - 16, cardYOffset + cardHeight - (cardHeight / 8) - 16); ManaSymbols.drawSymbol("phasing", g, cardXOffset + cardWidth / 2 - 16, cardYOffset + cardHeight - (cardHeight / 8) - 16);
if (canDrawOverCard && getCard() != null) { 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);
}
}
if (getCard() != null) {
if (this.gameCard.getFoil() > 0) { if (this.gameCard.getFoil() > 0) {
String fl = String.format("foil%02d", getCard().getFoil()); String fl = String.format("foil%02d", getCard().getFoil());
int z = Math.round(cardWidth * BLACK_BORDER_SIZE); int z = Math.round(cardWidth * BLACK_BORDER_SIZE);
@@ -305,7 +321,7 @@ public class CardPanel extends JPanel implements CardContainer {
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
for (int j = 0; j < 6; j++) { for (int j = 0; j < 6; j++) {
if (!mList[n].equals("")) { if (!mList[n].equals("")) {
int width = ManaSymbols.getWidth(mList[n]); width = ManaSymbols.getWidth(mList[n]);
ManaSymbols.draw(g, mList[n], cardXOffset + ((i + 1) * (cardWidth / 3)) - width / 2, cardYOffset + ((j + 1) * (cardHeight / 7))); ManaSymbols.draw(g, mList[n], cardXOffset + ((i + 1) * (cardWidth / 3)) - width / 2, cardYOffset + ((j + 1) * (cardHeight / 7)));
} }

View File

@@ -28,7 +28,7 @@ public class ManaSymbols {
String[] symbols = new String[]{"0", "1", "10", "11", "12", "15", "16", "2", "20", "2W", "2U", "2R", "2G", "2B", "3", String[] symbols = new String[]{"0", "1", "10", "11", "12", "15", "16", "2", "20", "2W", "2U", "2R", "2G", "2B", "3",
"4", "5", "6", "7", "8", "9", "B", "BG", "BR", "G", "GU", "GW", "R", "RG", "RW", "S", "T", "U", "UB", "4", "5", "6", "7", "8", "9", "B", "BG", "BR", "G", "GU", "GW", "R", "RG", "RW", "S", "T", "U", "UB",
"UR", "W", "WB", "WU", "PW", "PU", "PB", "PR", "PG", "X", "Y", "Z", "slash", "attack", "defend", "summonsick", "UR", "W", "WB", "WU", "PW", "PU", "PB", "PR", "PG", "X", "Y", "Z", "slash", "attack", "defend", "summonsick",
"phasing", "phasing", "counters1", "counters2", "counters3", "countersMulti",
"foil01","foil02","foil03","foil04","foil05","foil06","foil07","foil08","foil09","foil10"}; "foil01","foil02","foil03","foil04","foil05","foil06","foil07","foil08","foil09","foil10"};
for (String symbol : symbols) for (String symbol : symbols)
manaImages.put(symbol, UI.getImageIcon("res/images/symbols-13/" + symbol + ".png").getImage()); manaImages.put(symbol, UI.getImageIcon("res/images/symbols-13/" + symbol + ".png").getImage());