mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 01:38:13 +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() {
|
||||
return get(TrackableProperty.CountOrigProduceColoredMana);
|
||||
}
|
||||
public int countBasicLandTypes() {
|
||||
return get(TrackableProperty.CountBasicLandTypes);
|
||||
}
|
||||
|
||||
public String getAbilityText() {
|
||||
return get(TrackableProperty.AbilityText);
|
||||
@@ -1382,6 +1385,7 @@ public class CardView extends GameEntityView {
|
||||
boolean wMana = false;
|
||||
boolean cMana = false;
|
||||
int count = 0;
|
||||
int basicLandTypes = 0;
|
||||
if (!state.getManaAbilities().isEmpty()) {
|
||||
for (SpellAbility sa : state.getManaAbilities()) {
|
||||
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.OrigProduceManaG, gMana);
|
||||
set(TrackableProperty.OrigProduceManaB, bMana);
|
||||
|
||||
@@ -120,6 +120,8 @@ public enum TrackableProperty {
|
||||
OrigProduceManaC(TrackableTypes.BooleanType),
|
||||
OrigProduceAnyMana(TrackableTypes.BooleanType),
|
||||
CountOrigProduceColoredMana(TrackableTypes.IntegerType),
|
||||
//number of basic landtypes
|
||||
CountBasicLandTypes(TrackableTypes.IntegerType),
|
||||
|
||||
KeywordKey(TrackableTypes.StringType),
|
||||
HasDeathtouch(TrackableTypes.BooleanType),
|
||||
|
||||
@@ -472,6 +472,12 @@ public class Graphics {
|
||||
|
||||
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) {
|
||||
fillRect(skinColor.getColor(), x, y, w, h);
|
||||
|
||||
@@ -395,6 +395,7 @@ public class CardImageRenderer {
|
||||
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) {
|
||||
boolean fakeDuals = false;
|
||||
//update land bg colors
|
||||
if (state.isLand()) {
|
||||
DetailColors modColors = DetailColors.WHITE;
|
||||
@@ -412,6 +413,7 @@ public class CardImageRenderer {
|
||||
} if (state.origCanProduceColoredMana() == 2) {
|
||||
//dual colors
|
||||
Color[] colorPairs = new Color[2];
|
||||
Color[] colorPairsBackup = new Color[2];
|
||||
//init Color
|
||||
colorPairs[0] = fromDetailColor(DetailColors.WHITE);
|
||||
colorPairs[1] = fromDetailColor(DetailColors.WHITE);
|
||||
@@ -420,17 +422,18 @@ public class CardImageRenderer {
|
||||
colorPairs[0] = fromDetailColor(DetailColors.MULTICOLOR);
|
||||
colorPairs[1] = fromDetailColor(DetailColors.MULTICOLOR);
|
||||
} else {
|
||||
fakeDuals = true;
|
||||
if (state.origProduceManaW() && state.origProduceManaU()) {
|
||||
colorPairs[0] = fromDetailColor(DetailColors.WHITE);
|
||||
colorPairs[0] = fromDetailColor(DetailColors.LAND);
|
||||
colorPairs[1] = fromDetailColor(DetailColors.BLUE);
|
||||
} else if (state.origProduceManaW() && state.origProduceManaB()) {
|
||||
colorPairs[0] = fromDetailColor(DetailColors.WHITE);
|
||||
colorPairs[0] = fromDetailColor(DetailColors.LAND);
|
||||
colorPairs[1] = fromDetailColor(DetailColors.BLACK);
|
||||
} else if (state.origProduceManaW() && state.origProduceManaR()) {
|
||||
colorPairs[0] = fromDetailColor(DetailColors.WHITE);
|
||||
colorPairs[0] = fromDetailColor(DetailColors.LAND);
|
||||
colorPairs[1] = fromDetailColor(DetailColors.RED);
|
||||
} else if (state.origProduceManaW() && state.origProduceManaG()) {
|
||||
colorPairs[0] = fromDetailColor(DetailColors.WHITE);
|
||||
colorPairs[0] = fromDetailColor(DetailColors.LAND);
|
||||
colorPairs[1] = fromDetailColor(DetailColors.GREEN);
|
||||
} else if (state.origProduceManaU() && state.origProduceManaB()) {
|
||||
colorPairs[0] = fromDetailColor(DetailColors.BLUE);
|
||||
@@ -452,6 +455,7 @@ public class CardImageRenderer {
|
||||
colorPairs[1] = fromDetailColor(DetailColors.GREEN);
|
||||
}
|
||||
}
|
||||
colorPairsBackup = colorPairs;
|
||||
colorPairs = FSkinColor.tintColors(Color.WHITE, colorPairs, 0.3f);
|
||||
float oldAlpha = g.getfloatAlphaComposite();
|
||||
if (!useCardBGTexture)
|
||||
@@ -459,6 +463,12 @@ public class CardImageRenderer {
|
||||
else {
|
||||
g.setAlphaComposite(0.95f);
|
||||
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);
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
List<String> pieces = new ArrayList<>();
|
||||
if (state.isCreature()) {
|
||||
|
||||
Reference in New Issue
Block a user