fixed multicolored split cards rendering

This commit is contained in:
Evan Kranzler 2022-03-11 09:25:54 -05:00
parent 783ddb5bdc
commit db7eb398cc

View file

@ -49,8 +49,8 @@ public class ModernSplitCardRenderer extends ModernCardRenderer {
rightHalf.manaCostString = ManaSymbols.getClearManaCost(cardView.getRightSplitCostsStr());
leftHalf.manaCostString = ManaSymbols.getClearManaCost(cardView.getLeftSplitCostsStr());
rightHalf.color = getColorFromManaCostHack(cardView.getRightSplitCostsStr());
leftHalf.color = getColorFromManaCostHack(cardView.getLeftSplitCostsStr());
rightHalf.color = new ObjectColor(cardView.getRightSplitCostsStr());
leftHalf.color = new ObjectColor(cardView.getLeftSplitCostsStr());
parseRules(view.getRightSplitRules(), rightHalf.keywords, rightHalf.rules);
parseRules(view.getLeftSplitRules(), leftHalf.keywords, leftHalf.rules);
@ -123,24 +123,6 @@ public class ModernSplitCardRenderer extends ModernCardRenderer {
}
}
// Ugly hack used here because the card database doesn't actually store color
// for each half of split cards separately.
private ObjectColor getColorFromManaCostHack(String costs) {
ObjectColor c = new ObjectColor();
if (costs.contains("W")) {
c.setWhite(true);
} else if (costs.contains("U")) {
c.setBlue(true);
} else if (costs.contains("B")) {
c.setBlack(true);
} else if (costs.contains("R")) {
c.setRed(true);
} else if (costs.contains("G")) {
c.setGreen(true);
}
return c;
}
@Override
protected void drawBackground(Graphics2D g) {
if (cardView.isFaceDown()) {