- Added Color.java and Card_Color.java

- Added a separate monitoring of a cards color, that handles color changing
- Tokens now set Color when created. In general, tokens don't have mana costs and we'll need to remove setting of mana costs except in a few circumstances.
- Updated Painter's Servant, Disciple of Kangee, and Wild Mongrel
- A few things are still needed overall for this to work going forward, but it seems to be at a point to get this in.
This commit is contained in:
jendave
2011-08-06 08:17:47 +00:00
parent b642570935
commit 99f1685aa9
12 changed files with 426 additions and 188 deletions

2
.gitattributes vendored
View File

@@ -4725,6 +4725,8 @@ src/forge/CardListFilter.java svneol=native#text/plain
src/forge/CardListUtil.java -text svneol=native#text/plain
src/forge/CardShopTableModel.java -text svneol=native#text/plain
src/forge/CardUtil.java svneol=native#text/plain
src/forge/Card_Color.java -text svneol=native#text/plain
src/forge/Color.java -text svneol=native#text/plain
src/forge/Combat.java svneol=native#text/plain
src/forge/CombatPlaneswalker.java svneol=native#text/plain
src/forge/CombatUtil.java svneol=native#text/plain

View File

@@ -1,7 +1,7 @@
Name:Wild Mongrel
ManaCost:1 G
Types:Creature Hound
Text:(NOTE: " and becomes color of your choice." not implemented.)
Text:no text
PT:2/2
SVar:Rarity:Common
SVar:Picture:http://resources.wizards.com/magic/cards/od/en-us/card29777.jpg

View File

