mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Display Ability Icons (Mobile & PC)
This commit is contained in:
@@ -118,6 +118,42 @@ public class CardFaceSymbols {
|
||||
MANA_IMAGES.put("foil18", FSkin.getImage(FSkinProp.FOIL_18));
|
||||
MANA_IMAGES.put("foil19", FSkin.getImage(FSkinProp.FOIL_19));
|
||||
MANA_IMAGES.put("foil20", FSkin.getImage(FSkinProp.FOIL_20));
|
||||
|
||||
//ability icons
|
||||
MANA_IMAGES.put("deathtouch", FSkin.getImage(FSkinProp.IMG_ABILITY_DEATHTOUCH));
|
||||
MANA_IMAGES.put("defender", FSkin.getImage(FSkinProp.IMG_ABILITY_DEFENDER));
|
||||
MANA_IMAGES.put("doublestrike", FSkin.getImage(FSkinProp.IMG_ABILITY_DOUBLE_STRIKE));
|
||||
MANA_IMAGES.put("firststrike", FSkin.getImage(FSkinProp.IMG_ABILITY_FIRST_STRIKE));
|
||||
MANA_IMAGES.put("fear", FSkin.getImage(FSkinProp.IMG_ABILITY_FEAR));
|
||||
MANA_IMAGES.put("flying", FSkin.getImage(FSkinProp.IMG_ABILITY_FLYING));
|
||||
MANA_IMAGES.put("hexproof", FSkin.getImage(FSkinProp.IMG_ABILITY_HEXPROOF));
|
||||
MANA_IMAGES.put("indestructible", FSkin.getImage(FSkinProp.IMG_ABILITY_INDESTRUCTIBLE));
|
||||
MANA_IMAGES.put("intimidate", FSkin.getImage(FSkinProp.IMG_ABILITY_INTIMIDATE));
|
||||
MANA_IMAGES.put("lifelink", FSkin.getImage(FSkinProp.IMG_ABILITY_LIFELINK));
|
||||
MANA_IMAGES.put("menace", FSkin.getImage(FSkinProp.IMG_ABILITY_MENACE));
|
||||
MANA_IMAGES.put("reach", FSkin.getImage(FSkinProp.IMG_ABILITY_REACH));
|
||||
MANA_IMAGES.put("shroud", FSkin.getImage(FSkinProp.IMG_ABILITY_SHROUD));
|
||||
MANA_IMAGES.put("trample", FSkin.getImage(FSkinProp.IMG_ABILITY_TRAMPLE));
|
||||
MANA_IMAGES.put("vigilance", FSkin.getImage(FSkinProp.IMG_ABILITY_VIGILANCE));
|
||||
|
||||
MANA_IMAGES.put("protectAll", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_ALL));
|
||||
MANA_IMAGES.put("protectB", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_B));
|
||||
MANA_IMAGES.put("protectBU", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_BU));
|
||||
MANA_IMAGES.put("protectBW", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_BW));
|
||||
MANA_IMAGES.put("protectColoredSpells", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_COLOREDSPELLS));
|
||||
MANA_IMAGES.put("protectG", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_G));
|
||||
MANA_IMAGES.put("protectGB", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_GB));
|
||||
MANA_IMAGES.put("protectGU", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_GU));
|
||||
MANA_IMAGES.put("protectGW", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_GW));
|
||||
MANA_IMAGES.put("protectGeneric", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_GENERIC));
|
||||
MANA_IMAGES.put("protectR", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_R));
|
||||
MANA_IMAGES.put("protectRB", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_RB));
|
||||
MANA_IMAGES.put("protectRG", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_RG));
|
||||
MANA_IMAGES.put("protectRU", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_RU));
|
||||
MANA_IMAGES.put("protectRW", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_RW));
|
||||
MANA_IMAGES.put("protectU", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_U));
|
||||
MANA_IMAGES.put("protectUW", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_UW));
|
||||
MANA_IMAGES.put("protectW", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_W));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -216,6 +252,9 @@ public class CardFaceSymbols {
|
||||
public static void drawSymbol(final String imageName, final Graphics g, final int x, final int y) {
|
||||
FSkin.drawImage(g, MANA_IMAGES.get(imageName), x, y);
|
||||
}
|
||||
public static void drawAbilitySymbol(final String imageName, final Graphics g, final int x, final int y, final int w, final int h) {
|
||||
FSkin.drawImage(g, MANA_IMAGES.get(imageName), x, y, w, h);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
@@ -1039,7 +1039,7 @@ public class FSkin {
|
||||
private static String preferredDir;
|
||||
private static String preferredName;
|
||||
private static BufferedImage bimDefaultSprite, bimFavIcon, bimPreferredSprite, bimFoils, bimQuestDraftDeck,
|
||||
bimOldFoils, bimDefaultAvatars, bimPreferredAvatars, bimTrophies;
|
||||
bimOldFoils, bimDefaultAvatars, bimPreferredAvatars, bimTrophies, bimAbilities;
|
||||
private static int x0, y0, w0, h0, newW, newH, preferredW, preferredH;
|
||||
private static int[] tempCoords;
|
||||
private static int defaultFontSize = 12;
|
||||
@@ -1171,11 +1171,14 @@ public class FSkin {
|
||||
final File f7 = new File(defaultDir + ForgeConstants.SPRITE_TROPHIES_FILE);
|
||||
final File f8 = new File(defaultDir + ForgeConstants.DRAFT_DECK_IMG_FILE);
|
||||
final File f9 = new File(defaultDir + ForgeConstants.SPRITE_FAVICONS_FILE);
|
||||
final File f10 = new File(defaultDir + ForgeConstants.SPRITE_ABILITY_FILE);
|
||||
|
||||
try {
|
||||
int p = 0;
|
||||
bimDefaultSprite = ImageIO.read(f1);
|
||||
FView.SINGLETON_INSTANCE.incrementSplashProgessBar(++p);
|
||||
bimAbilities = ImageIO.read(f10);
|
||||
FView.SINGLETON_INSTANCE.incrementSplashProgessBar(++p);
|
||||
bimPreferredSprite = ImageIO.read(f2);
|
||||
FView.SINGLETON_INSTANCE.incrementSplashProgessBar(++p);
|
||||
bimFoils = ImageIO.read(f3);
|
||||
@@ -1236,6 +1239,9 @@ public class FSkin {
|
||||
case FAVICON:
|
||||
setImage(prop, bimFavIcon);
|
||||
break;
|
||||
case ABILITY:
|
||||
setImage(prop, bimAbilities);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1256,6 +1262,7 @@ public class FSkin {
|
||||
bimDefaultAvatars.flush();
|
||||
bimQuestDraftDeck.flush();
|
||||
bimTrophies.flush();
|
||||
bimAbilities.flush();
|
||||
|
||||
if (bimPreferredAvatars != null) { bimPreferredAvatars.flush(); }
|
||||
|
||||
@@ -1267,6 +1274,7 @@ public class FSkin {
|
||||
bimPreferredAvatars = null;
|
||||
bimQuestDraftDeck = null;
|
||||
bimTrophies = null;
|
||||
bimAbilities = null;
|
||||
|
||||
//establish encoding symbols
|
||||
final File dir = new File(ForgeConstants.CACHE_SYMBOLS_DIR);
|
||||
|
||||
@@ -28,6 +28,7 @@ import forge.game.card.CardView;
|
||||
import forge.game.card.CardView.CardStateView;
|
||||
import forge.game.keyword.Keyword;
|
||||
import forge.game.card.CounterType;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.gui.CardContainer;
|
||||
import forge.item.PaperCard;
|
||||
import forge.model.FModel;
|
||||
@@ -504,6 +505,149 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
(cardYOffset + (cardHeight / 2)) - 20);
|
||||
}
|
||||
|
||||
//Ability Icons
|
||||
|
||||
int abiScale = cardWidth / 7;
|
||||
int abiX = cardXOffset + (cardWidth / 2) + (cardWidth / 3);
|
||||
int abiSpace = (cardWidth / 7);
|
||||
int abiY = cardWidth < 200 ? cardYOffset + 25 : cardYOffset + 50;
|
||||
if (card.getZone().equals(ZoneType.Battlefield)){
|
||||
if (card.getCurrentState().hasFlying()) {
|
||||
CardFaceSymbols.drawAbilitySymbol("flying", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
if (card.getCurrentState().hasDoubleStrike()) {
|
||||
CardFaceSymbols.drawAbilitySymbol("doublestrike", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
else if (card.getCurrentState().hasFirstStrike()) {
|
||||
CardFaceSymbols.drawAbilitySymbol("firststrike", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
if (card.getCurrentState().hasDeathtouch()) {
|
||||
CardFaceSymbols.drawAbilitySymbol("deathtouch", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
if (card.getCurrentState().hasIndestructible()) {
|
||||
CardFaceSymbols.drawAbilitySymbol("indestructible", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
if (card.getCurrentState().hasMenace()) {
|
||||
CardFaceSymbols.drawAbilitySymbol("menace", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
if (card.getCurrentState().hasFear()) {
|
||||
CardFaceSymbols.drawAbilitySymbol("fear", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
if (card.getCurrentState().hasIntimidate()) {
|
||||
CardFaceSymbols.drawAbilitySymbol("intimidate", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
if (card.getCurrentState().hasHexproof()) {
|
||||
CardFaceSymbols.drawAbilitySymbol("hexproof", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
if (card.getCurrentState().hasShroud()) {
|
||||
CardFaceSymbols.drawAbilitySymbol("shroud", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
if (card.getCurrentState().hasVigilance()) {
|
||||
CardFaceSymbols.drawAbilitySymbol("vigilance", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
if (card.getCurrentState().hasTrample()) {
|
||||
CardFaceSymbols.drawAbilitySymbol("trample", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
if (card.getCurrentState().hasReach()) {
|
||||
CardFaceSymbols.drawAbilitySymbol("reach", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
if (card.getCurrentState().hasLifelink()) {
|
||||
CardFaceSymbols.drawAbilitySymbol("lifelink", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
if (card.getCurrentState().hasDefender()) {
|
||||
CardFaceSymbols.drawAbilitySymbol("defender", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
//protection icons
|
||||
if (!card.getCurrentState().getProtectionKey().isEmpty()){
|
||||
if (card.getCurrentState().getProtectionKey().contains("everything") || card.getCurrentState().getProtectionKey().contains("allcolors")) {
|
||||
CardFaceSymbols.drawAbilitySymbol("protectAll", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
else if (card.getCurrentState().getProtectionKey().contains("coloredspells")) {
|
||||
CardFaceSymbols.drawAbilitySymbol("protectColoredSpells", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
else if (card.getCurrentState().getProtectionKey().equals("R")) {
|
||||
CardFaceSymbols.drawAbilitySymbol("protectR", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
else if (card.getCurrentState().getProtectionKey().equals("G")) {
|
||||
CardFaceSymbols.drawAbilitySymbol("protectG", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
else if (card.getCurrentState().getProtectionKey().equals("B")) {
|
||||
CardFaceSymbols.drawAbilitySymbol("protectB", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
else if (card.getCurrentState().getProtectionKey().equals("U")) {
|
||||
CardFaceSymbols.drawAbilitySymbol("protectU", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
else if (card.getCurrentState().getProtectionKey().equals("W")) {
|
||||
CardFaceSymbols.drawAbilitySymbol("protectW", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
else if (card.getCurrentState().getProtectionKey().equals("RG")||card.getCurrentState().getProtectionKey().equals("GR")) {
|
||||
CardFaceSymbols.drawAbilitySymbol("protectRG", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
else if (card.getCurrentState().getProtectionKey().equals("RB")||card.getCurrentState().getProtectionKey().equals("BR")) {
|
||||
CardFaceSymbols.drawAbilitySymbol("protectRB", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
else if (card.getCurrentState().getProtectionKey().equals("RU")||card.getCurrentState().getProtectionKey().equals("UR")) {
|
||||
CardFaceSymbols.drawAbilitySymbol("protectRU", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
else if (card.getCurrentState().getProtectionKey().equals("RW")||card.getCurrentState().getProtectionKey().equals("WR")) {
|
||||
CardFaceSymbols.drawAbilitySymbol("protectRW", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
else if (card.getCurrentState().getProtectionKey().equals("GB")||card.getCurrentState().getProtectionKey().equals("BG")) {
|
||||
CardFaceSymbols.drawAbilitySymbol("protectGB", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
else if (card.getCurrentState().getProtectionKey().equals("GU")||card.getCurrentState().getProtectionKey().equals("UG")) {
|
||||
CardFaceSymbols.drawAbilitySymbol("protectGU", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
else if (card.getCurrentState().getProtectionKey().equals("GW")||card.getCurrentState().getProtectionKey().equals("WG")) {
|
||||
CardFaceSymbols.drawAbilitySymbol("protectGW", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
else if (card.getCurrentState().getProtectionKey().equals("BU")||card.getCurrentState().getProtectionKey().equals("UB")) {
|
||||
CardFaceSymbols.drawAbilitySymbol("protectBU", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
else if (card.getCurrentState().getProtectionKey().equals("BW")||card.getCurrentState().getProtectionKey().equals("WB")) {
|
||||
CardFaceSymbols.drawAbilitySymbol("protectBW", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
else if (card.getCurrentState().getProtectionKey().equals("UW")||card.getCurrentState().getProtectionKey().equals("WU")) {
|
||||
CardFaceSymbols.drawAbilitySymbol("protectUW", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
else if (card.getCurrentState().getProtectionKey().contains("generic") || card.getCurrentState().getProtectionKey().length() > 2) {
|
||||
CardFaceSymbols.drawAbilitySymbol("protectGeneric", g, abiX, abiY, abiScale, abiScale);
|
||||
abiY += abiSpace;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void drawCounterTabs(final Graphics g) {
|
||||
|
||||
Reference in New Issue
Block a user