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:
Anthony Calosa
2020-10-14 21:30:55 +08:00
parent 96a40ec733
commit fbf3c79c15
6 changed files with 37 additions and 12 deletions

View File

@@ -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...

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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;