From 6e94378cc117aceaab091251229c9bc38656622d Mon Sep 17 00:00:00 2001 From: austinio7116 Date: Wed, 4 Mar 2020 06:05:07 +0000 Subject: [PATCH 01/22] Added filter to ensure banlist is respected --- forge-gui/src/main/java/forge/deck/DeckgenUtil.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/forge-gui/src/main/java/forge/deck/DeckgenUtil.java b/forge-gui/src/main/java/forge/deck/DeckgenUtil.java index 2ccc98d7e08..575aa7031b8 100644 --- a/forge-gui/src/main/java/forge/deck/DeckgenUtil.java +++ b/forge-gui/src/main/java/forge/deck/DeckgenUtil.java @@ -156,6 +156,9 @@ public class DeckgenUtil { //} } + //remove any cards not valid in format + selectedCards = Lists.newArrayList(Iterables.filter(selectedCards, format.getFilterPrinted())); + List toRemove = new ArrayList<>(); //randomly remove cards @@ -252,6 +255,9 @@ public class DeckgenUtil { //} } + //remove any cards not valid in format + selectedCards = Lists.newArrayList(Iterables.filter(selectedCards, format.getFilterPrinted())); + List toRemove = new ArrayList<>(); //randomly remove cards From a5683d4f12472d5b12a952639e3f035f3e230cc1 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 14 Mar 2020 03:02:15 +0800 Subject: [PATCH 02/22] Adjust Card Name & Ability Icons Ordering --- .../src/forge/assets/ImageCache.java | 9 +- .../src/forge/card/CardRenderer.java | 155 +++++------------- forge-gui-mobile/src/forge/card/CardZoom.java | 2 +- 3 files changed, 49 insertions(+), 117 deletions(-) diff --git a/forge-gui-mobile/src/forge/assets/ImageCache.java b/forge-gui-mobile/src/forge/assets/ImageCache.java index 74f904e34ac..70919ec452b 100644 --- a/forge-gui-mobile/src/forge/assets/ImageCache.java +++ b/forge-gui-mobile/src/forge/assets/ImageCache.java @@ -164,7 +164,7 @@ public class ImageCache { } return image; } - public static void preloadCache(Iterable keys) { + public static void preloadCache(Iterable keys) { cache.getAll(keys); } public static TextureRegion croppedBorderImage(Texture image, boolean fullborder) { @@ -173,10 +173,9 @@ public class ImageCache { float rscale = 0.96f; int rw = Math.round(image.getWidth()*rscale); int rh = Math.round(image.getHeight()*rscale); - int rx = Math.round((image.getWidth() - rw)/2); - int ry = Math.round((image.getHeight() - rh)/2)-2; - TextureRegion rimage = new TextureRegion(image, rx, ry, rw, rh); - return rimage; + int rx = Math.round((image.getWidth() - rw)/2f); + int ry = Math.round((image.getHeight() - rh)/2f)-2; + return new TextureRegion(image, rx, ry, rw, rh); } public static boolean isWhiteBordered(IPaperCard c) { if (c == null) diff --git a/forge-gui-mobile/src/forge/card/CardRenderer.java b/forge-gui-mobile/src/forge/card/CardRenderer.java index 6dcc0c48681..a93d95ab2ea 100644 --- a/forge-gui-mobile/src/forge/card/CardRenderer.java +++ b/forge-gui-mobile/src/forge/card/CardRenderer.java @@ -555,31 +555,7 @@ public class CardRenderer { Color color = FSkinColor.fromRGB(borderColor.r, borderColor.g, borderColor.b); color = FSkinColor.tintColor(Color.WHITE, color, CardRenderer.PT_BOX_TINT); - //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.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.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); - - PaperCard pc = StaticData.instance().getCommonCards().getCard(card.getName()); - if (Card.getCardForUi(pc).hasKeyword(Keyword.AFTERMATH)){ - dy *= -1; // flip card costs for Aftermath cards - } - - drawManaCost(g, card.getAlternateState().getManaCost(), x - padding, y - dy, w + 2 * padding, h, manaSymbolSize); - drawManaCost(g, card.getCurrentState().getManaCost(), x - padding, y + dy, w + 2 * padding, h, manaSymbolSize); - } - } - else { - drawManaCost(g, card.getCurrentState().getManaCost(), x - padding, y, w + 2 * padding, h, manaSymbolSize); - } - } - } + //card name && manacost original position is here moved at the bottom... if (pos == CardStackPosition.BehindVert) { return; } //remaining rendering not needed if card is behind another card in a vertical stack boolean onTop = (pos == CardStackPosition.Top); @@ -656,6 +632,7 @@ public class CardRenderer { float abiSpace = cw / 5.7f; float abiCount = 0; + if (unselectable){ g.setAlphaComposite(0.6f); } if (onbattlefield && onTop && showAbilityIcons(card)) { if (card.isToken()){ CardFaceSymbols.drawSymbol("token", g, abiX, abiY, abiScale, abiScale); @@ -664,85 +641,63 @@ public class CardRenderer { } 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().hasHaste()) { CardFaceSymbols.drawSymbol("haste", 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()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } 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()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } 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()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } 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()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } 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()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } 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().hasShadow()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } CardFaceSymbols.drawSymbol("shadow", 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().hasHorsemanship()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } CardFaceSymbols.drawSymbol("horsemanship", 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; } @@ -753,57 +708,41 @@ public class CardRenderer { List listHK = Arrays.asList(splitK); if (listHK.contains("generic")) { 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; } if (listHK.contains("R")) { CardFaceSymbols.drawSymbol("hexproofR", 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 (listHK.contains("B")) { CardFaceSymbols.drawSymbol("hexproofB", 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 (listHK.contains("U")) { CardFaceSymbols.drawSymbol("hexproofU", 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 (listHK.contains("G")) { CardFaceSymbols.drawSymbol("hexproofG", 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 (listHK.contains("W")) { CardFaceSymbols.drawSymbol("hexproofW", 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 (listHK.contains("monocolored")) { CardFaceSymbols.drawSymbol("hexproofC", 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 { 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; } @@ -811,48 +750,36 @@ public class CardRenderer { else if (card.getCurrentState().hasShroud()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } 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()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } 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; } if (card.getCurrentState().hasTrample()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } 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()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } 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()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } 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()) { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } 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; } @@ -861,132 +788,138 @@ public class CardRenderer { if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); } 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; } } } + //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)) { + float multiplier; + switch (Forge.extrawide) { + case "default": + multiplier = 0.145f; //good for tablets with 16:10 or similar + break; + case "wide": + multiplier = 0.150f; + break; + case "extrawide": + multiplier = 0.155f; //good for tall phones with 21:9 or similar + break; + default: + multiplier = 0.150f; + break; + } + g.drawOutlinedText(CardTranslation.getTranslatedName(details.getName()), FSkinFont.forHeight(h * multiplier), 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.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); + + PaperCard pc = StaticData.instance().getCommonCards().getCard(card.getName()); + if (Card.getCardForUi(pc).hasKeyword(Keyword.AFTERMATH)){ + dy *= -1; // flip card costs for Aftermath cards + } + + drawManaCost(g, card.getAlternateState().getManaCost(), x - padding, y - dy, w + 2 * padding, h, manaSymbolSize); + drawManaCost(g, card.getCurrentState().getManaCost(), x - padding, y + dy, w + 2 * padding, h, manaSymbolSize); + } + } + else { + drawManaCost(g, card.getCurrentState().getManaCost(), x - padding, y, w + 2 * padding, h, manaSymbolSize); + } + } + } + //reset alpha + g.setAlphaComposite(oldAlpha); } 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-mobile/src/forge/card/CardZoom.java b/forge-gui-mobile/src/forge/card/CardZoom.java index 72d7d7c978f..2eea37d2ec6 100644 --- a/forge-gui-mobile/src/forge/card/CardZoom.java +++ b/forge-gui-mobile/src/forge/card/CardZoom.java @@ -219,7 +219,7 @@ public class CardZoom extends FOverlay { float w = getWidth(); float h = getHeight(); float messageHeight = FDialog.MSG_HEIGHT; - float AspectRatioMultiplier = 2; + float AspectRatioMultiplier; switch (Forge.extrawide) { case "default": AspectRatioMultiplier = 3; //good for tablets with 16:10 or similar From d7e38f7fd8fba03eb1cc87e95a3c51dce6e38020 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 14 Mar 2020 03:05:29 +0800 Subject: [PATCH 03/22] Format Stack Text (Should be cleaner) --- .../src/forge/screens/match/views/VStack.java | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/forge-gui-mobile/src/forge/screens/match/views/VStack.java b/forge-gui-mobile/src/forge/screens/match/views/VStack.java index 7d9c5639694..ac4fe11e692 100644 --- a/forge-gui-mobile/src/forge/screens/match/views/VStack.java +++ b/forge-gui-mobile/src/forge/screens/match/views/VStack.java @@ -40,6 +40,7 @@ import forge.toolbox.FEvent; import forge.toolbox.FEvent.FEventHandler; import forge.toolbox.FLabel; import forge.util.Localizer; +import forge.util.TextUtil; import forge.util.collect.FCollectionView; import forge.util.Utils; @@ -372,12 +373,35 @@ public class VStack extends FDropDown { x += PADDING; y += PADDING; - CardRenderer.drawCardWithOverlays(g, stackInstance.getSourceCard(), x, y, CARD_WIDTH, CARD_HEIGHT, CardStackPosition.Top); + CardRenderer.drawCardWithOverlays(g, stackInstance.getSourceCard(), x, y, CARD_WIDTH, CARD_HEIGHT, CardStackPosition.BehindVert); x += CARD_WIDTH + PADDING; w -= x + PADDING - BORDER_THICKNESS; h -= y + PADDING - BORDER_THICKNESS; - textRenderer.drawText(g, text, FONT, foreColor, x, y, w, h, y, h, true, Align.left, true); + + String name = stackInstance.getSourceCard().getName(); + int index = text.indexOf(name); + String newtext = ""; + String cId = "(" + stackInstance.getSourceCard().getId() + ")"; + + if (index == -1) { + newtext = TextUtil.fastReplace(TextUtil.fastReplace(text.trim(),"--","-"),"- -","-"); + textRenderer.drawText(g, name + " " + (name.length() > 1 ? cId : "") + "\n" + (newtext.length() > 1 ? newtext : ""), + FONT, foreColor, x, y, w, h, y, h, true, Align.left, true); + + } else { + String trimFirst = TextUtil.fastReplace("\n" + text.substring(0, index) + text.substring(index + name.length()), "- -", "-"); + String trimSecond = TextUtil.fastReplace(trimFirst, name+" "+cId, name); + newtext = TextUtil.fastReplace(trimSecond, " "+cId, name); + + if(newtext.equals("\n"+name)) + textRenderer.drawText(g, name + " " + cId, FONT, foreColor, x, y, w, h, y, h, true, Align.left, true); + else { + newtext = TextUtil.fastReplace(TextUtil.fastReplace(newtext,name+" -","-"), "\n ", "\n"); + newtext = "\n"+ TextUtil.fastReplace(newtext.trim(),"--","-"); + textRenderer.drawText(g, name+" "+cId+newtext, FONT, foreColor, x, y, w, h, y, h, true, Align.left, true); + } + } g.endClip(); From f1f480d16a4c8372e6193ac53586d593c3a341c9 Mon Sep 17 00:00:00 2001 From: "Jamin W. Collins" Date: Fri, 13 Mar 2020 18:29:35 -0600 Subject: [PATCH 04/22] explicitly set the encoding to UTF-8 Signed-off-by: Jamin W. Collins --- forge-gui-desktop/pom.xml | 10 ++++++++-- forge-gui-desktop/src/main/config/forge.command | 4 ++-- forge-gui-desktop/src/main/config/forge.sh | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/forge-gui-desktop/pom.xml b/forge-gui-desktop/pom.xml index c2bb8f2388f..8f2a2230ee4 100644 --- a/forge-gui-desktop/pom.xml +++ b/forge-gui-desktop/pom.xml @@ -213,7 +213,7 @@ com.akathist.maven.plugins.launch4j launch4j-maven-plugin - 1.5.2 + 1.7.25 l4j-gui @@ -236,6 +236,9 @@ 1.8.0 1024 + + -Dfile.encoding=UTF-8 + @@ -367,7 +370,7 @@ com.akathist.maven.plugins.launch4j launch4j-maven-plugin - 1.5.2 + 1.7.25 l4j-gui @@ -390,6 +393,9 @@ 1.8.0 1024 + + -Dfile.encoding=UTF-8 + diff --git a/forge-gui-desktop/src/main/config/forge.command b/forge-gui-desktop/src/main/config/forge.command index e6068616734..6983fcc8eb2 100644 --- a/forge-gui-desktop/src/main/config/forge.command +++ b/forge-gui-desktop/src/main/config/forge.command @@ -1,3 +1,3 @@ #!/bin/sh -cd "`dirname \"$0\"`" -java -Xmx1024m -jar $project.build.finalName$ \ No newline at end of file +cd $(dirname "${0}") +java -Xmx1024m -Dfile.encoding=UTF-8 -jar $project.build.finalName$ diff --git a/forge-gui-desktop/src/main/config/forge.sh b/forge-gui-desktop/src/main/config/forge.sh index e6068616734..6983fcc8eb2 100644 --- a/forge-gui-desktop/src/main/config/forge.sh +++ b/forge-gui-desktop/src/main/config/forge.sh @@ -1,3 +1,3 @@ #!/bin/sh -cd "`dirname \"$0\"`" -java -Xmx1024m -jar $project.build.finalName$ \ No newline at end of file +cd $(dirname "${0}") +java -Xmx1024m -Dfile.encoding=UTF-8 -jar $project.build.finalName$ From d83f8deb7a9d43f34b1b1e01d3967fecc9657c86 Mon Sep 17 00:00:00 2001 From: "Jamin W. Collins" Date: Fri, 13 Mar 2020 18:30:35 -0600 Subject: [PATCH 05/22] remove vestigial scripts Signed-off-by: Jamin W. Collins --- forge-gui/src/main/config/forge.command | 3 --- forge-gui/src/main/config/forge.sh | 3 --- 2 files changed, 6 deletions(-) delete mode 100644 forge-gui/src/main/config/forge.command delete mode 100644 forge-gui/src/main/config/forge.sh diff --git a/forge-gui/src/main/config/forge.command b/forge-gui/src/main/config/forge.command deleted file mode 100644 index e6068616734..00000000000 --- a/forge-gui/src/main/config/forge.command +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -cd "`dirname \"$0\"`" -java -Xmx1024m -jar $project.build.finalName$ \ No newline at end of file diff --git a/forge-gui/src/main/config/forge.sh b/forge-gui/src/main/config/forge.sh deleted file mode 100644 index e6068616734..00000000000 --- a/forge-gui/src/main/config/forge.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -cd "`dirname \"$0\"`" -java -Xmx1024m -jar $project.build.finalName$ \ No newline at end of file From c488ab477217c4268dc7efccab8942814e071464 Mon Sep 17 00:00:00 2001 From: "Jamin W. Collins" Date: Fri, 13 Mar 2020 18:31:29 -0600 Subject: [PATCH 06/22] increase maximal heap size to 4096m Signed-off-by: Jamin W. Collins --- forge-gui-desktop/pom.xml | 8 ++++---- forge-gui-desktop/src/main/config/forge.command | 2 +- forge-gui-desktop/src/main/config/forge.sh | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/forge-gui-desktop/pom.xml b/forge-gui-desktop/pom.xml index 8f2a2230ee4..bdfee6d2c0d 100644 --- a/forge-gui-desktop/pom.xml +++ b/forge-gui-desktop/pom.xml @@ -235,7 +235,7 @@ 1.8.0 - 1024 + 4096 -Dfile.encoding=UTF-8 @@ -392,7 +392,7 @@ 1.8.0 - 1024 + 4096 -Dfile.encoding=UTF-8 @@ -570,7 +570,7 @@