mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 09:48:02 +00:00
Fix Split Cards Display
-Shows correct name & colors on card views, choice list and show correct border colors when an effect like Painter's Servant is in play...
This commit is contained in:
@@ -691,6 +691,20 @@ public class CardView extends GameEntityView {
|
|||||||
return get(TrackableProperty.AlternateState);
|
return get(TrackableProperty.AlternateState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasLeftSplitState() {
|
||||||
|
return getLeftSplitState() != null;
|
||||||
|
}
|
||||||
|
public CardStateView getLeftSplitState() {
|
||||||
|
return get(TrackableProperty.LeftSplitState);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasRightSplitState() {
|
||||||
|
return getRightSplitState() != null;
|
||||||
|
}
|
||||||
|
public CardStateView getRightSplitState() {
|
||||||
|
return get(TrackableProperty.RightSplitState);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasBackSide() {
|
public boolean hasBackSide() {
|
||||||
return get(TrackableProperty.HasBackSide);
|
return get(TrackableProperty.HasBackSide);
|
||||||
}
|
}
|
||||||
@@ -731,9 +745,8 @@ public class CardView extends GameEntityView {
|
|||||||
|
|
||||||
CardState currentState = c.getCurrentState();
|
CardState currentState = c.getCurrentState();
|
||||||
if (isSplitCard) {
|
if (isSplitCard) {
|
||||||
if (c.getCurrentStateName() != CardStateName.LeftSplit && c.getCurrentStateName() != CardStateName.RightSplit && c.getCurrentStateName() != CardStateName.FaceDown) {
|
set(TrackableProperty.LeftSplitState, c.getState(CardStateName.LeftSplit).getView());
|
||||||
currentState = c.getState(CardStateName.LeftSplit);
|
set(TrackableProperty.RightSplitState, c.getState(CardStateName.RightSplit).getView());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CardStateView currentStateView = currentState.getView();
|
CardStateView currentStateView = currentState.getView();
|
||||||
@@ -901,6 +914,12 @@ public class CardView extends GameEntityView {
|
|||||||
public ColorSet getOriginalColors() {
|
public ColorSet getOriginalColors() {
|
||||||
return get(TrackableProperty.OriginalColors);
|
return get(TrackableProperty.OriginalColors);
|
||||||
}
|
}
|
||||||
|
public ColorSet getLeftSplitColors() {
|
||||||
|
return get(TrackableProperty.LeftSplitColors);
|
||||||
|
}
|
||||||
|
public ColorSet getRightSplitColors() {
|
||||||
|
return get(TrackableProperty.RightSplitColors);
|
||||||
|
}
|
||||||
void updateColors(Card c) {
|
void updateColors(Card c) {
|
||||||
set(TrackableProperty.Colors, c.determineColor());
|
set(TrackableProperty.Colors, c.determineColor());
|
||||||
}
|
}
|
||||||
@@ -909,6 +928,10 @@ public class CardView extends GameEntityView {
|
|||||||
}
|
}
|
||||||
void setOriginalColors(Card c) {
|
void setOriginalColors(Card c) {
|
||||||
set(TrackableProperty.OriginalColors, c.determineColor());
|
set(TrackableProperty.OriginalColors, c.determineColor());
|
||||||
|
if (c.isSplitCard()) {
|
||||||
|
set(TrackableProperty.LeftSplitColors, c.determineColor(c.getState(CardStateName.LeftSplit)));
|
||||||
|
set(TrackableProperty.RightSplitColors, c.determineColor(c.getState(CardStateName.RightSplit)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void updateHasChangeColors(boolean hasChangeColor) {
|
void updateHasChangeColors(boolean hasChangeColor) {
|
||||||
set(TrackableProperty.HasChangedColors, hasChangeColor);
|
set(TrackableProperty.HasChangedColors, hasChangeColor);
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ public enum TrackableProperty {
|
|||||||
PairedWith(TrackableTypes.CardViewType),
|
PairedWith(TrackableTypes.CardViewType),
|
||||||
CurrentState(TrackableTypes.CardStateViewType, FreezeMode.IgnoresFreeze),
|
CurrentState(TrackableTypes.CardStateViewType, FreezeMode.IgnoresFreeze),
|
||||||
AlternateState(TrackableTypes.CardStateViewType, FreezeMode.IgnoresFreeze),
|
AlternateState(TrackableTypes.CardStateViewType, FreezeMode.IgnoresFreeze),
|
||||||
|
LeftSplitState(TrackableTypes.CardStateViewType, FreezeMode.IgnoresFreeze),
|
||||||
|
RightSplitState(TrackableTypes.CardStateViewType, FreezeMode.IgnoresFreeze),
|
||||||
HiddenId(TrackableTypes.IntegerType),
|
HiddenId(TrackableTypes.IntegerType),
|
||||||
ExertedThisTurn(TrackableTypes.BooleanType),
|
ExertedThisTurn(TrackableTypes.BooleanType),
|
||||||
|
|
||||||
@@ -76,6 +78,8 @@ public enum TrackableProperty {
|
|||||||
Name(TrackableTypes.StringType),
|
Name(TrackableTypes.StringType),
|
||||||
Colors(TrackableTypes.ColorSetType),
|
Colors(TrackableTypes.ColorSetType),
|
||||||
OriginalColors(TrackableTypes.ColorSetType),
|
OriginalColors(TrackableTypes.ColorSetType),
|
||||||
|
LeftSplitColors(TrackableTypes.ColorSetType),
|
||||||
|
RightSplitColors(TrackableTypes.ColorSetType),
|
||||||
ImageKey(TrackableTypes.StringType),
|
ImageKey(TrackableTypes.StringType),
|
||||||
Type(TrackableTypes.CardTypeViewType),
|
Type(TrackableTypes.CardTypeViewType),
|
||||||
ManaCost(TrackableTypes.ManaCostType),
|
ManaCost(TrackableTypes.ManaCostType),
|
||||||
|
|||||||
@@ -294,8 +294,6 @@ public class ImageCache {
|
|||||||
if (c.isFaceDown())
|
if (c.isFaceDown())
|
||||||
return Color.valueOf("#171717");
|
return Color.valueOf("#171717");
|
||||||
|
|
||||||
//todo: determine correct splitcards colors
|
|
||||||
|
|
||||||
CardView.CardStateView state = c.getCurrentState();
|
CardView.CardStateView state = c.getCurrentState();
|
||||||
if (state.getColors().isColorless()) { //Moonlace -> target spell or permanent becomes colorless.
|
if (state.getColors().isColorless()) { //Moonlace -> target spell or permanent becomes colorless.
|
||||||
if (state.hasDevoid()) //devoid is colorless at all zones so return its corresponding border color...
|
if (state.hasDevoid()) //devoid is colorless at all zones so return its corresponding border color...
|
||||||
|
|||||||
@@ -543,9 +543,9 @@ public class CardRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void drawCardWithOverlays(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos) {
|
public static void drawCardWithOverlays(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos) {
|
||||||
drawCardWithOverlays(g, card, x, y, w, h, pos, false, false);
|
drawCardWithOverlays(g, card, x, y, w, h, pos, false, false, false);
|
||||||
}
|
}
|
||||||
public static void drawCardWithOverlays(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos, boolean stackview, boolean showAltState) {
|
public static void drawCardWithOverlays(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos, boolean stackview, boolean showAltState, boolean isChoiceList) {
|
||||||
boolean canShow = MatchController.instance.mayView(card);
|
boolean canShow = MatchController.instance.mayView(card);
|
||||||
float oldAlpha = g.getfloatAlphaComposite();
|
float oldAlpha = g.getfloatAlphaComposite();
|
||||||
boolean unselectable = !MatchController.instance.isSelectable(card) && MatchController.instance.isSelecting();
|
boolean unselectable = !MatchController.instance.isSelectable(card) && MatchController.instance.isSelecting();
|
||||||
@@ -560,7 +560,7 @@ public class CardRenderer {
|
|||||||
h -= 2 * padding;
|
h -= 2 * padding;
|
||||||
|
|
||||||
// TODO: A hacky workaround is currently used to make the game not leak the color information for Morph cards.
|
// TODO: A hacky workaround is currently used to make the game not leak the color information for Morph cards.
|
||||||
final CardStateView details = showAltState ? card.getAlternateState() : card.getCurrentState();
|
final CardStateView details = showAltState ? card.getAlternateState() : isChoiceList && card.isSplitCard() ? card.getLeftSplitState() : card.getCurrentState();
|
||||||
final boolean isFaceDown = card.isFaceDown();
|
final boolean isFaceDown = card.isFaceDown();
|
||||||
final DetailColors borderColor = isFaceDown ? CardDetailUtil.DetailColors.FACE_DOWN : CardDetailUtil.getBorderColor(details, canShow); // canShow doesn't work here for face down Morphs
|
final DetailColors borderColor = isFaceDown ? CardDetailUtil.DetailColors.FACE_DOWN : CardDetailUtil.getBorderColor(details, canShow); // canShow doesn't work here for face down Morphs
|
||||||
Color color = FSkinColor.fromRGB(borderColor.r, borderColor.g, borderColor.b);
|
Color color = FSkinColor.fromRGB(borderColor.r, borderColor.g, borderColor.b);
|
||||||
@@ -932,8 +932,8 @@ public class CardRenderer {
|
|||||||
dy *= -1; // flip card costs for Aftermath cards
|
dy *= -1; // flip card costs for Aftermath cards
|
||||||
}
|
}
|
||||||
|
|
||||||
drawManaCost(g, card.getAlternateState().getManaCost(), x - padding, y - dy, w + 2 * padding, h, manaSymbolSize);
|
drawManaCost(g, card.getRightSplitState().getManaCost(), x - padding, y - dy, w + 2 * padding, h, manaSymbolSize);
|
||||||
drawManaCost(g, card.getCurrentState().getManaCost(), x - padding, y + dy, w + 2 * padding, h, manaSymbolSize);
|
drawManaCost(g, card.getLeftSplitState().getManaCost(), x - padding, y + dy, w + 2 * padding, h, manaSymbolSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ public class VStack extends FDropDown {
|
|||||||
|
|
||||||
x += PADDING;
|
x += PADDING;
|
||||||
y += PADDING;
|
y += PADDING;
|
||||||
CardRenderer.drawCardWithOverlays(g, stackInstance.getSourceCard(), x, y, CARD_WIDTH, CARD_HEIGHT, CardStackPosition.Top, true, false);
|
CardRenderer.drawCardWithOverlays(g, stackInstance.getSourceCard(), x, y, CARD_WIDTH, CARD_HEIGHT, CardStackPosition.Top, true, false, false);
|
||||||
|
|
||||||
x += CARD_WIDTH + PADDING;
|
x += CARD_WIDTH + PADDING;
|
||||||
w -= x + PADDING - BORDER_THICKNESS;
|
w -= x + PADDING - BORDER_THICKNESS;
|
||||||
|
|||||||
@@ -516,7 +516,7 @@ public class FChoiceList<T> extends FList<T> implements ActivateHandler {
|
|||||||
public void drawValue(Graphics g, T value, FSkinFont font, FSkinColor foreColor, boolean pressed, float x, float y, float w, float h) {
|
public void drawValue(Graphics g, T value, FSkinFont font, FSkinColor foreColor, boolean pressed, float x, float y, float w, float h) {
|
||||||
CardView cv = ((IHasCardView)value).getCardView();
|
CardView cv = ((IHasCardView)value).getCardView();
|
||||||
boolean showAlternate = showAlternate(cv, value.toString());
|
boolean showAlternate = showAlternate(cv, value.toString());
|
||||||
CardRenderer.drawCardWithOverlays(g, cv, x, y, VStack.CARD_WIDTH, VStack.CARD_HEIGHT, CardStackPosition.Top, false, showAlternate);
|
CardRenderer.drawCardWithOverlays(g, cv, x, y, VStack.CARD_WIDTH, VStack.CARD_HEIGHT, CardStackPosition.Top, false, showAlternate, true);
|
||||||
|
|
||||||
float dx = VStack.CARD_WIDTH + FList.PADDING;
|
float dx = VStack.CARD_WIDTH + FList.PADDING;
|
||||||
x += dx;
|
x += dx;
|
||||||
|
|||||||
Reference in New Issue
Block a user