mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-11 16:26:22 +00:00
ColorSet: add combine function (#8960)
This commit is contained in:
@@ -235,7 +235,7 @@ public final class CardRules implements ICardCharacteristics {
|
||||
public ColorSet getColor() {
|
||||
switch (splitType.getAggregationMethod()) {
|
||||
case COMBINE:
|
||||
return ColorSet.fromMask(mainPart.getColor().getColor() | otherPart.getColor().getColor());
|
||||
return ColorSet.combine(mainPart.getColor(), otherPart.getColor());
|
||||
default:
|
||||
return mainPart.getColor();
|
||||
}
|
||||
|
||||
@@ -123,6 +123,14 @@ public enum ColorSet implements Iterable<Color>, Serializable {
|
||||
return fromMask(mana.getColorProfile());
|
||||
}
|
||||
|
||||
public static ColorSet combine(final ColorSet... colors) {
|
||||
byte mask = 0;
|
||||
for (ColorSet c : colors) {
|
||||
mask |= c.getColor();
|
||||
}
|
||||
return fromMask(mask);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for any color.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user