mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 17:58:01 +00:00
add alpha line design (dual lands)
This commit is contained in:
committed by
leriomaggio
parent
c9deab88bc
commit
c54421cdfc
@@ -1329,6 +1329,9 @@ public class CardView extends GameEntityView {
|
|||||||
public int origCanProduceColoredMana() {
|
public int origCanProduceColoredMana() {
|
||||||
return get(TrackableProperty.CountOrigProduceColoredMana);
|
return get(TrackableProperty.CountOrigProduceColoredMana);
|
||||||
}
|
}
|
||||||
|
public int countBasicLandTypes() {
|
||||||
|
return get(TrackableProperty.CountBasicLandTypes);
|
||||||
|
}
|
||||||
|
|
||||||
public String getAbilityText() {
|
public String getAbilityText() {
|
||||||
return get(TrackableProperty.AbilityText);
|
return get(TrackableProperty.AbilityText);
|
||||||
@@ -1382,6 +1385,7 @@ public class CardView extends GameEntityView {
|
|||||||
boolean wMana = false;
|
boolean wMana = false;
|
||||||
boolean cMana = false;
|
boolean cMana = false;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
int basicLandTypes = 0;
|
||||||
if (!state.getManaAbilities().isEmpty()) {
|
if (!state.getManaAbilities().isEmpty()) {
|
||||||
for (SpellAbility sa : state.getManaAbilities()) {
|
for (SpellAbility sa : state.getManaAbilities()) {
|
||||||
if (sa == null || sa.getManaPart() == null)
|
if (sa == null || sa.getManaPart() == null)
|
||||||
@@ -1428,6 +1432,17 @@ public class CardView extends GameEntityView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isForest())
|
||||||
|
basicLandTypes += 1;
|
||||||
|
if (isMountain())
|
||||||
|
basicLandTypes += 1;
|
||||||
|
if (isSwamp())
|
||||||
|
basicLandTypes += 1;
|
||||||
|
if (isPlains())
|
||||||
|
basicLandTypes += 1;
|
||||||
|
if (isIsland())
|
||||||
|
basicLandTypes += 1;
|
||||||
|
set(TrackableProperty.CountBasicLandTypes, basicLandTypes);
|
||||||
set(TrackableProperty.OrigProduceManaR, rMana);
|
set(TrackableProperty.OrigProduceManaR, rMana);
|
||||||
set(TrackableProperty.OrigProduceManaG, gMana);
|
set(TrackableProperty.OrigProduceManaG, gMana);
|
||||||
set(TrackableProperty.OrigProduceManaB, bMana);
|
set(TrackableProperty.OrigProduceManaB, bMana);
|
||||||
|
|||||||
@@ -120,6 +120,8 @@ public enum TrackableProperty {
|
|||||||
OrigProduceManaC(TrackableTypes.BooleanType),
|
OrigProduceManaC(TrackableTypes.BooleanType),
|
||||||
OrigProduceAnyMana(TrackableTypes.BooleanType),
|
OrigProduceAnyMana(TrackableTypes.BooleanType),
|
||||||
CountOrigProduceColoredMana(TrackableTypes.IntegerType),
|
CountOrigProduceColoredMana(TrackableTypes.IntegerType),
|
||||||
|
//number of basic landtypes
|
||||||
|
CountBasicLandTypes(TrackableTypes.IntegerType),
|
||||||
|
|
||||||
KeywordKey(TrackableTypes.StringType),
|
KeywordKey(TrackableTypes.StringType),
|
||||||
HasDeathtouch(TrackableTypes.BooleanType),
|
HasDeathtouch(TrackableTypes.BooleanType),
|
||||||
|
|||||||
@@ -472,6 +472,12 @@ public class Graphics {
|
|||||||
|
|
||||||
batch.begin();
|
batch.begin();
|
||||||
}
|
}
|
||||||
|
public void drawRectLines(float thickness, Color color, float x, float y, float w, float h) {
|
||||||
|
drawLine(thickness, color, x, y, x+w, y);
|
||||||
|
drawLine(thickness, color, x+thickness/2f, y+thickness/2f, x+thickness/2f, y+h-thickness/2f);
|
||||||
|
drawLine(thickness, color, x, y+h, x+w, y+h);
|
||||||
|
drawLine(thickness, color, x+w-thickness/2f, y+thickness/2f, x+w-thickness/2f, y+h-thickness/2f);
|
||||||
|
}
|
||||||
|
|
||||||
public void fillRect(FSkinColor skinColor, float x, float y, float w, float h) {
|
public void fillRect(FSkinColor skinColor, float x, float y, float w, float h) {
|
||||||
fillRect(skinColor.getColor(), x, y, w, h);
|
fillRect(skinColor.getColor(), x, y, w, h);
|
||||||
|
|||||||
@@ -395,6 +395,7 @@ public class CardImageRenderer {
|
|||||||
private static final TextRenderer cardTextRenderer = new TextRenderer(true);
|
private static final TextRenderer cardTextRenderer = new TextRenderer(true);
|
||||||
|
|
||||||
private static void drawTextBox(Graphics g, CardView card, CardStateView state, Color[] colors, float x, float y, float w, float h, boolean onTop, boolean useCardBGTexture, boolean noText) {
|
private static void drawTextBox(Graphics g, CardView card, CardStateView state, Color[] colors, float x, float y, float w, float h, boolean onTop, boolean useCardBGTexture, boolean noText) {
|
||||||
|
boolean fakeDuals = false;
|
||||||
//update land bg colors
|
//update land bg colors
|
||||||
if (state.isLand()) {
|
if (state.isLand()) {
|
||||||
DetailColors modColors = DetailColors.WHITE;
|
DetailColors modColors = DetailColors.WHITE;
|
||||||
@@ -412,6 +413,7 @@ public class CardImageRenderer {
|
|||||||
} if (state.origCanProduceColoredMana() == 2) {
|
} if (state.origCanProduceColoredMana() == 2) {
|
||||||
//dual colors
|
//dual colors
|
||||||
Color[] colorPairs = new Color[2];
|
Color[] colorPairs = new Color[2];
|
||||||
|
Color[] colorPairsBackup = new Color[2];
|
||||||
//init Color
|
//init Color
|
||||||
colorPairs[0] = fromDetailColor(DetailColors.WHITE);
|
colorPairs[0] = fromDetailColor(DetailColors.WHITE);
|
||||||
colorPairs[1] = fromDetailColor(DetailColors.WHITE);
|
colorPairs[1] = fromDetailColor(DetailColors.WHITE);
|
||||||
@@ -420,17 +422,18 @@ public class CardImageRenderer {
|
|||||||
colorPairs[0] = fromDetailColor(DetailColors.MULTICOLOR);
|
colorPairs[0] = fromDetailColor(DetailColors.MULTICOLOR);
|
||||||
colorPairs[1] = fromDetailColor(DetailColors.MULTICOLOR);
|
colorPairs[1] = fromDetailColor(DetailColors.MULTICOLOR);
|
||||||
} else {
|
} else {
|
||||||
|
fakeDuals = true;
|
||||||
if (state.origProduceManaW() && state.origProduceManaU()) {
|
if (state.origProduceManaW() && state.origProduceManaU()) {
|
||||||
colorPairs[0] = fromDetailColor(DetailColors.WHITE);
|
colorPairs[0] = fromDetailColor(DetailColors.LAND);
|
||||||
colorPairs[1] = fromDetailColor(DetailColors.BLUE);
|
colorPairs[1] = fromDetailColor(DetailColors.BLUE);
|
||||||
} else if (state.origProduceManaW() && state.origProduceManaB()) {
|
} else if (state.origProduceManaW() && state.origProduceManaB()) {
|
||||||
colorPairs[0] = fromDetailColor(DetailColors.WHITE);
|
colorPairs[0] = fromDetailColor(DetailColors.LAND);
|
||||||
colorPairs[1] = fromDetailColor(DetailColors.BLACK);
|
colorPairs[1] = fromDetailColor(DetailColors.BLACK);
|
||||||
} else if (state.origProduceManaW() && state.origProduceManaR()) {
|
} else if (state.origProduceManaW() && state.origProduceManaR()) {
|
||||||
colorPairs[0] = fromDetailColor(DetailColors.WHITE);
|
colorPairs[0] = fromDetailColor(DetailColors.LAND);
|
||||||
colorPairs[1] = fromDetailColor(DetailColors.RED);
|
colorPairs[1] = fromDetailColor(DetailColors.RED);
|
||||||
} else if (state.origProduceManaW() && state.origProduceManaG()) {
|
} else if (state.origProduceManaW() && state.origProduceManaG()) {
|
||||||
colorPairs[0] = fromDetailColor(DetailColors.WHITE);
|
colorPairs[0] = fromDetailColor(DetailColors.LAND);
|
||||||
colorPairs[1] = fromDetailColor(DetailColors.GREEN);
|
colorPairs[1] = fromDetailColor(DetailColors.GREEN);
|
||||||
} else if (state.origProduceManaU() && state.origProduceManaB()) {
|
} else if (state.origProduceManaU() && state.origProduceManaB()) {
|
||||||
colorPairs[0] = fromDetailColor(DetailColors.BLUE);
|
colorPairs[0] = fromDetailColor(DetailColors.BLUE);
|
||||||
@@ -452,6 +455,7 @@ public class CardImageRenderer {
|
|||||||
colorPairs[1] = fromDetailColor(DetailColors.GREEN);
|
colorPairs[1] = fromDetailColor(DetailColors.GREEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
colorPairsBackup = colorPairs;
|
||||||
colorPairs = FSkinColor.tintColors(Color.WHITE, colorPairs, 0.3f);
|
colorPairs = FSkinColor.tintColors(Color.WHITE, colorPairs, 0.3f);
|
||||||
float oldAlpha = g.getfloatAlphaComposite();
|
float oldAlpha = g.getfloatAlphaComposite();
|
||||||
if (!useCardBGTexture)
|
if (!useCardBGTexture)
|
||||||
@@ -459,6 +463,12 @@ public class CardImageRenderer {
|
|||||||
else {
|
else {
|
||||||
g.setAlphaComposite(0.95f);
|
g.setAlphaComposite(0.95f);
|
||||||
fillColorBackground(g, colorPairs, x, y, w, h);
|
fillColorBackground(g, colorPairs, x, y, w, h);
|
||||||
|
if (fakeDuals && state.countBasicLandTypes() == 2) {
|
||||||
|
float thickness = h/16f;
|
||||||
|
float mod = 2f*thickness/2f;
|
||||||
|
g.setAlphaComposite(0.2f);
|
||||||
|
drawAlphaLines(colorPairsBackup, g, x, y, w, h, thickness, mod);
|
||||||
|
}
|
||||||
g.setAlphaComposite(oldAlpha);
|
g.setAlphaComposite(oldAlpha);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -544,7 +554,23 @@ public class CardImageRenderer {
|
|||||||
cardTextRenderer.drawText(g, text, TEXT_FONT, Color.BLACK, x, y, w, h, y, h, true, Align.left, true);
|
cardTextRenderer.drawText(g, text, TEXT_FONT, Color.BLACK, x, y, w, h, y, h, true, Align.left, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private static void drawAlphaLines(Color[] colors, Graphics g, float x, float y, float w, float h, float thickness, float mod) {
|
||||||
|
g.drawRectLines(thickness, colors[1], x+mod, y+mod, w-(mod*2f), h-(mod*2f));
|
||||||
|
mod = 4f*thickness/2f;
|
||||||
|
g.drawRectLines(thickness, colors[0], x+mod, y+mod, w-(mod*2f), h-(mod*2f));
|
||||||
|
mod = 6f*thickness/2f;
|
||||||
|
g.drawRectLines(thickness, colors[1], x+mod, y+mod, w-(mod*2f), h-(mod*2f));
|
||||||
|
mod = 8f*thickness/2f;
|
||||||
|
g.drawRectLines(thickness, colors[0], x+mod, y+mod, w-(mod*2f), h-(mod*2f));
|
||||||
|
mod = 10f*thickness/2f;
|
||||||
|
g.drawRectLines(thickness, colors[1], x+mod, y+mod, w-(mod*2f), h-(mod*2f));
|
||||||
|
mod = 12f*thickness/2f;
|
||||||
|
g.drawRectLines(thickness, colors[0], x+mod, y+mod, w-(mod*2f), h-(mod*2f));
|
||||||
|
mod = 14f*thickness/2f;
|
||||||
|
g.drawRectLines(thickness, colors[1], x+mod, y+mod, w-(mod*2f), h-(mod*2f));
|
||||||
|
mod = 16f*thickness/2f;
|
||||||
|
g.drawLine(thickness, colors[1], x+mod, y+mod, x+w-mod, y+mod);
|
||||||
|
}
|
||||||
private static void drawPtBox(Graphics g, CardView card, CardStateView state, Color[] colors, float x, float y, float w, float h, boolean noText) {
|
private static void drawPtBox(Graphics g, CardView card, CardStateView state, Color[] colors, float x, float y, float w, float h, boolean noText) {
|
||||||
List<String> pieces = new ArrayList<>();
|
List<String> pieces = new ArrayList<>();
|
||||||
if (state.isCreature()) {
|
if (state.isCreature()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user