mirror of
https://github.com/correl/mage.git
synced 2025-03-13 01:09:53 -09:00
Merge pull request #4430 from spjspj/master
Fix M15 colors for GW (was WG), GU (was UG), RW (was WR)
This commit is contained in:
commit
8db20dbe8d
2 changed files with 73 additions and 24 deletions
Mage.Client/src/main/java/org/mage/card/arcane
Mage/src/main/java/mage
|
@ -1127,7 +1127,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
protected static Paint getBorderPaint(ObjectColor colors, Collection<CardType> types, int width) {
|
||||
if (colors.isMulticolored()) {
|
||||
if (colors.getColorCount() == 2) {
|
||||
List<ObjectColor> twoColors = colors.getColors();
|
||||
List<ObjectColor> twoColors = colors.getTwoColorsInOrder();
|
||||
|
||||
// Two-color frames look better if we use a whiter white
|
||||
// than the normal white frame color for them, as the normal
|
||||
|
@ -1203,7 +1203,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
protected static Paint getTextboxPaint(ObjectColor colors, Collection<CardType> types, int width) {
|
||||
if (colors.isMulticolored()) {
|
||||
if (colors.getColorCount() == 2) {
|
||||
List<ObjectColor> twoColors = colors.getColors();
|
||||
List<ObjectColor> twoColors = colors.getTwoColorsInOrder();
|
||||
Color[] translatedColors;
|
||||
if (types.contains(CardType.LAND)) {
|
||||
translatedColors = new Color[]{
|
||||
|
|
|
@ -29,6 +29,7 @@ package mage;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
@ -176,6 +177,55 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
|
|||
return colors;
|
||||
}
|
||||
|
||||
public List<ObjectColor> getTwoColorsInOrder() {
|
||||
List<ObjectColor> colors = new ArrayList<>();
|
||||
int firstColor = 5000;
|
||||
int secondColor = -1;
|
||||
if (this.isWhite()) {
|
||||
firstColor = 1;
|
||||
secondColor = 1;
|
||||
}
|
||||
if (this.isBlue()) {
|
||||
firstColor = Math.min(firstColor, 2);
|
||||
secondColor = Math.max(secondColor, 2);
|
||||
}
|
||||
if (this.isBlack()) {
|
||||
firstColor = Math.min(firstColor, 3);
|
||||
secondColor = Math.max(secondColor, 3);
|
||||
}
|
||||
if (this.isRed()) {
|
||||
firstColor = Math.min(firstColor, 4);
|
||||
secondColor = Math.max(secondColor, 4);
|
||||
}
|
||||
if (this.isGreen()) {
|
||||
firstColor = Math.min(firstColor, 5);
|
||||
secondColor = Math.max(secondColor, 5);
|
||||
}
|
||||
if (this.isWhite()) {
|
||||
colors.add(ObjectColor.WHITE);
|
||||
}
|
||||
if (this.isBlue()) {
|
||||
colors.add(ObjectColor.BLUE);
|
||||
}
|
||||
if (this.isBlack()) {
|
||||
colors.add(ObjectColor.BLACK);
|
||||
}
|
||||
if (this.isRed()) {
|
||||
colors.add(ObjectColor.RED);
|
||||
}
|
||||
if (this.isGreen()) {
|
||||
colors.add(ObjectColor.GREEN);
|
||||
}
|
||||
if (colors.size() >= 2 && secondColor - firstColor >= 3) {
|
||||
Collections.swap(colors, 0, 1);
|
||||
}
|
||||
|
||||
if (this.isGold()) {
|
||||
colors.add(ObjectColor.GOLD);
|
||||
}
|
||||
return colors;
|
||||
}
|
||||
|
||||
public void setColor(ObjectColor color) {
|
||||
this.setBlack(color.isBlack());
|
||||
this.setBlue(color.isBlue());
|
||||
|
@ -281,7 +331,6 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
|
|||
this.green = green;
|
||||
}
|
||||
|
||||
|
||||
public boolean isGold() {
|
||||
return gold;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue