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