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);
|
||||
}
|
||||
|
||||
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() {
|
||||
return get(TrackableProperty.HasBackSide);
|
||||
}
|
||||
@@ -731,9 +745,8 @@ public class CardView extends GameEntityView {
|
||||
|
||||
CardState currentState = c.getCurrentState();
|
||||
if (isSplitCard) {
|
||||
if (c.getCurrentStateName() != CardStateName.LeftSplit && c.getCurrentStateName() != CardStateName.RightSplit && c.getCurrentStateName() != CardStateName.FaceDown) {
|
||||
currentState = c.getState(CardStateName.LeftSplit);
|
||||
}
|
||||
set(TrackableProperty.LeftSplitState, c.getState(CardStateName.LeftSplit).getView());
|
||||
set(TrackableProperty.RightSplitState, c.getState(CardStateName.RightSplit).getView());
|
||||
}
|
||||
|
||||
CardStateView currentStateView = currentState.getView();
|
||||
@@ -901,6 +914,12 @@ public class CardView extends GameEntityView {
|
||||
public ColorSet getOriginalColors() {
|
||||
return get(TrackableProperty.OriginalColors);
|
||||
}
|
||||
public ColorSet getLeftSplitColors() {
|
||||
return get(TrackableProperty.LeftSplitColors);
|
||||
}
|
||||
public ColorSet getRightSplitColors() {
|
||||
return get(TrackableProperty.RightSplitColors);
|
||||
}
|
||||
void updateColors(Card c) {
|
||||
set(TrackableProperty.Colors, c.determineColor());
|
||||
}
|
||||
@@ -909,6 +928,10 @@ public class CardView extends GameEntityView {
|
||||
}
|
||||
void setOriginalColors(Card c) {
|
||||
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) {
|
||||
set(TrackableProperty.HasChangedColors, hasChangeColor);
|
||||
|
||||
@@ -69,6 +69,8 @@ public enum TrackableProperty {
|
||||
PairedWith(TrackableTypes.CardViewType),
|
||||
CurrentState(TrackableTypes.CardStateViewType, FreezeMode.IgnoresFreeze),
|
||||
AlternateState(TrackableTypes.CardStateViewType, FreezeMode.IgnoresFreeze),
|
||||
LeftSplitState(TrackableTypes.CardStateViewType, FreezeMode.IgnoresFreeze),
|
||||
RightSplitState(TrackableTypes.CardStateViewType, FreezeMode.IgnoresFreeze),
|
||||
HiddenId(TrackableTypes.IntegerType),
|
||||
ExertedThisTurn(TrackableTypes.BooleanType),
|
||||
|
||||
@@ -76,6 +78,8 @@ public enum TrackableProperty {
|
||||
Name(TrackableTypes.StringType),
|
||||
Colors(TrackableTypes.ColorSetType),
|
||||
OriginalColors(TrackableTypes.ColorSetType),
|
||||
LeftSplitColors(TrackableTypes.ColorSetType),
|
||||
RightSplitColors(TrackableTypes.ColorSetType),
|
||||
ImageKey(TrackableTypes.StringType),
|
||||
Type(TrackableTypes.CardTypeViewType),
|
||||
ManaCost(TrackableTypes.ManaCostType),
|
||||
|
||||
@@ -294,8 +294,6 @@ public class ImageCache {
|
||||
if (c.isFaceDown())
|
||||
return Color.valueOf("#171717");
|
||||
|
||||
//todo: determine correct splitcards colors
|
||||
|
||||
CardView.CardStateView state = c.getCurrentState();
|
||||
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...
|
||||
|
||||
@@ -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) {
|
||||
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);
|
||||
float oldAlpha = g.getfloatAlphaComposite();
|
||||
boolean unselectable = !MatchController.instance.isSelectable(card) && MatchController.instance.isSelecting();
|
||||
@@ -560,7 +560,7 @@ public class CardRenderer {
|
||||
h -= 2 * padding;
|
||||
|
||||
// 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 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);
|
||||
@@ -932,8 +932,8 @@ public class CardRenderer {
|
||||
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.getCurrentState().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.getLeftSplitState().getManaCost(), x - padding, y + dy, w + 2 * padding, h, manaSymbolSize);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -382,7 +382,7 @@ public class VStack extends FDropDown {
|
||||
|
||||
x += 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;
|
||||
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) {
|
||||
CardView cv = ((IHasCardView)value).getCardView();
|
||||
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;
|
||||
x += dx;
|
||||
|
||||
Reference in New Issue
Block a user