@@ -39,7 +39,7 @@ public class Card extends MyObservable {
private ArrayList<String> Targets_for_Choices = new ArrayList<String>();
private ArrayList<SpellAbility> spellAbility = new ArrayList<SpellAbility>();
private ArrayList<Ability_Mana> manaAbility = new ArrayList<Ability_Mana>();
private ArrayList<Card_Color> cardColor = new ArrayList<Card_Color>();
private HashMap<Card, Integer> receivedDamageFromThisTurn = new HashMap<Card, Integer>();
private HashMap<Card, Integer> assignedDamageHashMap = new HashMap<Card, Integer>();
@@ -487,6 +487,83 @@ public class Card extends MyObservable {
return manaCost;
}
public void addColor(String s){
if (s.equals(""))
s = "0";
cardColor.add(new Card_Color(new ManaCost(s), this, false));
}
public long addColor(String s, Card c, boolean addToColors, boolean bIncrease){
if (bIncrease)
Card_Color.increaseTimestamp();
cardColor.add(new Card_Color(new ManaCost(s), c, addToColors));
return Card_Color.getTimestamp();
}
public void removeColor(String s, Card c, boolean addTo, long timestamp){
Card_Color removeCol = null;
for(Card_Color cc : cardColor)
if (cc.equals(s, c, addTo, timestamp))
removeCol = cc;
if (removeCol != null)
cardColor.remove(removeCol);
}
public Card_Color getColor(){
if (this.isImmutable()){
return new Card_Color(this);
}
Card_Color colors = null;
ArrayList<Card_Color> globalChanges = AllZone.GameInfo.getColorChanges();
colors = determineColor(globalChanges);
colors.fixColorless();
return colors;
}
Card_Color determineColor(ArrayList<Card_Color> globalChanges){
Card_Color colors = new Card_Color(this);
int i = cardColor.size() - 1;
int j = globalChanges.size() - 1;
// if both have changes, see which one is most recent
while(i >= 0 && j >= 0){
Card_Color cc = null;
if (cardColor.get(i).getStamp() > globalChanges.get(j).getStamp()){
// Card has a more recent color stamp
cc = cardColor.get(i);
i--;
}
else{
// Global effect has a more recent color stamp
cc = globalChanges.get(j);
j--;
}
for (String s : cc.toStringArray())
colors.addToCardColor(s);
if (!cc.getAdditional())
return colors;
}
while(i >= 0){
Card_Color cc = cardColor.get(i);
i--;
for(String s : cc.toStringArray())
colors.addToCardColor(s);
if (!cc.getAdditional())
return colors;
}
while(j >= 0){
Card_Color cc = globalChanges.get(j);
j--;
for(String s : cc.toStringArray())
colors.addToCardColor(s);
if (!cc.getAdditional())
return colors;
}
return colors;
}
public int getCMC()
{
return CardUtil.getConvertedManaCost(manaCost);

View File

@@ -10781,6 +10781,21 @@ public class CardFactory implements NewConstants {
}//getCard2
public Card postFactoryKeywords(Card card){
card.addColor(card.getManaCost());
int cardnameSpot = hasKeyword(card, "CARDNAME is ");
if (cardnameSpot != -1){
String color = "1";
while(cardnameSpot != -1){
if(cardnameSpot != -1) {
String parse = card.getKeyword().get(cardnameSpot).toString();
card.removeIntrinsicKeyword(parse);
color += " " + Input_PayManaCostUtil.getShortColorString(parse.replace("CARDNAME is ","").replace(".", ""));
cardnameSpot = hasKeyword(card, "CARDNAME is ");
}
}
card.addColor(color);
}
// this function should handle any keywords that need to be added after a spell goes through the factory
if(hasKeyword(card, "Fading") != -1) {
int n = hasKeyword(card, "Fading");

View File

@@ -1070,8 +1070,6 @@ public class CardFactoryUtil {
}
};
ability.setDescription("Remove three spore counters from CARDNAME: Put a 1/1 green Saproling creature token onto the battlefield.");
// ability.setDescription("Remove three spore counters from " + sourceCard.getName()
// + ": Put a 1/1 green Saproling creature token onto the battlefield.");
ability.setStackDescription(sourceCard.getName()
+ " - put a 1/1 green Saproling creature token onto the battlefield.");
return ability;
@@ -3719,7 +3717,7 @@ public class CardFactoryUtil {
if(sq[0].contains("White")) {
someCards = someCards.filter(new CardListFilter() {
public boolean addCard(Card c) {
return CardUtil.getColor(c) == Constant.Color.White;
return CardUtil.isColor(c, Constant.Color.White);
}
});
}
@@ -3727,7 +3725,7 @@ public class CardFactoryUtil {
if(sq[0].contains("Blue")) {
someCards = someCards.filter(new CardListFilter() {
public boolean addCard(Card c) {
return CardUtil.getColor(c) == Constant.Color.Blue;
return CardUtil.isColor(c, Constant.Color.Blue);
}
});
}
@@ -3735,7 +3733,7 @@ public class CardFactoryUtil {
if(sq[0].contains("Black")) {
someCards = someCards.filter(new CardListFilter() {
public boolean addCard(Card c) {
return CardUtil.getColor(c) == Constant.Color.Black;
return CardUtil.isColor(c, Constant.Color.Black);
}
});
}
@@ -3743,7 +3741,7 @@ public class CardFactoryUtil {
if(sq[0].contains("Red")) {
someCards = someCards.filter(new CardListFilter() {
public boolean addCard(Card c) {
return CardUtil.getColor(c) == Constant.Color.Red;
return CardUtil.isColor(c, Constant.Color.Red);
}
});
}
@@ -3751,7 +3749,7 @@ public class CardFactoryUtil {
if(sq[0].contains("Green")) {
someCards = someCards.filter(new CardListFilter() {
public boolean addCard(Card c) {
return CardUtil.getColor(c) == Constant.Color.Green;
return CardUtil.isColor(c, Constant.Color.Green);
}
});
}
@@ -4228,7 +4226,8 @@ public class CardFactoryUtil {
//c.setController(source.getController());
//c.setOwner(source.getOwner());
c.setManaCost(manaCost);
c.setManaCost(manaCost); // todo: most tokens mana cost is 0, this needs to be fixed
c.addColor(manaCost);
c.setToken(true);
for(String t:types)
@@ -4266,7 +4265,9 @@ public class CardFactoryUtil {
//c.setController(controller);
//c.setOwner(controller);
// todo: most tokens mana cost is 0, this needs to be fixed
c.setManaCost(manaCost);
c.addColor(manaCost);
c.setToken(true);
for(String t:types)

View File

@@ -6001,46 +6001,24 @@ public class CardFactory_Creatures {
if (AllZone.GameAction.isCardInPlay(getTargetCard()) &&
CardFactoryUtil.canTarget(card, getTargetCard())) {
final Card[] creature = new Card[1];
final long timestamp;
creature[0] = getTargetCard();
final String origManaCost = creature[0].getManaCost();
final String tgtName = creature[0].getName();
final String[] creatureIsColor = {
tgtName + " is black.", tgtName + " is blue.", tgtName + " is green.",
tgtName + " is red.", tgtName + " is white.", tgtName + " is colorless."};
final boolean[] colorFlag = {false, false, false, false, false, false};
for(int i = 0; i < 6; i++) {
if (creature[0].getIntrinsicKeyword().contains(creatureIsColor[i])) {
colorFlag[i] = true;
}
}
creature[0].addExtrinsicKeyword("Flying");
timestamp = creature[0].addColor("U", card, false, true);
final Command EOT = new Command() {
private static final long serialVersionUID = -1899153704584793548L;
public void execute() {
if (AllZone.GameAction.isCardInPlay(creature[0])) {
creature[0].removeExtrinsicKeyword("Flying");
creature[0].removeIntrinsicKeyword("CARDNAME is blue.");
creature[0].setManaCost(origManaCost);
for (int i = 0; i < 6; i++) {
if (colorFlag[i]) {
creature[0].addIntrinsicKeyword(creatureIsColor[i]);
}
}
creature[0].removeColor("U", card, false, timestamp);
}
}
};
creature[0].setManaCost(Integer.toString(CardUtil.getConvertedManaCost(origManaCost)));
for (int i = 0; i < 6; i++) {
if (colorFlag[i]) {
creature[0].removeIntrinsicKeyword(creatureIsColor[i]);
}
}
creature[0].addExtrinsicKeyword("Flying");
creature[0].addIntrinsicKeyword("CARDNAME is blue.");
AllZone.EndOfTurn.addUntil(EOT);
}//if (card is in play)
}//resolve()
};//SpellAbility
@@ -8190,6 +8168,10 @@ public class CardFactory_Creatures {
//*************** START *********** START **************************
else if(cardName.equals("Wild Mongrel")) {
final String[] color = new String[1];
final long[] timeStamp = new long[1];
//sacrifice ability - targets itself - until EOT
final Command untilEOT = new Command() {
private static final long serialVersionUID = -5563743272875711445L;
@@ -8197,6 +8179,9 @@ public class CardFactory_Creatures {
public void execute() {
card.addTempAttackBoost(-1);
card.addTempDefenseBoost(-1);
String s = CardUtil.getShortColor(color[0]);
card.removeColor(s, card, false, timeStamp[0]);
card.setChosenColor("");
}
};
@@ -8218,7 +8203,36 @@ public class CardFactory_Creatures {
if(AllZone.GameAction.isCardInPlay(card)) {
card.addTempAttackBoost(1);
card.addTempDefenseBoost(1);
if(card.getController().equals(Constant.Player.Human)) {
String[] colors = Constant.Color.onlyColors;
Object o = AllZone.Display.getChoice("Choose color", colors);
color[0] = (String) o;
card.setChosenColor(color[0]);
} else {
// wild mongrel will choose a color that appears the most, but that might not be right way to choose
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, Constant.Player.Computer);
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, Constant.Player.Computer);
CardList list = new CardList();
list.addAll(lib.getCards());
list.addAll(hand.getCards());
list.addAll(AllZone.Computer_Play.getCards());
color[0] = Constant.Color.White;
int max = list.getKeywordsContain(color[0]).size();
String[] colors = { Constant.Color.Blue, Constant.Color.Black, Constant.Color.Red, Constant.Color.Green };
for(String c : colors){
int cmp = list.getKeywordsContain(c).size();
if (cmp > max){
max = cmp;
color[0] = c;
}
}
card.setChosenColor(color[0]);
}
String s = CardUtil.getShortColor(color[0]);
timeStamp[0] = card.addColor(s, card, false, true);
AllZone.EndOfTurn.addUntil(untilEOT);
}
}//resolve()
@@ -8231,13 +8245,11 @@ public class CardFactory_Creatures {
@Override
public void showMessage() {
ability.setStackDescription(card + " gets +1/+1 until EOT.");
//stopSetNext(CardFactoryUtil.input_sacrifice(ability, choice, "Select a card to discard."));
stopSetNext(CardFactoryUtil.input_discard(ability, 1));
//AllZone.InputControl.setInput(CardFactoryUtil.input_discard());
}
};
ability.setStackDescription(card + " gets +1/+1 until end of turn.");
ability.setDescription("Discard a card: Wild Mongrel gets +1/+1 until end of turn.");
ability.setStackDescription(card + " gets +1/+1 and becomes the color of your choiceuntil end of turn.");
ability.setDescription("Discard a card: Wild Mongrel gets +1/+1 and becomes the color of your choice until end of turn.");
card.addSpellAbility(ability);
ability.setBeforePayMana(runtime);
}//*************** END ************ END **************************
@@ -8988,65 +9000,72 @@ public class CardFactory_Creatures {
//*************** START *********** START **************************
else if(cardName.equals("Painter's Servant")) {
final Ability ability = new Ability(card, "0") {
@Override
public void resolve() {
if(card.getController().equals(Constant.Player.Human)) {
String color = "";
// String[] colors = Constant.Color.Colors;
// colors[colors.length - 1] = null;
String[] colors = Constant.Color.onlyColors;
Object o = AllZone.Display.getChoice("Choose color", colors);
color = (String) o;
card.setChosenColor(color);
} else {
// AI chooses the color that appears in the keywords of the most cards in its deck, hand and on battlefield
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, Constant.Player.Computer);
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, Constant.Player.Computer);
CardList list = new CardList();
list.addAll(lib.getCards());
list.addAll(hand.getCards());
list.addAll(AllZone.Computer_Play.getCards());
int white = list.getKeywordsContain("white").size();
int blue = list.getKeywordsContain("blue").size();
int black = list.getKeywordsContain("black").size();
int red = list.getKeywordsContain("red").size();
int green = list.getKeywordsContain("green").size();
String maxColor = "white";
int maxamount = white;
if (maxamount < blue) {
maxamount = blue;
maxColor = "blue";
}
if (maxamount < black) {
maxamount = black;
maxColor = "black";
}
if (maxamount < red) {
maxamount = red;
maxColor = "red";
}
if (maxamount < green) {
maxamount = green;
maxColor = "green";
}
card.setChosenColor(maxColor);
final long[] timeStamp = new long[1];
final String[] color = new String[1];
final Ability ability = new Ability(card, "0") {
@Override
public void resolve() {
if(card.getController().equals(Constant.Player.Human)) {
String[] colors = Constant.Color.onlyColors;
Object o = AllZone.Display.getChoice("Choose color", colors);
color[0] = (String) o;
card.setChosenColor(color[0]);
} else {
// AI chooses the color that appears in the keywords of the most cards in its deck, hand and on battlefield
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, Constant.Player.Computer);
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, Constant.Player.Computer);
CardList list = new CardList();
list.addAll(lib.getCards());
list.addAll(hand.getCards());
list.addAll(AllZone.Computer_Play.getCards());
color[0] = Constant.Color.White;
int max = list.getKeywordsContain(color[0]).size();
String[] colors = { Constant.Color.Blue, Constant.Color.Black, Constant.Color.Red, Constant.Color.Green };
for(String c : colors){
int cmp = list.getKeywordsContain(c).size();
if (cmp > max){
max = cmp;
color[0] = c;
}
}
card.setChosenColor(color[0]);
}
};
Command comesIntoPlay = new Command() {
private static final long serialVersionUID = 333134223161L;
public void execute() {
AllZone.Stack.add(ability);
}
};//Command
ability.setStackDescription("As Painter's Servant enters the battlefield, choose a color.");
card.addComesIntoPlayCommand(comesIntoPlay);
String s = CardUtil.getShortColor(color[0]);
timeStamp[0] = AllZone.GameInfo.addColorChanges(s, card, true, true);
}
};
Command comesIntoPlay = new Command() {
private static final long serialVersionUID = 333134223161L;
public void execute() {
AllZone.Stack.add(ability);
}
};//Command
final Ability unpaint = new Ability(card, "0") {
public void resolve(){
String s = CardUtil.getShortColor(color[0]);
AllZone.GameInfo.removeColorChanges(s, card, true, timeStamp[0]);
}
};
Command leavesBattlefield = new Command() {
private static final long serialVersionUID = 2559212590399132459L;
public void execute(){
AllZone.Stack.add(unpaint);
}
};
ability.setStackDescription("As Painter's Servant enters the battlefield, choose a color.");
unpaint.setStackDescription("Painter's Servant left the battlefield, resetting colors.");
card.addComesIntoPlayCommand(comesIntoPlay);
card.addLeavesPlayCommand(leavesBattlefield);
}//*************** END ************ END **************************
//*************** START *********** START **************************

View File

@@ -85,60 +85,13 @@ public class CardUtil {
return (String) o;
}
//returns something like Constant.Color.Green or something
public static String getColor(Card c) {
String manaCost = c.getManaCost();
if(-1 != manaCost.indexOf("G")) return Constant.Color.Green;
else if(-1 != manaCost.indexOf("W")) return Constant.Color.White;
else if(-1 != manaCost.indexOf("B")) return Constant.Color.Black;
else if(-1 != manaCost.indexOf("U")) return Constant.Color.Blue;
else if(-1 != manaCost.indexOf("R")) return Constant.Color.Red;
else return Constant.Color.Colorless;
public static boolean isColor(Card c, String col) {
ArrayList<String> list = getColors(c);
return list.contains(col);
}
public static ArrayList<String> getColors(Card c) {
String m = c.getManaCost();
Set<String> colors = new HashSet<String>();
for(int i = 0; i < m.length(); i++) {
switch(m.charAt(i)) {
case ' ':
break;
case 'G':
colors.add(Constant.Color.Green);
break;
case 'W':
colors.add(Constant.Color.White);
break;
case 'B':
colors.add(Constant.Color.Black);
break;
case 'U':
colors.add(Constant.Color.Blue);
break;
case 'R':
colors.add(Constant.Color.Red);
break;
}
}
for(String kw : c.getKeyword())
if(kw.startsWith(c.getName()+" is ") || kw.startsWith("CARDNAME is "))
for(String color : Constant.Color.Colors)
if(kw.endsWith(color+"."))
colors.add(color);
if(colors.contains(Constant.Color.Colorless))
colors.clear();
// Painter's
CardList list = AllZoneUtil.getCardsInPlay("Painter's Servant");
if(list.size() > 0){
for(int i = 0; i < list.size(); i++) colors.add(list.get(i).getChosenColor());
}
//Painter's
if(colors.isEmpty()) colors.add(Constant.Color.Colorless);
return new ArrayList<String>(colors);
return c.getColor().toStringArray();
}
public static ArrayList<String> getOnlyColors(Card c) {

64
src/forge/Card_Color.java Normal file
View File

@@ -0,0 +1,64 @@
package forge;
import java.util.ArrayList;
import java.util.EnumSet;
public class Card_Color {
// takes care of individual card color, for global color change effects use AllZone.GameInfo.getColorChanges()
private EnumSet<Color> col;
private boolean additional;
public boolean getAdditional() { return additional; }
private Card effectingCard = null;
private long stamp = 0;
public long getStamp() { return stamp; }
private static long timeStamp = 0;
public static long getTimestamp() { return timeStamp; }
Card_Color(ManaCost mc, Card c, boolean addToColors){
additional = addToColors;
col = Color.ConvertManaCostToColor(mc);
effectingCard = c;
stamp = timeStamp;
}
public Card_Color(Card c) {
col = Color.Colorless();
additional = false;
stamp = 0;
effectingCard = c;
}
boolean addToCardColor(String s){
Color c = Color.ConvertFromString(s);
if (!col.contains(c)){
col.add(c);
return true;
}
return false;
}
void fixColorless(){
if (col.size() > 1 && col.contains(Color.Colorless))
col.remove(Color.Colorless);
}
static void increaseTimestamp() { timeStamp++; }
public boolean equals(String cost, Card c, boolean addToColors, long time){
return effectingCard == c && addToColors == additional && stamp == time;
}
public ArrayList<String> toStringArray(){
ArrayList<String> list = new ArrayList<String>();
for(Color c : col)
list.add(c.toString());
return list;
}
public static void main(String[] args) {
ManaCost mc = new ManaCost("R W U");
EnumSet<Color> col = Color.ConvertManaCostToColor(mc);
System.out.println(col.toString());
}
}

88
src/forge/Color.java Normal file
View File

@@ -0,0 +1,88 @@
package forge;
import java.util.EnumSet;
public enum Color {
Colorless(0),
White(1),
Green(2),
Red(4),
Black(8),
Blue(16);
@SuppressWarnings("unused")
private int flag = 0;
Color(int c){
flag = c;
}
public static EnumSet<Color> Colorless(){
EnumSet<Color> colors = EnumSet.of(Color.Colorless);
return colors;
}
public static EnumSet<Color> ConvertStringsToColor(String[] s){
EnumSet<Color> colors = EnumSet.of(Color.Colorless);
for(int i = 0; i < s.length; i++){
colors.add(ConvertFromString(s[i]));
}
if (colors.size() > 1)
colors.remove(Color.Colorless);
return colors;
}
public static Color ConvertFromString(String s){
{
if (s.equals(Constant.Color.White))
return Color.White;
else if (s.equals(Constant.Color.Green))
return Color.Green;
else if (s.equals(Constant.Color.Red))
return Color.Red;
else if (s.equals(Constant.Color.Black))
return Color.Black;
else if (s.equals(Constant.Color.Blue))
return Color.Blue;
return Color.Colorless;
}
}
public static EnumSet<Color> ConvertManaCostToColor(ManaCost m){
EnumSet<Color> colors = EnumSet.of(Color.Colorless);
if (m.isColor("W"))
colors.add(Color.White);
if (m.isColor("G"))
colors.add(Color.Green);
if (m.isColor("R"))
colors.add(Color.Red);
if (m.isColor("B"))
colors.add(Color.Black);
if (m.isColor("U"))
colors.add(Color.Blue);
if (colors.size() > 1)
colors.remove(Color.Colorless);
return colors;
}
public String toString(){
if (this.equals(Color.White))
return Constant.Color.White;
else if (this.equals(Color.Green))
return Constant.Color.Green;
else if (this.equals(Color.Red))
return Constant.Color.Red;
else if (this.equals(Color.Black))
return Constant.Color.Black;
else if (this.equals(Color.Blue))
return Constant.Color.Blue;
else
return Constant.Color.Colorless;
}
}

View File

@@ -1,5 +1,7 @@
package forge;
import java.util.ArrayList;
public class GameInfo {
private int computerMaxPlayNumberOfLands = 1;
private int humanMaxPlayNumberOfLands = 1;
@@ -15,6 +17,8 @@ public class GameInfo {
private boolean preventCombatDamageThisTurn;
private boolean assignedFirstStrikeDamageThisCombat;
private boolean resolvedFirstStrikeDamageThisCombat;
private ArrayList<Card_Color> globalColorChanges = new ArrayList<Card_Color>();
public void setComputerMaxPlayNumberOfLands(int n) {
computerMaxPlayNumberOfLands = n;
@@ -136,6 +140,31 @@ public class GameInfo {
return computerStartedThisGame;
}
public long addColorChanges(String s, Card c, boolean addToColors, boolean bIncrease) {
if (bIncrease)
Card_Color.increaseTimestamp();
globalColorChanges.add(new Card_Color(new ManaCost(s), c, addToColors));
return Card_Color.getTimestamp();
}
public void removeColorChanges(String s, Card c, boolean addTo, long timestamp) {
Card_Color removeCol = null;
for(Card_Color cc : globalColorChanges)
if (cc.equals(s, c, addTo, timestamp))
removeCol = cc;
if (removeCol != null)
globalColorChanges.remove(removeCol);
}
public void clearColorChanges() {
// clear the global color changes at end of each game
globalColorChanges.clear();
}
public ArrayList<Card_Color> getColorChanges() {
return globalColorChanges;
}
}

View File

@@ -71,49 +71,38 @@ public class GuiDisplayUtil implements NewConstants {
}
public static Border getBorder(Card card) {
if (card == null) return BorderFactory.createEmptyBorder(2, 2, 2, 2);
Color color;
if (CardUtil.getColors(card).size() > 1) color = Color.orange;
// color info
if (card == null)
return BorderFactory.createEmptyBorder(2, 2, 2, 2);
java.awt.Color color;
ArrayList<String> list = CardUtil.getColors(card);
else if ((CardUtil.getColor(card).equals(Constant.Color.Black) &&
((!card.getKeyword().contains(card.getName() + " is colorless."))) &&
!card.getKeyword().contains("CARDNAME is colorless.")) ||
(card.getIntrinsicKeyword().contains(card.getName() + " is black.") ||
card.getIntrinsicKeyword().contains("CARDNAME is black."))) color = Color.black;
else if ((CardUtil.getColor(card).equals(Constant.Color.Green) &&
((!card.getKeyword().contains(card.getName() + " is colorless."))) &&
!card.getKeyword().contains("CARDNAME is colorless.")) ||
(card.getIntrinsicKeyword().contains(card.getName() + " is green.") ||
card.getIntrinsicKeyword().contains("CARDNAME is green."))) color = new Color(0, 220, 39);
else if ((CardUtil.getColor(card).equals(Constant.Color.White) &&
((!card.getKeyword().contains(card.getName() + " is colorless."))) &&
!card.getKeyword().contains("CARDNAME is colorless.")) ||
(card.getIntrinsicKeyword().contains(card.getName() + " is white.") ||
card.getIntrinsicKeyword().contains("CARDNAME is white."))) color = Color.white;
else if ((CardUtil.getColor(card).equals(Constant.Color.Red) &&
((!card.getKeyword().contains(card.getName() + " is colorless."))) &&
!card.getKeyword().contains("CARDNAME is colorless.")) ||
(card.getIntrinsicKeyword().contains(card.getName() + " is red.") ||
card.getIntrinsicKeyword().contains("CARDNAME is red."))) color = Color.red;
else if ((CardUtil.getColor(card).equals(Constant.Color.Blue) &&
((!card.getKeyword().contains(card.getName() + " is colorless."))) &&
!card.getKeyword().contains("CARDNAME is colorless.")) ||
(card.getIntrinsicKeyword().contains(card.getName() + " is blue.") ||
card.getIntrinsicKeyword().contains("CARDNAME is blue."))) color = Color.blue;
if (card.isFaceDown())
color = Color.gray;
else if (CardUtil.getColor(card).equals(Constant.Color.Colorless) ||
(card.getKeyword().contains(card.getName() + " is colorless.") ||
card.getKeyword().contains("CARDNAME is colorless."))) color = Color.gray;
else if (list.size() > 1) color = Color.orange;
else if (list.get(0).equals(Constant.Color.Black))
color = Color.black;
else if (list.get(0).equals(Constant.Color.Green))
color = new Color(0, 220, 39);
else if (list.get(0).equals(Constant.Color.White))
color = Color.white;
else if (list.get(0).equals(Constant.Color.Red))
color = Color.red;
else if (list.get(0).equals(Constant.Color.Blue))
color = Color.blue;
else if (list.get(0).equals(Constant.Color.Colorless))
color = Color.gray;
else color = new Color(200, 0, 230); // If your card has a violet border, something is wrong
if (!CardUtil.getColor(card).equals(Constant.Color.Colorless) ||
!card.getKeyword().contains(card.getName() + " is colorless.") ||
!card.getKeyword().contains("CARDNAME is colorless.")) {
if (color != Color.gray) {
int r = color.getRed();
int g = color.getGreen();

View File

@@ -121,6 +121,7 @@ public class Gui_WinLose extends JFrame implements NewConstants {
}
private void setup() {
AllZone.GameInfo.clearColorChanges();
WinLose winLose = Constant.Runtime.WinLose;
Phase.GameBegins = 0;
//3 is the match length, 3 is the number of games