Basic renderer support for Spacecraft PT

This commit is contained in:
tool4EvEr
2025-07-23 19:11:47 +02:00
parent 854d6640d1
commit 234237b43a
2 changed files with 15 additions and 3 deletions

View File

@@ -1401,6 +1401,11 @@ public class CardView extends GameEntityView {
set(TrackableProperty.RulesText, rulesText);
}
public boolean hasPrintedPower() {
EnumMap props = getProps();
return props.containsKey(TrackableProperty.Power);
}
public int getPower() {
return get(TrackableProperty.Power);
}
@@ -1480,7 +1485,6 @@ public class CardView extends GameEntityView {
set(TrackableProperty.Loyalty, "0"); //alternates don't need loyalty
}
public String getDefense() {
return get(TrackableProperty.Defense);
}

View File

@@ -294,7 +294,8 @@ public class FCardImageRenderer {
int headerHeight = NAME_SIZE + 2 * HEADER_PADDING;
int typeBoxHeight = TYPE_SIZE + 2 * TYPE_PADDING;
int ptBoxHeight = 0;
if (state.isCreature() || state.isPlaneswalker() | state.isBattle() || state.isVehicle()) {
if (state.isCreature() || state.isPlaneswalker() | state.isBattle() || state.isVehicle() ||
(state.getType().hasSubtype("Spacecraft") && state.hasPrintedPower())) {
//if P/T box needed, make room for it
ptBoxHeight = headerHeight;
}
@@ -682,7 +683,6 @@ public class FCardImageRenderer {
new Rectangle(x, y, w, h), NAME_FONT, NAME_SIZE);
}
private static void drawArt(Graphics2D g, Color[] colors, int x, int y, int w, int h, BufferedImage art) {
if (art != null) {
int artWidth = art.getWidth();
@@ -841,6 +841,14 @@ public class FCardImageRenderer {
pieces.add(String.valueOf(state.getToughness()));
}
}
else if (state.getType().hasSubtype("Spacecraft")) {
Color [] scColor = { Color.BLACK };
colors = scColor;
TEXT_COLOR = Color.WHITE;
pieces.add(String.valueOf(state.getPower()));
pieces.add("/");
pieces.add(String.valueOf(state.getToughness()));
}
else if (state.isPlaneswalker()) {
Color [] pwColor = { Color.BLACK };
colors = pwColor;