mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Merge branch 'newBranch' into 'master'
Stack display adjustment See merge request core-developers/forge!2612
This commit is contained in:
@@ -164,7 +164,7 @@ public class ImageCache {
|
||||
}
|
||||
return image;
|
||||
}
|
||||
public static void preloadCache(Iterable keys) {
|
||||
public static void preloadCache(Iterable<String> 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)
|
||||
|
||||
@@ -535,6 +535,9 @@ public class CardRenderer {
|
||||
}
|
||||
|
||||
public static void drawCardWithOverlays(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos) {
|
||||
drawCardWithOverlays(g, card, x, y, w, h, pos, false);
|
||||
}
|
||||
public static void drawCardWithOverlays(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos, boolean stackview) {
|
||||
boolean canShow = MatchController.instance.mayView(card);
|
||||
float oldAlpha = g.getfloatAlphaComposite();
|
||||
boolean unselectable = !MatchController.instance.isSelectable(card) && MatchController.instance.isSelecting();
|
||||
@@ -555,32 +558,10 @@ 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 (stackview)
|
||||
return; //override
|
||||
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 +637,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 +646,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 +713,41 @@ public class CardRenderer {
|
||||
List<String> 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 +755,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 +793,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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.Top, true);
|
||||
|
||||
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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user