mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Added method to CardColor to identify if another CardColor shares color with another.
Added method to CardType to identify if another CardType shares a subtype with another.
This commit is contained in:
@@ -300,4 +300,24 @@ public final class CardColor implements Comparable<CardColor> {
|
||||
public static void setNullColor(final CardColor nullColor0) {
|
||||
CardColor.nullColor = nullColor0;
|
||||
}
|
||||
|
||||
public boolean sharesColorWith(CardColor ccOther) {
|
||||
|
||||
if (this.isWhite() && ccOther.isWhite())
|
||||
return true;
|
||||
|
||||
if (this.isBlue() && ccOther.isBlue())
|
||||
return true;
|
||||
|
||||
if (this.isBlack() && ccOther.isBlack())
|
||||
return true;
|
||||
|
||||
if (this.isRed() && ccOther.isRed())
|
||||
return true;
|
||||
|
||||
if (this.isGreen() && ccOther.isGreen())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,4 +296,16 @@ public final class CardType implements Comparable<CardType> {
|
||||
return this.toString().compareTo(o.toString());
|
||||
}
|
||||
|
||||
public List<String> getSubTypes() {
|
||||
return this.subType;
|
||||
}
|
||||
|
||||
public boolean sharesSubTypeWith(CardType ctOther) {
|
||||
for (String t : ctOther.getSubTypes()) {
|
||||
if (this.subTypeContains(t))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user