Merge branch 'newBranch' into 'master'

Update border color tint

Closes #1608

See merge request core-developers/forge!3268
This commit is contained in:
Anthony Calosa
2020-10-14 08:34:05 +00:00
5 changed files with 16 additions and 7 deletions

View File

@@ -1082,6 +1082,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 String getHexproofKey() { return get(TrackableProperty.HexproofKey); }
public boolean hasDeathtouch() { return get(TrackableProperty.HasDeathtouch); } public boolean hasDeathtouch() { return get(TrackableProperty.HasDeathtouch); }
public boolean hasDevoid() { return get(TrackableProperty.HasDevoid); }
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); }
public boolean hasFirstStrike() { return get(TrackableProperty.HasFirstStrike); } public boolean hasFirstStrike() { return get(TrackableProperty.HasFirstStrike); }
@@ -1118,6 +1119,7 @@ public class CardView extends GameEntityView {
void updateKeywords(Card c, CardState state) { void updateKeywords(Card c, CardState state) {
c.updateKeywordsCache(state); c.updateKeywordsCache(state);
set(TrackableProperty.HasDeathtouch, c.hasKeyword(Keyword.DEATHTOUCH, state)); set(TrackableProperty.HasDeathtouch, c.hasKeyword(Keyword.DEATHTOUCH, state));
set(TrackableProperty.HasDevoid, c.hasKeyword(Keyword.DEVOID, state));
set(TrackableProperty.HasDefender, c.hasKeyword(Keyword.DEFENDER, state)); set(TrackableProperty.HasDefender, c.hasKeyword(Keyword.DEFENDER, state));
set(TrackableProperty.HasDoubleStrike, c.hasKeyword(Keyword.DOUBLE_STRIKE, state)); set(TrackableProperty.HasDoubleStrike, c.hasKeyword(Keyword.DOUBLE_STRIKE, state));
set(TrackableProperty.HasFirstStrike, c.hasKeyword(Keyword.FIRST_STRIKE, state)); set(TrackableProperty.HasFirstStrike, c.hasKeyword(Keyword.FIRST_STRIKE, state));

View File

@@ -92,6 +92,7 @@ public enum TrackableProperty {
KeywordKey(TrackableTypes.StringType), KeywordKey(TrackableTypes.StringType),
HasDeathtouch(TrackableTypes.BooleanType), HasDeathtouch(TrackableTypes.BooleanType),
HasDevoid(TrackableTypes.BooleanType),
HasDefender(TrackableTypes.BooleanType), HasDefender(TrackableTypes.BooleanType),
HasDoubleStrike(TrackableTypes.BooleanType), HasDoubleStrike(TrackableTypes.BooleanType),
HasFirstStrike(TrackableTypes.BooleanType), HasFirstStrike(TrackableTypes.BooleanType),

View File

@@ -637,7 +637,7 @@ public class Graphics {
public void drawBorderImage(FImage image, Color borderColor, Color tintColor, float x, float y, float w, float h, boolean tint) { public void drawBorderImage(FImage image, Color borderColor, Color tintColor, float x, float y, float w, float h, boolean tint) {
float oldalpha = alphaComposite; float oldalpha = alphaComposite;
if(tint){ if(tint && !tintColor.equals(borderColor)){
drawRoundRect(2f, borderLining(borderColor.toString()), x, y, w, h, (h-w)/12); drawRoundRect(2f, borderLining(borderColor.toString()), x, y, w, h, (h-w)/12);
fillRoundRect(tintColor, x, y, w, h, (h-w)/12); fillRoundRect(tintColor, x, y, w, h, (h-w)/12);
} else { } else {

View File

@@ -288,15 +288,20 @@ public class ImageCache {
public static FImage getBorderImage(String textureString) { public static FImage getBorderImage(String textureString) {
return getBorder(textureString); return getBorder(textureString);
} }
public static Color getTint(CardView c) { public static Color getTint(CardView c, Texture t) {
if (c == null) if (c == null)
return Color.CLEAR; return borderColor(t);
if (c.isFaceDown()) if (c.isFaceDown())
return Color.CLEAR; return Color.valueOf("#171717");
//todo: determine correct splitcards colors
CardView.CardStateView state = c.getCurrentState(); CardView.CardStateView state = c.getCurrentState();
if (state.getColors().isColorless()) //Moonlace -> target spell or permanent becomes colorless. if (state.getColors().isColorless()) { //Moonlace -> target spell or permanent becomes colorless.
if (state.hasDevoid()) //devoid is colorless at all zones so return its corresponding border color...
return borderColor(t);
return Color.valueOf("#A0A6A4"); return Color.valueOf("#A0A6A4");
}
else if (state.getColors().isMonoColor()) { else if (state.getColors().isMonoColor()) {
if (state.getColors().hasBlack()) if (state.getColors().hasBlack())
return Color.valueOf("#48494a"); return Color.valueOf("#48494a");
@@ -311,6 +316,7 @@ public class ImageCache {
} }
else if (state.getColors().isMulticolor()) else if (state.getColors().isMulticolor())
return Color.valueOf("#F9E084"); return Color.valueOf("#F9E084");
return Color.CLEAR;
return borderColor(t);
} }
} }

View File

@@ -522,7 +522,7 @@ public class CardRenderer {
g.drawImage(image, x, y, w, h); g.drawImage(image, x, y, w, h);
else { else {
boolean t = (card.getCurrentState().getOriginalColors() != card.getCurrentState().getColors()) || card.getCurrentState().hasChangeColors(); boolean t = (card.getCurrentState().getOriginalColors() != card.getCurrentState().getColors()) || card.getCurrentState().hasChangeColors();
g.drawBorderImage(ImageCache.getBorderImage(image.toString(), canshow), ImageCache.borderColor(image), ImageCache.getTint(card), x, y, w, h, t); //tint check for changed colors g.drawBorderImage(ImageCache.getBorderImage(image.toString(), canshow), ImageCache.borderColor(image), ImageCache.getTint(card, image), x, y, w, h, t); //tint check for changed colors
g.drawImage(ImageCache.croppedBorderImage(image), x + radius / 2.4f-minusxy, y + radius / 2-minusxy, w * croppedArea, h * croppedArea); g.drawImage(ImageCache.croppedBorderImage(image), x + radius / 2.4f-minusxy, y + radius / 2-minusxy, w * croppedArea, h * croppedArea);
} }
} else { } else {