diff --git a/forge-game/src/main/java/forge/game/card/Card.java b/forge-game/src/main/java/forge/game/card/Card.java index 03476d73b88..f1925b5d307 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -5358,7 +5358,63 @@ public class Card extends GameEntity implements Comparable { } return false; } - + public String getProtectionKey() { + String protectKey = ""; + boolean pR = false; boolean pG = false; boolean pB = false; boolean pU = false; boolean pW = false; + for (final KeywordInterface inst : getKeywords()) { + String kw = inst.getOriginal(); + if (!kw.startsWith("Protection")) { + continue; + } + if (kw.equals("Protection from red")) { + if (!pR) { + pR = true; + protectKey += "R"; + } + } else if (kw.equals("Protection from green")) { + if (!pG) { + pG = true; + protectKey += "G"; + } + } else if (kw.equals("Protection from black")) { + if (!pB) { + pB = true; + protectKey += "B"; + } + } else if (kw.equals("Protection from blue")) { + if (!pU) { + pU = true; + protectKey += "U"; + } + } else if (kw.equals("Protection from white")) { + if (!pW) { + pW = true; + protectKey += "W"; + } + } else if (kw.equals("Protection from monocolored")) { + protectKey += "monocolored:"; + } else if (kw.equals("Protection from multicolored")) { + protectKey += "multicolored:"; + } else if (kw.equals("Protection from all colors")) { + protectKey += "allcolors:"; + } else if (kw.equals("Protection from colorless")) { + protectKey += "colorless:"; + } else if (kw.equals("Protection from creatures")) { + protectKey += "creatures:"; + } else if (kw.equals("Protection from artifacts")) { + protectKey += "artifacts:"; + } else if (kw.equals("Protection from enchantments")) { + protectKey += "enchantments:"; + } else if (kw.equals("Protection from everything")) { + protectKey += "everything:"; + } else if (kw.equals("Protection from colored spells")) { + protectKey += "coloredspells:"; + } else if (kw.startsWith("Protection")) { + protectKey += "generic"; + } + } + return protectKey; + } public Zone getZone() { return currentZone; } diff --git a/forge-game/src/main/java/forge/game/card/CardUtil.java b/forge-game/src/main/java/forge/game/card/CardUtil.java index 82a306157e0..7d1a508062d 100644 --- a/forge-game/src/main/java/forge/game/card/CardUtil.java +++ b/forge-game/src/main/java/forge/game/card/CardUtil.java @@ -248,7 +248,7 @@ public final class CardUtil { } for (Trigger tr : in.getTriggers()) { if (!tr.isIntrinsic()) { - newCopy.addTrigger(tr.copy(newCopy, true)); + newCopy.moveTrigger(tr.copy(newCopy, true)); } } for (ReplacementEffect re : in.getReplacementEffects()) { diff --git a/forge-game/src/main/java/forge/game/card/CardView.java b/forge-game/src/main/java/forge/game/card/CardView.java index 53911856989..c79b9543771 100644 --- a/forge-game/src/main/java/forge/game/card/CardView.java +++ b/forge-game/src/main/java/forge/game/card/CardView.java @@ -1017,9 +1017,27 @@ public class CardView extends GameEntityView { foilIndexOverride = index0; } - public boolean hasDeathtouch() { - return get(TrackableProperty.HasDeathtouch); + public String getProtectionKey() { return get(TrackableProperty.ProtectionKey); } + public boolean hasDeathtouch() { return get(TrackableProperty.HasDeathtouch); } + public boolean hasDefender() { return get(TrackableProperty.HasDefender); } + public boolean hasDoubleStrike() { return get(TrackableProperty.HasDoubleStrike); } + public boolean hasFirstStrike() { return get(TrackableProperty.HasFirstStrike); } + public boolean hasFlying() { return get(TrackableProperty.HasFlying); } + public boolean hasFear() { return get(TrackableProperty.HasFear); } + public boolean hasHexproof() { return get(TrackableProperty.HasHexproof); } + public boolean hasIndestructible() { return get(TrackableProperty.HasIndestructible); } + public boolean hasIntimidate() { return get(TrackableProperty.HasIntimidate); } + public boolean hasLifelink() { return get(TrackableProperty.HasLifelink); } + public boolean hasMenace() { return get(TrackableProperty.HasMenace); } + public boolean hasReach() { return get(TrackableProperty.HasReach); } + public boolean hasShroud() { return get(TrackableProperty.HasShroud); } + public boolean hasTrample() { + return get(TrackableProperty.HasTrample); } + public boolean hasVigilance() { + return get(TrackableProperty.HasVigilance); + } + public boolean hasHaste() { return get(TrackableProperty.HasHaste); } @@ -1029,9 +1047,6 @@ public class CardView extends GameEntityView { public boolean hasStorm() { return get(TrackableProperty.HasStorm); } - public boolean hasTrample() { - return get(TrackableProperty.HasTrample); - } public String getAbilityText() { return get(TrackableProperty.AbilityText); @@ -1042,11 +1057,26 @@ public class CardView extends GameEntityView { void updateKeywords(Card c, CardState state) { c.updateKeywordsCache(state); set(TrackableProperty.HasDeathtouch, c.hasKeyword(Keyword.DEATHTOUCH, state)); + set(TrackableProperty.HasDefender, c.hasKeyword(Keyword.DEFENDER, state)); + set(TrackableProperty.HasDoubleStrike, c.hasKeyword(Keyword.DOUBLE_STRIKE, state)); + set(TrackableProperty.HasFirstStrike, c.hasKeyword(Keyword.FIRST_STRIKE, state)); + set(TrackableProperty.HasFlying, c.hasKeyword(Keyword.FLYING, state)); + set(TrackableProperty.HasFear, c.hasKeyword(Keyword.FEAR, state)); + set(TrackableProperty.HasHexproof, c.hasKeyword(Keyword.HEXPROOF, state)); + set(TrackableProperty.HasIndestructible, c.hasKeyword(Keyword.INDESTRUCTIBLE, state)); + set(TrackableProperty.HasIntimidate, c.hasKeyword(Keyword.INTIMIDATE, state)); + set(TrackableProperty.HasLifelink, c.hasKeyword(Keyword.LIFELINK, state)); + set(TrackableProperty.HasMenace, c.hasKeyword(Keyword.MENACE, state)); + set(TrackableProperty.HasReach, c.hasKeyword(Keyword.REACH, state)); + set(TrackableProperty.HasShroud, c.hasKeyword(Keyword.SHROUD, state)); + set(TrackableProperty.HasTrample, c.hasKeyword(Keyword.TRAMPLE, state)); + set(TrackableProperty.HasVigilance, c.hasKeyword(Keyword.VIGILANCE, state)); set(TrackableProperty.HasHaste, c.hasKeyword(Keyword.HASTE, state)); set(TrackableProperty.HasInfect, c.hasKeyword(Keyword.INFECT, state)); set(TrackableProperty.HasStorm, c.hasKeyword(Keyword.STORM, state)); - set(TrackableProperty.HasTrample, c.hasKeyword(Keyword.TRAMPLE, state)); updateAbilityText(c, state); + //set protectionKey for Icons + set(TrackableProperty.ProtectionKey, c.getProtectionKey()); } public boolean isBasicLand() { diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerChangesZone.java b/forge-game/src/main/java/forge/game/trigger/TriggerChangesZone.java index 101391ef657..145844de49d 100644 --- a/forge-game/src/main/java/forge/game/trigger/TriggerChangesZone.java +++ b/forge-game/src/main/java/forge/game/trigger/TriggerChangesZone.java @@ -113,12 +113,6 @@ public class TriggerChangesZone extends Trigger { getHostCard(), null)) { return false; } - - // if it is a die trigger, and the hostcard is the moved one, but it doesn't has the trigger - // only for non-static - if (!isStatic() && leavesBattlefield && moved.equals(getHostCard()) && !moved.hasTrigger(this)) { - return false; - } } if (hasParam("ValidCause")) { diff --git a/forge-game/src/main/java/forge/trackable/TrackableProperty.java b/forge-game/src/main/java/forge/trackable/TrackableProperty.java index 2275f87a4d4..e85733c4ff1 100644 --- a/forge-game/src/main/java/forge/trackable/TrackableProperty.java +++ b/forge-game/src/main/java/forge/trackable/TrackableProperty.java @@ -81,11 +81,28 @@ public enum TrackableProperty { Loyalty(TrackableTypes.StringType), ChangedColorWords(TrackableTypes.StringMapType), ChangedTypes(TrackableTypes.StringMapType), + HasDeathtouch(TrackableTypes.BooleanType), + HasDefender(TrackableTypes.BooleanType), + HasDoubleStrike(TrackableTypes.BooleanType), + HasFirstStrike(TrackableTypes.BooleanType), + HasFlying(TrackableTypes.BooleanType), + HasFear(TrackableTypes.BooleanType), + HasHexproof(TrackableTypes.BooleanType), + HasIndestructible(TrackableTypes.BooleanType), + HasIntimidate(TrackableTypes.BooleanType), + HasLifelink(TrackableTypes.BooleanType), + HasMenace(TrackableTypes.BooleanType), + HasReach(TrackableTypes.BooleanType), + HasShroud(TrackableTypes.BooleanType), + HasTrample(TrackableTypes.BooleanType), + HasVigilance(TrackableTypes.BooleanType), + //protectionkey + ProtectionKey(TrackableTypes.StringType), + HasHaste(TrackableTypes.BooleanType), HasInfect(TrackableTypes.BooleanType), HasStorm(TrackableTypes.BooleanType), - HasTrample(TrackableTypes.BooleanType), YouMayLook(TrackableTypes.BooleanType), OpponentMayLook(TrackableTypes.BooleanType), BlockAdditional(TrackableTypes.IntegerType), diff --git a/forge-gui-desktop/src/main/java/forge/toolbox/CardFaceSymbols.java b/forge-gui-desktop/src/main/java/forge/toolbox/CardFaceSymbols.java index 29f75a6f473..94cf340578c 100644 --- a/forge-gui-desktop/src/main/java/forge/toolbox/CardFaceSymbols.java +++ b/forge-gui-desktop/src/main/java/forge/toolbox/CardFaceSymbols.java @@ -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); + } /** *

diff --git a/forge-gui-desktop/src/main/java/forge/toolbox/FSkin.java b/forge-gui-desktop/src/main/java/forge/toolbox/FSkin.java index ac6df8f4c47..2782bda17f2 100644 --- a/forge-gui-desktop/src/main/java/forge/toolbox/FSkin.java +++ b/forge-gui-desktop/src/main/java/forge/toolbox/FSkin.java @@ -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); diff --git a/forge-gui-desktop/src/main/java/forge/view/arcane/CardPanel.java b/forge-gui-desktop/src/main/java/forge/view/arcane/CardPanel.java index 18b8341e6a0..70e949ef109 100644 --- a/forge-gui-desktop/src/main/java/forge/view/arcane/CardPanel.java +++ b/forge-gui-desktop/src/main/java/forge/view/arcane/CardPanel.java @@ -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) { diff --git a/forge-gui-mobile/src/forge/assets/FSkinImage.java b/forge-gui-mobile/src/forge/assets/FSkinImage.java index 8428693461e..3d336c12bfd 100644 --- a/forge-gui-mobile/src/forge/assets/FSkinImage.java +++ b/forge-gui-mobile/src/forge/assets/FSkinImage.java @@ -250,13 +250,50 @@ public enum FSkinImage implements FImage { FOIL_17 (FSkinProp.FOIL_17, SourceFile.OLD_FOILS), FOIL_18 (FSkinProp.FOIL_18, SourceFile.OLD_FOILS), FOIL_19 (FSkinProp.FOIL_19, SourceFile.OLD_FOILS), - FOIL_20 (FSkinProp.FOIL_20, SourceFile.OLD_FOILS); + FOIL_20 (FSkinProp.FOIL_20, SourceFile.OLD_FOILS), + + //ABILITY ICONS + IMG_ABILITY_DEATHTOUCH (FSkinProp.IMG_ABILITY_DEATHTOUCH, SourceFile.ABILITIES), + IMG_ABILITY_DEFENDER (FSkinProp.IMG_ABILITY_DEFENDER, SourceFile.ABILITIES), + IMG_ABILITY_DOUBLE_STRIKE (FSkinProp.IMG_ABILITY_DOUBLE_STRIKE, SourceFile.ABILITIES), + IMG_ABILITY_FIRST_STRIKE (FSkinProp.IMG_ABILITY_FIRST_STRIKE, SourceFile.ABILITIES), + IMG_ABILITY_FEAR (FSkinProp.IMG_ABILITY_FEAR, SourceFile.ABILITIES), + IMG_ABILITY_FLYING (FSkinProp.IMG_ABILITY_FLYING, SourceFile.ABILITIES), + IMG_ABILITY_HEXPROOF (FSkinProp.IMG_ABILITY_HEXPROOF, SourceFile.ABILITIES), + IMG_ABILITY_INDESTRUCTIBLE (FSkinProp.IMG_ABILITY_INDESTRUCTIBLE, SourceFile.ABILITIES), + IMG_ABILITY_INTIMIDATE (FSkinProp.IMG_ABILITY_INTIMIDATE, SourceFile.ABILITIES), + IMG_ABILITY_LIFELINK (FSkinProp.IMG_ABILITY_LIFELINK, SourceFile.ABILITIES), + IMG_ABILITY_MENACE (FSkinProp.IMG_ABILITY_MENACE, SourceFile.ABILITIES), + IMG_ABILITY_REACH (FSkinProp.IMG_ABILITY_REACH, SourceFile.ABILITIES), + IMG_ABILITY_SHROUD (FSkinProp.IMG_ABILITY_SHROUD, SourceFile.ABILITIES), + IMG_ABILITY_TRAMPLE (FSkinProp.IMG_ABILITY_TRAMPLE, SourceFile.ABILITIES), + IMG_ABILITY_VIGILANCE (FSkinProp.IMG_ABILITY_VIGILANCE, SourceFile.ABILITIES), + //PROTECT ICONS + IMG_ABILITY_PROTECT_ALL (FSkinProp.IMG_ABILITY_PROTECT_ALL, SourceFile.ABILITIES), + IMG_ABILITY_PROTECT_B (FSkinProp.IMG_ABILITY_PROTECT_B, SourceFile.ABILITIES), + IMG_ABILITY_PROTECT_BU (FSkinProp.IMG_ABILITY_PROTECT_BU, SourceFile.ABILITIES), + IMG_ABILITY_PROTECT_BW (FSkinProp.IMG_ABILITY_PROTECT_BW, SourceFile.ABILITIES), + IMG_ABILITY_PROTECT_COLOREDSPELLS (FSkinProp.IMG_ABILITY_PROTECT_COLOREDSPELLS, SourceFile.ABILITIES), + IMG_ABILITY_PROTECT_G (FSkinProp.IMG_ABILITY_PROTECT_G, SourceFile.ABILITIES), + IMG_ABILITY_PROTECT_GB (FSkinProp.IMG_ABILITY_PROTECT_GB, SourceFile.ABILITIES), + IMG_ABILITY_PROTECT_GU (FSkinProp.IMG_ABILITY_PROTECT_GU, SourceFile.ABILITIES), + IMG_ABILITY_PROTECT_GW (FSkinProp.IMG_ABILITY_PROTECT_GW, SourceFile.ABILITIES), + IMG_ABILITY_PROTECT_GENERIC (FSkinProp.IMG_ABILITY_PROTECT_GENERIC, SourceFile.ABILITIES), + IMG_ABILITY_PROTECT_R (FSkinProp.IMG_ABILITY_PROTECT_R, SourceFile.ABILITIES), + IMG_ABILITY_PROTECT_RB (FSkinProp.IMG_ABILITY_PROTECT_RB, SourceFile.ABILITIES), + IMG_ABILITY_PROTECT_RG (FSkinProp.IMG_ABILITY_PROTECT_RG, SourceFile.ABILITIES), + IMG_ABILITY_PROTECT_RU (FSkinProp.IMG_ABILITY_PROTECT_RU, SourceFile.ABILITIES), + IMG_ABILITY_PROTECT_RW (FSkinProp.IMG_ABILITY_PROTECT_RW, SourceFile.ABILITIES), + IMG_ABILITY_PROTECT_U (FSkinProp.IMG_ABILITY_PROTECT_U, SourceFile.ABILITIES), + IMG_ABILITY_PROTECT_UW (FSkinProp.IMG_ABILITY_PROTECT_UW, SourceFile.ABILITIES), + IMG_ABILITY_PROTECT_W (FSkinProp.IMG_ABILITY_PROTECT_W, SourceFile.ABILITIES); public enum SourceFile { ICONS(ForgeConstants.SPRITE_ICONS_FILE), FOILS(ForgeConstants.SPRITE_FOILS_FILE), OLD_FOILS(ForgeConstants.SPRITE_OLD_FOILS_FILE), TROPHIES(ForgeConstants.SPRITE_TROPHIES_FILE), + ABILITIES(ForgeConstants.SPRITE_ABILITY_FILE), PLANAR_CONQUEST(ForgeConstants.SPRITE_PLANAR_CONQUEST_FILE); private final String filename; diff --git a/forge-gui-mobile/src/forge/card/CardFaceSymbols.java b/forge-gui-mobile/src/forge/card/CardFaceSymbols.java index 7a86a49966f..d53f70aa5b6 100644 --- a/forge-gui-mobile/src/forge/card/CardFaceSymbols.java +++ b/forge-gui-mobile/src/forge/card/CardFaceSymbols.java @@ -101,6 +101,42 @@ public class CardFaceSymbols { MANA_IMAGES.put("foil18", FSkinImage.FOIL_18); MANA_IMAGES.put("foil19", FSkinImage.FOIL_19); MANA_IMAGES.put("foil20", FSkinImage.FOIL_20); + + + MANA_IMAGES.put("deathtouch", FSkinImage.IMG_ABILITY_DEATHTOUCH); + MANA_IMAGES.put("defender", FSkinImage.IMG_ABILITY_DEFENDER); + MANA_IMAGES.put("doublestrike", FSkinImage.IMG_ABILITY_DOUBLE_STRIKE); + MANA_IMAGES.put("firststrike", FSkinImage.IMG_ABILITY_FIRST_STRIKE); + MANA_IMAGES.put("fear", FSkinImage.IMG_ABILITY_FEAR); + MANA_IMAGES.put("flying", FSkinImage.IMG_ABILITY_FLYING); + MANA_IMAGES.put("hexproof", FSkinImage.IMG_ABILITY_HEXPROOF); + MANA_IMAGES.put("indestructible", FSkinImage.IMG_ABILITY_INDESTRUCTIBLE); + MANA_IMAGES.put("intimidate", FSkinImage.IMG_ABILITY_INTIMIDATE); + MANA_IMAGES.put("lifelink", FSkinImage.IMG_ABILITY_LIFELINK); + MANA_IMAGES.put("menace", FSkinImage.IMG_ABILITY_MENACE); + MANA_IMAGES.put("reach", FSkinImage.IMG_ABILITY_REACH); + MANA_IMAGES.put("shroud", FSkinImage.IMG_ABILITY_SHROUD); + MANA_IMAGES.put("trample", FSkinImage.IMG_ABILITY_TRAMPLE); + MANA_IMAGES.put("vigilance", FSkinImage.IMG_ABILITY_VIGILANCE); + + MANA_IMAGES.put("protectAll", FSkinImage.IMG_ABILITY_PROTECT_ALL); + MANA_IMAGES.put("protectB", FSkinImage.IMG_ABILITY_PROTECT_B); + MANA_IMAGES.put("protectBU", FSkinImage.IMG_ABILITY_PROTECT_BU); + MANA_IMAGES.put("protectBW", FSkinImage.IMG_ABILITY_PROTECT_BW); + MANA_IMAGES.put("protectColoredSpells", FSkinImage.IMG_ABILITY_PROTECT_COLOREDSPELLS); + MANA_IMAGES.put("protectG", FSkinImage.IMG_ABILITY_PROTECT_G); + MANA_IMAGES.put("protectGB", FSkinImage.IMG_ABILITY_PROTECT_GB); + MANA_IMAGES.put("protectGU", FSkinImage.IMG_ABILITY_PROTECT_GU); + MANA_IMAGES.put("protectGW", FSkinImage.IMG_ABILITY_PROTECT_GW); + MANA_IMAGES.put("protectGeneric", FSkinImage.IMG_ABILITY_PROTECT_GENERIC); + MANA_IMAGES.put("protectR", FSkinImage.IMG_ABILITY_PROTECT_R); + MANA_IMAGES.put("protectRB", FSkinImage.IMG_ABILITY_PROTECT_RB); + MANA_IMAGES.put("protectRG", FSkinImage.IMG_ABILITY_PROTECT_RG); + MANA_IMAGES.put("protectRU", FSkinImage.IMG_ABILITY_PROTECT_RU); + MANA_IMAGES.put("protectRW", FSkinImage.IMG_ABILITY_PROTECT_RW); + MANA_IMAGES.put("protectU", FSkinImage.IMG_ABILITY_PROTECT_U); + MANA_IMAGES.put("protectUW", FSkinImage.IMG_ABILITY_PROTECT_UW); + MANA_IMAGES.put("protectW", FSkinImage.IMG_ABILITY_PROTECT_W); } public static void drawManaCost(Graphics g, ManaCost manaCost, float x, float y, final float imageSize) { diff --git a/forge-gui-mobile/src/forge/card/CardRenderer.java b/forge-gui-mobile/src/forge/card/CardRenderer.java index f92e109f127..ee265562c28 100644 --- a/forge-gui-mobile/src/forge/card/CardRenderer.java +++ b/forge-gui-mobile/src/forge/card/CardRenderer.java @@ -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.item.IPaperCard; import forge.item.InventoryItem; import forge.item.PaperCard; @@ -439,6 +440,8 @@ public class CardRenderer { h -= 2 * padding; boolean canShow = MatchController.instance.mayView(card); + float oldAlpha = g.getfloatAlphaComposite(); + boolean unselectable = !MatchController.instance.isSelectable(card) && MatchController.instance.isSelecting(); // TODO: A hacky workaround is currently used to make the game not leak the color information for Morph cards. final CardStateView details = card.getCurrentState(); @@ -450,10 +453,10 @@ public class CardRenderer { //draw name and mana cost overlays if card is small or default card image being used if (h <= NAME_COST_THRESHOLD && canShow) { if (showCardNameOverlay(card)) { - g.drawOutlinedText(CardTranslation.getTranslatedName(details.getName()), FSkinFont.forHeight(h * 0.18f), Color.WHITE, Color.BLACK, x + padding, y + padding, w - 2 * padding, h * 0.4f, true, Align.left, false); + g.drawOutlinedText(CardTranslation.getTranslatedName(details.getName()), FSkinFont.forHeight(h * 0.15f), Color.WHITE, Color.BLACK, x + padding -1f, y + padding, w - 2 * padding, h * 0.4f, true, Align.left, false); } if (showCardManaCostOverlay(card)) { - float manaSymbolSize = w / 4; + float manaSymbolSize = w / 4.5f; if (card.isSplitCard() && card.hasAlternateState()) { if (!card.isFaceDown()) { // no need to draw mana symbols on face down split cards (e.g. manifested) float dy = manaSymbolSize / 2 + Utils.scale(5); @@ -477,7 +480,7 @@ public class CardRenderer { boolean onTop = (pos == CardStackPosition.Top); if (canShow && showCardIdOverlay(card)) { - FSkinFont idFont = FSkinFont.forHeight(h * 0.12f); + FSkinFont idFont = FSkinFont.forHeight(h * 0.11f); float idHeight = idFont.getCapHeight(); g.drawOutlinedText(String.valueOf(card.getId()), idFont, Color.WHITE, Color.BLACK, x + padding, y + h - idHeight - padding, w, h, false, Align.left, false); } @@ -500,7 +503,7 @@ public class CardRenderer { } - float otherSymbolsSize = w / 3.5f; + float otherSymbolsSize = w / 4f; final float combatXSymbols = (x + (w / 4)) - otherSymbolsSize / 2 - 10; final float stateXSymbols = (x + (w / 2)) - otherSymbolsSize / 2 - 10; final float ySymbols = (y + h) - (h / 12) - otherSymbolsSize / 2; @@ -530,18 +533,261 @@ public class CardRenderer { //only needed if on top since otherwise P/T will be hidden drawPtBox(g, card, details, color, x, y, w, h); } - - float oldAlpha = g.getfloatAlphaComposite(); //Darken unselectable cards - if(!MatchController.instance.isSelectable(card) && MatchController.instance.isSelecting()){ + if (unselectable){ g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, cx, cy, cw, ch); g.setAlphaComposite(oldAlpha); } //Magenta outline when card is chosen - if(MatchController.instance.isUsedToPay(card)){ + if (MatchController.instance.isUsedToPay(card)){ g.drawRect(BORDER_THICKNESS, Color.MAGENTA, cx, cy, cw, ch); } + //Ability Icons + boolean onbattlefield = card.getZone().equals(ZoneType.Battlefield); + float abiY = cy; + float abiX = cx + ((cw*2)/2.3f); + float abiScale = cw / 5.5f; + float abiSpace = cw / 5.7f; + float abiCount = 0; + + if (onbattlefield && onTop) { + if (card.getCurrentState().hasFlying()) { + CardFaceSymbols.drawSymbol("flying", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + if (card.getCurrentState().hasDoubleStrike()) { + CardFaceSymbols.drawSymbol("doublestrike", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + else if (card.getCurrentState().hasFirstStrike()) { + CardFaceSymbols.drawSymbol("firststrike", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + if (card.getCurrentState().hasDeathtouch()) { + CardFaceSymbols.drawSymbol("deathtouch", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + if (card.getCurrentState().hasIndestructible()) { + CardFaceSymbols.drawSymbol("indestructible", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + if (card.getCurrentState().hasMenace()) { + CardFaceSymbols.drawSymbol("menace", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + if (card.getCurrentState().hasFear()) { + CardFaceSymbols.drawSymbol("fear", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + if (card.getCurrentState().hasIntimidate()) { + CardFaceSymbols.drawSymbol("intimidate", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + if (card.getCurrentState().hasHexproof()) { + CardFaceSymbols.drawSymbol("hexproof", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + else if (card.getCurrentState().hasShroud()) { + CardFaceSymbols.drawSymbol("shroud", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + if (card.getCurrentState().hasVigilance()) { + CardFaceSymbols.drawSymbol("vigilance", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + //TODO: If ability icons is more than 7 where to put??? + if (card.getCurrentState().hasTrample()) { + CardFaceSymbols.drawSymbol("trample", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + if (card.getCurrentState().hasReach()) { + CardFaceSymbols.drawSymbol("reach", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + if (card.getCurrentState().hasLifelink()) { + CardFaceSymbols.drawSymbol("lifelink", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + if (card.getCurrentState().hasDefender()) { + CardFaceSymbols.drawSymbol("defender", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + //Protection Icons + if (!card.getCurrentState().getProtectionKey().isEmpty()){ + if (card.getCurrentState().getProtectionKey().contains("everything") || card.getCurrentState().getProtectionKey().contains("allcolors")) { + CardFaceSymbols.drawSymbol("protectAll", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + else if (card.getCurrentState().getProtectionKey().contains("coloredspells")) { + CardFaceSymbols.drawSymbol("protectColoredSpells", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + else if (card.getCurrentState().getProtectionKey().equals("R")) { + CardFaceSymbols.drawSymbol("protectR", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + else if (card.getCurrentState().getProtectionKey().equals("G")) { + CardFaceSymbols.drawSymbol("protectG", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + else if (card.getCurrentState().getProtectionKey().equals("B")) { + CardFaceSymbols.drawSymbol("protectB", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + else if (card.getCurrentState().getProtectionKey().equals("U")) { + CardFaceSymbols.drawSymbol("protectU", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + else if (card.getCurrentState().getProtectionKey().equals("W")) { + CardFaceSymbols.drawSymbol("protectW", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + else if (card.getCurrentState().getProtectionKey().equals("RG")||card.getCurrentState().getProtectionKey().equals("GR")) { + CardFaceSymbols.drawSymbol("protectRG", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + else if (card.getCurrentState().getProtectionKey().equals("RB")||card.getCurrentState().getProtectionKey().equals("BR")) { + CardFaceSymbols.drawSymbol("protectRB", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + else if (card.getCurrentState().getProtectionKey().equals("RU")||card.getCurrentState().getProtectionKey().equals("UR")) { + CardFaceSymbols.drawSymbol("protectRU", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + else if (card.getCurrentState().getProtectionKey().equals("RW")||card.getCurrentState().getProtectionKey().equals("WR")) { + CardFaceSymbols.drawSymbol("protectRW", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + else if (card.getCurrentState().getProtectionKey().equals("GB")||card.getCurrentState().getProtectionKey().equals("BG")) { + CardFaceSymbols.drawSymbol("protectGB", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + else if (card.getCurrentState().getProtectionKey().equals("GU")||card.getCurrentState().getProtectionKey().equals("UG")) { + CardFaceSymbols.drawSymbol("protectGU", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + else if (card.getCurrentState().getProtectionKey().equals("GW")||card.getCurrentState().getProtectionKey().equals("WG")) { + CardFaceSymbols.drawSymbol("protectGW", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + else if (card.getCurrentState().getProtectionKey().equals("BU")||card.getCurrentState().getProtectionKey().equals("UB")) { + CardFaceSymbols.drawSymbol("protectBU", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + else if (card.getCurrentState().getProtectionKey().equals("BW")||card.getCurrentState().getProtectionKey().equals("WB")) { + CardFaceSymbols.drawSymbol("protectBW", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + else if (card.getCurrentState().getProtectionKey().equals("UW")||card.getCurrentState().getProtectionKey().equals("WU")) { + CardFaceSymbols.drawSymbol("protectUW", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + else if (card.getCurrentState().getProtectionKey().contains("generic") || card.getCurrentState().getProtectionKey().length() > 2) { + CardFaceSymbols.drawSymbol("protectGeneric", g, abiX, abiY, abiScale, abiScale); + if (unselectable){ + g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} + abiY += abiSpace; + abiCount += 1; + } + } + } } private static void drawCounterTabs(final CardView card, final Graphics g, final float x, final float y, final float w, final float h) { diff --git a/forge-gui/res/skins/default/sprite_ability.png b/forge-gui/res/skins/default/sprite_ability.png new file mode 100644 index 00000000000..f8691939a06 Binary files /dev/null and b/forge-gui/res/skins/default/sprite_ability.png differ diff --git a/forge-gui/src/main/java/forge/assets/FSkinProp.java b/forge-gui/src/main/java/forge/assets/FSkinProp.java index 91ac4331eed..ae7db76cc4f 100644 --- a/forge-gui/src/main/java/forge/assets/FSkinProp.java +++ b/forge-gui/src/main/java/forge/assets/FSkinProp.java @@ -292,7 +292,42 @@ public enum FSkinProp { IMG_FAV5 (new int[] {400, 0, 100, 100}, PropType.FAVICON), IMG_FAVNONE (new int[] {500, 0, 100, 100}, PropType.FAVICON), - IMG_QUEST_DRAFT_DECK (new int[] {0, 0, 680, 475}, PropType.IMAGE); + IMG_QUEST_DRAFT_DECK (new int[] {0, 0, 680, 475}, PropType.IMAGE), + + IMG_ABILITY_DEATHTOUCH (new int[] {2, 2, 80, 80}, PropType.ABILITY), + IMG_ABILITY_DEFENDER (new int[] {84, 2, 80, 80}, PropType.ABILITY), + IMG_ABILITY_DOUBLE_STRIKE (new int[] {166, 2, 80, 80}, PropType.ABILITY), + IMG_ABILITY_FIRST_STRIKE (new int[] {248, 2, 80, 80}, PropType.ABILITY), + IMG_ABILITY_FEAR (new int[] {84, 412, 80, 80}, PropType.ABILITY), + IMG_ABILITY_FLYING (new int[] {330, 2, 80, 80}, PropType.ABILITY), + IMG_ABILITY_HEXPROOF (new int[] {412, 2, 80, 80}, PropType.ABILITY), + IMG_ABILITY_INDESTRUCTIBLE (new int[] {2, 84, 80, 80}, PropType.ABILITY), + IMG_ABILITY_INTIMIDATE (new int[] {166, 412, 80, 80}, PropType.ABILITY), + IMG_ABILITY_LIFELINK (new int[] {84, 84, 80, 80}, PropType.ABILITY), + IMG_ABILITY_MENACE (new int[] {166, 84, 80, 80}, PropType.ABILITY), + IMG_ABILITY_REACH (new int[] {248, 330, 80, 80}, PropType.ABILITY), + IMG_ABILITY_SHROUD (new int[] {330, 330, 80, 80}, PropType.ABILITY), + IMG_ABILITY_TRAMPLE (new int[] {412, 330, 80, 80}, PropType.ABILITY), + IMG_ABILITY_VIGILANCE (new int[] {2, 412, 80, 80}, PropType.ABILITY), + + IMG_ABILITY_PROTECT_ALL (new int[] {248, 84, 80, 80}, PropType.ABILITY), + IMG_ABILITY_PROTECT_B (new int[] {330, 84, 80, 80}, PropType.ABILITY), + IMG_ABILITY_PROTECT_BU (new int[] {412, 84, 80, 80}, PropType.ABILITY), + IMG_ABILITY_PROTECT_BW (new int[] {2, 166, 80, 80}, PropType.ABILITY), + IMG_ABILITY_PROTECT_COLOREDSPELLS (new int[] {84, 166, 80, 80}, PropType.ABILITY), + IMG_ABILITY_PROTECT_G (new int[] {166, 166, 80, 80}, PropType.ABILITY), + IMG_ABILITY_PROTECT_GB (new int[] {248, 166, 80, 80}, PropType.ABILITY), + IMG_ABILITY_PROTECT_GU (new int[] {330, 166, 80, 80}, PropType.ABILITY), + IMG_ABILITY_PROTECT_GW (new int[] {412, 166, 80, 80}, PropType.ABILITY), + IMG_ABILITY_PROTECT_GENERIC (new int[] {2, 248, 80, 80}, PropType.ABILITY), + IMG_ABILITY_PROTECT_R (new int[] {84, 248, 80, 80}, PropType.ABILITY), + IMG_ABILITY_PROTECT_RB (new int[] {166, 248, 80, 80}, PropType.ABILITY), + IMG_ABILITY_PROTECT_RG (new int[] {248, 248, 80, 80}, PropType.ABILITY), + IMG_ABILITY_PROTECT_RU (new int[] {330, 248, 80, 80}, PropType.ABILITY), + IMG_ABILITY_PROTECT_RW (new int[] {412, 248, 80, 80}, PropType.ABILITY), + IMG_ABILITY_PROTECT_U (new int[] {2, 330, 80, 80}, PropType.ABILITY), + IMG_ABILITY_PROTECT_UW (new int[] {84, 330, 80, 80}, PropType.ABILITY), + IMG_ABILITY_PROTECT_W (new int[] {166, 330, 80, 80}, PropType.ABILITY); private int[] coords; private PropType type; @@ -325,6 +360,7 @@ public enum FSkinProp { FOIL, OLD_FOIL, TROPHY, + ABILITY, PLANAR_CONQUEST, FAVICON } diff --git a/forge-gui/src/main/java/forge/properties/ForgeConstants.java b/forge-gui/src/main/java/forge/properties/ForgeConstants.java index 7ff4316eb99..403be511384 100644 --- a/forge-gui/src/main/java/forge/properties/ForgeConstants.java +++ b/forge-gui/src/main/java/forge/properties/ForgeConstants.java @@ -93,6 +93,7 @@ public final class ForgeConstants { public static final String SPRITE_FOILS_FILE = "sprite_foils.png"; public static final String SPRITE_OLD_FOILS_FILE = "sprite_old_foils.png"; public static final String SPRITE_TROPHIES_FILE = "sprite_trophies.png"; + public static final String SPRITE_ABILITY_FILE = "sprite_ability.png"; public static final String SPRITE_AVATARS_FILE = "sprite_avatars.png"; public static final String SPRITE_FAVICONS_FILE = "sprite_favicons.png"; public static final String SPRITE_PLANAR_CONQUEST_FILE = "sprite_planar_conquest.png";