mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
update renderer for Spacecraft PT (#8178)
* update renderer for Spacecraft PT
This commit is contained in:
@@ -277,6 +277,10 @@ public final class CardRules implements ICardCharacteristics {
|
||||
return getType().isDungeon();
|
||||
}
|
||||
|
||||
public boolean hasPrintedPT() {
|
||||
return getPower() != null || getToughness() != null;
|
||||
}
|
||||
|
||||
public boolean canBeCommander() {
|
||||
if (mainPart.getOracleText().contains(" is your commander, choose a color before the game begins.")) {
|
||||
addsWildCardColor = true;
|
||||
|
||||
@@ -1098,6 +1098,7 @@ public class CardView extends GameEntityView {
|
||||
currentState.getView().setOriginalColors(c); //set original Colors
|
||||
|
||||
currentStateView.updateAttractionLights(currentState);
|
||||
currentStateView.updateHasPrintedPT(c.getRules() != null && c.getRules().hasPrintedPT());
|
||||
|
||||
CardState alternateState = isSplitCard && isFaceDown() ? c.getState(CardStateName.RightSplit) : c.getAlternateState();
|
||||
|
||||
@@ -1401,17 +1402,12 @@ 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);
|
||||
}
|
||||
void updatePower(Card c) {
|
||||
int num;
|
||||
if (getType().hasSubtype("Vehicle") && !isCreature()) {
|
||||
if (hasPrintedPT() && !isCreature()) {
|
||||
// use printed value so user can still see it
|
||||
num = c.getCurrentPower();
|
||||
} else {
|
||||
@@ -1436,7 +1432,7 @@ public class CardView extends GameEntityView {
|
||||
}
|
||||
void updateToughness(Card c) {
|
||||
int num;
|
||||
if (getType().hasSubtype("Vehicle") && !isCreature()) {
|
||||
if (hasPrintedPT() && !isCreature()) {
|
||||
// use printed value so user can still see it
|
||||
num = c.getCurrentToughness();
|
||||
} else {
|
||||
@@ -1521,6 +1517,13 @@ public class CardView extends GameEntityView {
|
||||
set(TrackableProperty.AttractionLights, c.getAttractionLights());
|
||||
}
|
||||
|
||||
public boolean hasPrintedPT() {
|
||||
return get(TrackableProperty.HasPrintedPT);
|
||||
}
|
||||
void updateHasPrintedPT(boolean val) {
|
||||
set(TrackableProperty.HasPrintedPT, val);
|
||||
}
|
||||
|
||||
public String getSetCode() {
|
||||
return get(TrackableProperty.SetCode);
|
||||
}
|
||||
@@ -1806,6 +1809,9 @@ public class CardView extends GameEntityView {
|
||||
public boolean isEnchantment() {
|
||||
return getType().isEnchantment();
|
||||
}
|
||||
public boolean isSpaceCraft() {
|
||||
return getType().hasSubtype("Spacecraft");
|
||||
}
|
||||
public boolean isAttraction() {
|
||||
return getType().isAttraction();
|
||||
}
|
||||
|
||||
@@ -137,6 +137,7 @@ public enum TrackableProperty {
|
||||
AttractionLights(TrackableTypes.IntegerSetType),
|
||||
ChangedColorWords(TrackableTypes.StringMapType),
|
||||
HasChangedColors(TrackableTypes.BooleanType),
|
||||
HasPrintedPT(TrackableTypes.BooleanType, FreezeMode.IgnoresFreeze),
|
||||
ChangedTypes(TrackableTypes.StringMapType),
|
||||
|
||||
//check produce mana for BG
|
||||
|
||||
@@ -294,8 +294,7 @@ 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() ||
|
||||
(state.getType().hasSubtype("Spacecraft") && state.hasPrintedPower())) {
|
||||
if (state.isCreature() || state.isPlaneswalker() | state.isBattle() || state.hasPrintedPT()) {
|
||||
//if P/T box needed, make room for it
|
||||
ptBoxHeight = headerHeight;
|
||||
}
|
||||
@@ -841,7 +840,7 @@ public class FCardImageRenderer {
|
||||
pieces.add(String.valueOf(state.getToughness()));
|
||||
}
|
||||
}
|
||||
else if (state.getType().hasSubtype("Spacecraft")) {
|
||||
else if (state.isSpaceCraft()) {
|
||||
Color [] scColor = { Color.BLACK };
|
||||
colors = scColor;
|
||||
TEXT_COLOR = Color.WHITE;
|
||||
|
||||
@@ -1046,7 +1046,7 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
else if (state.isCreature()) {
|
||||
sPt = state.getPower() + "/" + state.getToughness();
|
||||
}
|
||||
else if (state.getType().hasSubtype("Vehicle")) {
|
||||
else if (state.isVehicle()) {
|
||||
sPt = "[" + state.getPower() + "/" + state.getToughness() + "]";
|
||||
}
|
||||
else if (state.isPlaneswalker()) {
|
||||
|
||||
@@ -151,7 +151,7 @@ public class CardImageRenderer {
|
||||
float ptBoxHeight = 0;
|
||||
float textBoxHeight = h - headerHeight - artHeight - typeBoxHeight - outerBorderThickness - artInset;
|
||||
|
||||
if (state.isCreature() || state.isPlaneswalker() || state.getType().hasSubtype("Vehicle") || state.isBattle()) {
|
||||
if (state.isCreature() || state.isPlaneswalker() || state.hasPrintedPT() || state.isBattle()) {
|
||||
ptBoxHeight = 2 * PT_FONT.getCapHeight();
|
||||
}
|
||||
//space for artist
|
||||
@@ -724,7 +724,7 @@ public class CardImageRenderer {
|
||||
pieces.add(String.valueOf(state.getToughness()));
|
||||
} else if (state.isPlaneswalker()) {
|
||||
pieces.add(String.valueOf(state.getLoyalty()));
|
||||
} else if (state.getType().hasSubtype("Vehicle")) {
|
||||
} else if (state.hasPrintedPT()) {
|
||||
// TODO Invert color box for Vehicles?
|
||||
pieces.add("[");
|
||||
pieces.add(String.valueOf(state.getPower()));
|
||||
|
||||
@@ -1382,7 +1382,7 @@ public class CardRenderer {
|
||||
pieces.add(String.valueOf(details.getPower()));
|
||||
pieces.add("/");
|
||||
pieces.add(String.valueOf(details.getToughness()));
|
||||
} else if (details.getType().hasSubtype("Vehicle")) {
|
||||
} else if (details.hasPrintedPT()) {
|
||||
pieces.add("[");
|
||||
pieces.add(String.valueOf(details.getPower()));
|
||||
pieces.add("/");
|
||||
|
||||
@@ -174,17 +174,16 @@ public class CardDetailUtil {
|
||||
return "";
|
||||
}
|
||||
final StringBuilder ptText = new StringBuilder();
|
||||
boolean vehicle = card.getType().hasSubtype("Vehicle");
|
||||
if (vehicle && !card.isCreature()) {
|
||||
ptText.append("{");
|
||||
if (card.hasPrintedPT() && !card.isCreature()) {
|
||||
ptText.append("[");
|
||||
}
|
||||
|
||||
if (card.isCreature() || vehicle) {
|
||||
if (card.isCreature() || card.hasPrintedPT()) {
|
||||
ptText.append(card.getPower()).append(" / ").append(card.getToughness());
|
||||
}
|
||||
|
||||
if (vehicle && !card.isCreature()) {
|
||||
ptText.append("}");
|
||||
if (card.hasPrintedPT() && !card.isCreature()) {
|
||||
ptText.append("]");
|
||||
}
|
||||
|
||||
if (card.isPlaneswalker()) {
|
||||
|
||||
Reference in New Issue
Block a user