Update HexproofKey

This commit is contained in:
Anthony Calosa
2019-09-25 21:11:01 +08:00
parent b6ed045c21
commit f1c3e93548
3 changed files with 132 additions and 70 deletions

View File

@@ -5420,37 +5420,42 @@ public class Card extends GameEntity implements Comparable<Card> {
boolean hR = false; boolean hG = false; boolean hB = false; boolean hU = false; boolean hW = false;
for (final KeywordInterface inst : getKeywords()) {
String kw = inst.getOriginal();
if (!kw.startsWith("Hexproof:")) {
if (!kw.startsWith("Hexproof")) {
continue;
}
String[] k = kw.split(":");
if (k[2].toString().equals("red")) {
if (!hR) {
hR = true;
hexproofKey += "R";
if (kw.equals("Hexproof")) {
hexproofKey += "generic:";
}
if (kw.startsWith("Hexproof:")) {
String[] k = kw.split(":");
if (k[2].toString().equals("red")) {
if (!hR) {
hR = true;
hexproofKey += "R:";
}
} else if (k[2].toString().equals("green")) {
if (!hG) {
hG = true;
hexproofKey += "G:";
}
} else if (k[2].toString().equals("black")) {
if (!hB) {
hB = true;
hexproofKey += "B:";
}
} else if (k[2].toString().equals("blue")) {
if (!hU) {
hU = true;
hexproofKey += "U:";
}
} else if (k[2].toString().equals("white")) {
if (!hW) {
hW = true;
hexproofKey += "W:";
}
} else if (k[2].toString().equals("monocolored")) {
hexproofKey += "monocolored:";
}
} else if (k[2].toString().equals("green")) {
if (!hG) {
hG = true;
hexproofKey += "G";
}
} else if (k[2].toString().equals("black")) {
if (!hB) {
hB = true;
hexproofKey += "B";
}
} else if (k[2].toString().equals("blue")) {
if (!hU) {
hU = true;
hexproofKey += "U";
}
} else if (k[2].toString().equals("white")) {
if (!hW) {
hW = true;
hexproofKey += "W";
}
} else if (k[2].toString().equals("monocolored")) {
hexproofKey += "monocolored";
}
}
return hexproofKey;

View File

@@ -50,6 +50,7 @@ import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -545,29 +546,43 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
abiY += abiSpace;
}
if (card.getCurrentState().hasHexproof()) {
if (!card.getCurrentState().getHexproofKey().isEmpty()) {
if (card.getCurrentState().getHexproofKey().equals("R"))
CardFaceSymbols.drawAbilitySymbol("hexproofR", g, abiX, abiY, abiScale, abiScale);
else if (card.getCurrentState().getHexproofKey().equals("B"))
CardFaceSymbols.drawAbilitySymbol("hexproofB", g, abiX, abiY, abiScale, abiScale);
else if (card.getCurrentState().getHexproofKey().equals("U"))
CardFaceSymbols.drawAbilitySymbol("hexproofU", g, abiX, abiY, abiScale, abiScale);
else if (card.getCurrentState().getHexproofKey().equals("G"))
CardFaceSymbols.drawAbilitySymbol("hexproofG", g, abiX, abiY, abiScale, abiScale);
else if (card.getCurrentState().getHexproofKey().equals("W"))
CardFaceSymbols.drawAbilitySymbol("hexproofW", g, abiX, abiY, abiScale, abiScale);
else if (card.getCurrentState().getHexproofKey().equals("UB") || card.getCurrentState().getHexproofKey().equals("BU"))
CardFaceSymbols.drawAbilitySymbol("hexproofUB", g, abiX, abiY, abiScale, abiScale);
else if (card.getCurrentState().getHexproofKey().equals("monocolored"))
CardFaceSymbols.drawAbilitySymbol("hexproofC", g, abiX, abiY, abiScale, abiScale);
else
if (!card.getCurrentState().getHexproofKey().isEmpty()){
String[] splitK = card.getCurrentState().getHexproofKey().split(":");
List<String> listHK = Arrays.asList(splitK);
if (listHK.contains("generic")) {
CardFaceSymbols.drawAbilitySymbol("hexproof", g, abiX, abiY, abiScale, abiScale);
} else
abiY += abiSpace;
}
if (listHK.contains("R")) {
CardFaceSymbols.drawAbilitySymbol("hexproofR", g, abiX, abiY, abiScale, abiScale);
abiY += abiSpace;
}
if (listHK.contains("B")) {
CardFaceSymbols.drawAbilitySymbol("hexproofB", g, abiX, abiY, abiScale, abiScale);
abiY += abiSpace;
}
if (listHK.contains("U")) {
CardFaceSymbols.drawAbilitySymbol("hexproofU", g, abiX, abiY, abiScale, abiScale);
abiY += abiSpace;
}
if (listHK.contains("G")) {
CardFaceSymbols.drawAbilitySymbol("hexproofG", g, abiX, abiY, abiScale, abiScale);
abiY += abiSpace;
}
if (listHK.contains("W")) {
CardFaceSymbols.drawAbilitySymbol("hexproofW", g, abiX, abiY, abiScale, abiScale);
abiY += abiSpace;
}
if (listHK.contains("monocolored")) {
CardFaceSymbols.drawAbilitySymbol("hexproofC", g, abiX, abiY, abiScale, abiScale);
abiY += abiSpace;
}
} else {
CardFaceSymbols.drawAbilitySymbol("hexproof", g, abiX, abiY, abiScale, abiScale);
abiY += abiSpace;
abiY += abiSpace;
}
}
if (card.getCurrentState().hasShroud()) {
else if (card.getCurrentState().hasShroud()) {
CardFaceSymbols.drawAbilitySymbol("shroud", g, abiX, abiY, abiScale, abiScale);
abiY += abiSpace;
}

View File

@@ -19,7 +19,13 @@ import forge.CachedCardImage;
import forge.FThreads;
import forge.Graphics;
import forge.StaticData;
import forge.assets.*;
import forge.assets.FImageComplex;
import forge.assets.FRotatedImage;
import forge.assets.FSkinColor;
import forge.assets.FSkinFont;
import forge.assets.FSkinImage;
import forge.assets.FTextureRegionImage;
import forge.assets.ImageCache;
import forge.card.CardDetailUtil.DetailColors;
import forge.card.CardZoom.ActivateHandler;
import forge.card.mana.ManaCost;
@@ -42,6 +48,7 @@ import forge.toolbox.FList;
import forge.util.Utils;
import org.apache.commons.lang3.StringUtils;
import forge.util.TextBounds;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -614,29 +621,64 @@ public class CardRenderer {
}
if (card.getCurrentState().hasHexproof()) {
if (!card.getCurrentState().getHexproofKey().isEmpty()){
if (card.getCurrentState().getHexproofKey().equals("R"))
CardFaceSymbols.drawSymbol("hexproofR", g, abiX, abiY, abiScale, abiScale);
else if (card.getCurrentState().getHexproofKey().equals("B"))
CardFaceSymbols.drawSymbol("hexproofB", g, abiX, abiY, abiScale, abiScale);
else if (card.getCurrentState().getHexproofKey().equals("U"))
CardFaceSymbols.drawSymbol("hexproofU", g, abiX, abiY, abiScale, abiScale);
else if (card.getCurrentState().getHexproofKey().equals("G"))
CardFaceSymbols.drawSymbol("hexproofG", g, abiX, abiY, abiScale, abiScale);
else if (card.getCurrentState().getHexproofKey().equals("W"))
CardFaceSymbols.drawSymbol("hexproofW", g, abiX, abiY, abiScale, abiScale);
else if (card.getCurrentState().getHexproofKey().equals("UB") || card.getCurrentState().getHexproofKey().equals("BU"))
CardFaceSymbols.drawSymbol("hexproofUB", g, abiX, abiY, abiScale, abiScale);
else if (card.getCurrentState().getHexproofKey().equals("monocolored"))
CardFaceSymbols.drawSymbol("hexproofC", g, abiX, abiY, abiScale, abiScale);
else
String[] splitK = card.getCurrentState().getHexproofKey().split(":");
List<String> listHK = Arrays.asList(splitK);
if (listHK.contains("generic")) {
CardFaceSymbols.drawSymbol("hexproof", g, abiX, abiY, abiScale, abiScale);
}
else
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;
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);