mirror of
https://github.com/correl/mage.git
synced 2025-04-13 01:01:11 -09:00
Fix M15 colors for GW (was WG), GU (was UG), RW (was WR)
This commit is contained in:
parent
b26cd21f02
commit
d095f83d8a
1 changed files with 51 additions and 79 deletions
|
@ -29,6 +29,7 @@ package mage;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@ -176,44 +177,30 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
|
||||||
return colors;
|
return colors;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getColorIndex(int current, int potentialNext, boolean wantMinimum) {
|
|
||||||
if (current == -1) {
|
|
||||||
return potentialNext;
|
|
||||||
}
|
|
||||||
if ((current < potentialNext) && wantMinimum) {
|
|
||||||
return current;
|
|
||||||
}
|
|
||||||
if ((current < potentialNext) && !wantMinimum) {
|
|
||||||
return potentialNext;
|
|
||||||
}
|
|
||||||
return current;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ObjectColor> getTwoColorsInOrder() {
|
public List<ObjectColor> getTwoColorsInOrder() {
|
||||||
List<ObjectColor> colors = new ArrayList<>();
|
List<ObjectColor> colors = new ArrayList<>();
|
||||||
int firstColor = -1;
|
int firstColor = 5000;
|
||||||
int secondColor = -1;
|
int secondColor = -1;
|
||||||
if (this.isWhite()) {
|
if (this.isWhite()) {
|
||||||
firstColor = getColorIndex(firstColor, 1, true);
|
firstColor = 1;
|
||||||
secondColor = getColorIndex(secondColor, 1, false);
|
secondColor = 1;
|
||||||
}
|
}
|
||||||
if (this.isBlue()) {
|
if (this.isBlue()) {
|
||||||
firstColor = getColorIndex(firstColor, 2, true);
|
firstColor = Math.min(firstColor, 2);
|
||||||
secondColor = getColorIndex(secondColor, 2, false);
|
secondColor = Math.max(secondColor, 2);
|
||||||
}
|
}
|
||||||
if (this.isBlack()) {
|
if (this.isBlack()) {
|
||||||
firstColor = getColorIndex(firstColor, 3, true);
|
firstColor = Math.min(firstColor, 3);
|
||||||
secondColor = getColorIndex(secondColor, 3, false);
|
secondColor = Math.max(secondColor, 3);
|
||||||
}
|
}
|
||||||
if (this.isRed()) {
|
if (this.isRed()) {
|
||||||
firstColor = getColorIndex(firstColor, 4, true);
|
firstColor = Math.min(firstColor, 4);
|
||||||
secondColor = getColorIndex(secondColor, 4, false);
|
secondColor = Math.max(secondColor, 4);
|
||||||
}
|
}
|
||||||
if (this.isGreen()) {
|
if (this.isGreen()) {
|
||||||
firstColor = getColorIndex(firstColor, 5, true);
|
firstColor = Math.min(firstColor, 5);
|
||||||
secondColor = getColorIndex(secondColor, 5, false);
|
secondColor = Math.max(secondColor, 5);
|
||||||
}
|
}
|
||||||
if (secondColor - firstColor <= 2) {
|
|
||||||
if (this.isWhite()) {
|
if (this.isWhite()) {
|
||||||
colors.add(ObjectColor.WHITE);
|
colors.add(ObjectColor.WHITE);
|
||||||
}
|
}
|
||||||
|
@ -229,22 +216,8 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
|
||||||
if (this.isGreen()) {
|
if (this.isGreen()) {
|
||||||
colors.add(ObjectColor.GREEN);
|
colors.add(ObjectColor.GREEN);
|
||||||
}
|
}
|
||||||
} else if (secondColor - firstColor >= 3) {
|
if (colors.size() >= 2 && secondColor - firstColor >= 3) {
|
||||||
if (this.isGreen()) {
|
Collections.swap(colors, 0, 1);
|
||||||
colors.add(ObjectColor.GREEN);
|
|
||||||
}
|
|
||||||
if (this.isRed()) {
|
|
||||||
colors.add(ObjectColor.RED);
|
|
||||||
}
|
|
||||||
if (this.isBlack()) {
|
|
||||||
colors.add(ObjectColor.BLACK);
|
|
||||||
}
|
|
||||||
if (this.isBlue()) {
|
|
||||||
colors.add(ObjectColor.BLUE);
|
|
||||||
}
|
|
||||||
if (this.isWhite()) {
|
|
||||||
colors.add(ObjectColor.WHITE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isGold()) {
|
if (this.isGold()) {
|
||||||
|
@ -358,7 +331,6 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
|
||||||
this.green = green;
|
this.green = green;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isGold() {
|
public boolean isGold() {
|
||||||
return gold;
|
return gold;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue