Add Hexproof From Icons (TODO: PC code, better Hexproof from Icons)

This commit is contained in:
Anthony Calosa
2019-09-24 22:49:52 +08:00
parent 6ad34fed2c
commit 6556f78c28
8 changed files with 93 additions and 10 deletions

View File

@@ -5415,6 +5415,46 @@ public class Card extends GameEntity implements Comparable<Card> {
} }
return protectKey; return protectKey;
} }
public String getHexproofKey() {
String hexproofKey = "";
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:")) {
continue;
}
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";
}
}
return hexproofKey;
}
public Zone getZone() { public Zone getZone() {
return currentZone; return currentZone;
} }

View File

@@ -1018,6 +1018,7 @@ public class CardView extends GameEntityView {
} }
public String getProtectionKey() { return get(TrackableProperty.ProtectionKey); } public String getProtectionKey() { return get(TrackableProperty.ProtectionKey); }
public String getHexproofKey() { return get(TrackableProperty.HexproofKey); }
public boolean hasDeathtouch() { return get(TrackableProperty.HasDeathtouch); } public boolean hasDeathtouch() { return get(TrackableProperty.HasDeathtouch); }
public boolean hasDefender() { return get(TrackableProperty.HasDefender); } public boolean hasDefender() { return get(TrackableProperty.HasDefender); }
public boolean hasDoubleStrike() { return get(TrackableProperty.HasDoubleStrike); } public boolean hasDoubleStrike() { return get(TrackableProperty.HasDoubleStrike); }
@@ -1031,12 +1032,8 @@ public class CardView extends GameEntityView {
public boolean hasMenace() { return get(TrackableProperty.HasMenace); } public boolean hasMenace() { return get(TrackableProperty.HasMenace); }
public boolean hasReach() { return get(TrackableProperty.HasReach); } public boolean hasReach() { return get(TrackableProperty.HasReach); }
public boolean hasShroud() { return get(TrackableProperty.HasShroud); } public boolean hasShroud() { return get(TrackableProperty.HasShroud); }
public boolean hasTrample() { public boolean hasTrample() { return get(TrackableProperty.HasTrample); }
return get(TrackableProperty.HasTrample); public boolean hasVigilance() { return get(TrackableProperty.HasVigilance); }
}
public boolean hasVigilance() {
return get(TrackableProperty.HasVigilance);
}
public boolean hasHaste() { public boolean hasHaste() {
return get(TrackableProperty.HasHaste); return get(TrackableProperty.HasHaste);
@@ -1077,6 +1074,8 @@ public class CardView extends GameEntityView {
updateAbilityText(c, state); updateAbilityText(c, state);
//set protectionKey for Icons //set protectionKey for Icons
set(TrackableProperty.ProtectionKey, c.getProtectionKey()); set(TrackableProperty.ProtectionKey, c.getProtectionKey());
//set hexproofKeys for Icons
set(TrackableProperty.HexproofKey, c.getHexproofKey());
} }
public boolean isBasicLand() { public boolean isBasicLand() {

View File

@@ -99,7 +99,8 @@ public enum TrackableProperty {
HasVigilance(TrackableTypes.BooleanType), HasVigilance(TrackableTypes.BooleanType),
//protectionkey //protectionkey
ProtectionKey(TrackableTypes.StringType), ProtectionKey(TrackableTypes.StringType),
//hexproofkey
HexproofKey(TrackableTypes.StringType),
HasHaste(TrackableTypes.BooleanType), HasHaste(TrackableTypes.BooleanType),
HasInfect(TrackableTypes.BooleanType), HasInfect(TrackableTypes.BooleanType),
HasStorm(TrackableTypes.BooleanType), HasStorm(TrackableTypes.BooleanType),

View File

@@ -268,6 +268,14 @@ public enum FSkinImage implements FImage {
IMG_ABILITY_SHROUD (FSkinProp.IMG_ABILITY_SHROUD, SourceFile.ABILITIES), IMG_ABILITY_SHROUD (FSkinProp.IMG_ABILITY_SHROUD, SourceFile.ABILITIES),
IMG_ABILITY_TRAMPLE (FSkinProp.IMG_ABILITY_TRAMPLE, SourceFile.ABILITIES), IMG_ABILITY_TRAMPLE (FSkinProp.IMG_ABILITY_TRAMPLE, SourceFile.ABILITIES),
IMG_ABILITY_VIGILANCE (FSkinProp.IMG_ABILITY_VIGILANCE, SourceFile.ABILITIES), IMG_ABILITY_VIGILANCE (FSkinProp.IMG_ABILITY_VIGILANCE, SourceFile.ABILITIES),
//HEXPROOF FROM
IMG_ABILITY_HEXPROOF_R (FSkinProp.IMG_ABILITY_HEXPROOF_R, SourceFile.ABILITIES),
IMG_ABILITY_HEXPROOF_G (FSkinProp.IMG_ABILITY_HEXPROOF_G, SourceFile.ABILITIES),
IMG_ABILITY_HEXPROOF_B (FSkinProp.IMG_ABILITY_HEXPROOF_B, SourceFile.ABILITIES),
IMG_ABILITY_HEXPROOF_U (FSkinProp.IMG_ABILITY_HEXPROOF_U, SourceFile.ABILITIES),
IMG_ABILITY_HEXPROOF_W (FSkinProp.IMG_ABILITY_HEXPROOF_W, SourceFile.ABILITIES),
IMG_ABILITY_HEXPROOF_C (FSkinProp.IMG_ABILITY_HEXPROOF_C, SourceFile.ABILITIES),
IMG_ABILITY_HEXPROOF_UB (FSkinProp.IMG_ABILITY_HEXPROOF_UB, SourceFile.ABILITIES),
//PROTECT ICONS //PROTECT ICONS
IMG_ABILITY_PROTECT_ALL (FSkinProp.IMG_ABILITY_PROTECT_ALL, SourceFile.ABILITIES), 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_B (FSkinProp.IMG_ABILITY_PROTECT_B, SourceFile.ABILITIES),

View File

@@ -118,7 +118,15 @@ public class CardFaceSymbols {
MANA_IMAGES.put("shroud", FSkinImage.IMG_ABILITY_SHROUD); MANA_IMAGES.put("shroud", FSkinImage.IMG_ABILITY_SHROUD);
MANA_IMAGES.put("trample", FSkinImage.IMG_ABILITY_TRAMPLE); MANA_IMAGES.put("trample", FSkinImage.IMG_ABILITY_TRAMPLE);
MANA_IMAGES.put("vigilance", FSkinImage.IMG_ABILITY_VIGILANCE); MANA_IMAGES.put("vigilance", FSkinImage.IMG_ABILITY_VIGILANCE);
//hexproof from
MANA_IMAGES.put("hexproofR", FSkinImage.IMG_ABILITY_HEXPROOF_R);
MANA_IMAGES.put("hexproofG", FSkinImage.IMG_ABILITY_HEXPROOF_G);
MANA_IMAGES.put("hexproofB", FSkinImage.IMG_ABILITY_HEXPROOF_B);
MANA_IMAGES.put("hexproofU", FSkinImage.IMG_ABILITY_HEXPROOF_U);
MANA_IMAGES.put("hexproofW", FSkinImage.IMG_ABILITY_HEXPROOF_W);
MANA_IMAGES.put("hexproofC", FSkinImage.IMG_ABILITY_HEXPROOF_C);
MANA_IMAGES.put("hexproofUB", FSkinImage.IMG_ABILITY_HEXPROOF_UB);
//protection from
MANA_IMAGES.put("protectAll", FSkinImage.IMG_ABILITY_PROTECT_ALL); MANA_IMAGES.put("protectAll", FSkinImage.IMG_ABILITY_PROTECT_ALL);
MANA_IMAGES.put("protectB", FSkinImage.IMG_ABILITY_PROTECT_B); MANA_IMAGES.put("protectB", FSkinImage.IMG_ABILITY_PROTECT_B);
MANA_IMAGES.put("protectBU", FSkinImage.IMG_ABILITY_PROTECT_BU); MANA_IMAGES.put("protectBU", FSkinImage.IMG_ABILITY_PROTECT_BU);

View File

@@ -609,7 +609,26 @@ public class CardRenderer {
abiCount += 1; abiCount += 1;
} }
if (card.getCurrentState().hasHexproof()) { if (card.getCurrentState().hasHexproof()) {
CardFaceSymbols.drawSymbol("hexproof", g, abiX, abiY, abiScale, abiScale); 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
CardFaceSymbols.drawSymbol("hexproof", g, abiX, abiY, abiScale, abiScale);
}
else
CardFaceSymbols.drawSymbol("hexproof", g, abiX, abiY, abiScale, abiScale);
if (unselectable){ if (unselectable){
g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);} g.setAlphaComposite(0.6f); g.fillRect(Color.BLACK, abiX, abiY, abiScale, abiScale ); g.setAlphaComposite(oldAlpha);}
abiY += abiSpace; abiY += abiSpace;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 KiB

After

Width:  |  Height:  |  Size: 196 KiB

View File

@@ -309,7 +309,15 @@ public enum FSkinProp {
IMG_ABILITY_SHROUD (new int[] {330, 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_TRAMPLE (new int[] {412, 330, 80, 80}, PropType.ABILITY),
IMG_ABILITY_VIGILANCE (new int[] {2, 412, 80, 80}, PropType.ABILITY), IMG_ABILITY_VIGILANCE (new int[] {2, 412, 80, 80}, PropType.ABILITY),
//Hexproof From
IMG_ABILITY_HEXPROOF_R (new int[] {2, 494, 80, 80}, PropType.ABILITY),
IMG_ABILITY_HEXPROOF_G (new int[] {412, 412, 80, 80}, PropType.ABILITY),
IMG_ABILITY_HEXPROOF_B (new int[] {248, 412, 80, 80}, PropType.ABILITY),
IMG_ABILITY_HEXPROOF_U (new int[] {84, 494, 80, 80}, PropType.ABILITY),
IMG_ABILITY_HEXPROOF_W (new int[] {248, 494, 80, 80}, PropType.ABILITY),
IMG_ABILITY_HEXPROOF_C (new int[] {330, 412, 80, 80}, PropType.ABILITY),
IMG_ABILITY_HEXPROOF_UB (new int[] {166, 494, 80, 80}, PropType.ABILITY),
//Protection From
IMG_ABILITY_PROTECT_ALL (new int[] {248, 84, 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_B (new int[] {330, 84, 80, 80}, PropType.ABILITY),
IMG_ABILITY_PROTECT_BU (new int[] {412, 84, 80, 80}, PropType.ABILITY), IMG_ABILITY_PROTECT_BU (new int[] {412, 84, 80, 80}, PropType.ABILITY),