ColorSet: turn Set into an Enum (#8757)

This commit is contained in:
Hans Mackowiak
2025-10-09 15:03:45 +02:00
committed by GitHub
parent 1962a8d28b
commit f8d883d91f
28 changed files with 138 additions and 254 deletions

View File

@@ -33,7 +33,7 @@ public class ColorSetRenderer extends ItemCellRenderer {
this.cs = (ColorSet) value;
}
else {
this.cs = ColorSet.NO_COLORS;
this.cs = ColorSet.C;
}
this.setToolTipText(cs.toString());
return super.getTableCellRendererComponent(table, "", isSelected, hasFocus, row, column);

View File

@@ -214,22 +214,8 @@ public class VAssignGenericAmount {
pnlTargets.add(mp, "w 145px!, h 170px!, gap 5px 5px 3px 3px, ax center");
mp.addMouseListener(mad);
targetsMap.put(mp, at);
} else if (at.entity instanceof Byte) {
SkinImage manaSymbol;
byte color = (Byte) at.entity;
if (color == MagicColor.WHITE) {
manaSymbol = FSkin.getImage(FSkinProp.IMG_MANA_W);
} else if (color == MagicColor.BLUE) {
manaSymbol = FSkin.getImage(FSkinProp.IMG_MANA_U);
} else if (color == MagicColor.BLACK) {
manaSymbol = FSkin.getImage(FSkinProp.IMG_MANA_B);
} else if (color == MagicColor.RED) {
manaSymbol = FSkin.getImage(FSkinProp.IMG_MANA_R);
} else if (color == MagicColor.GREEN) {
manaSymbol = FSkin.getImage(FSkinProp.IMG_MANA_G);
} else { // Should never come here, but add this to avoid compile error
manaSymbol = FSkin.getImage(FSkinProp.IMG_MANA_COLORLESS);
}
} else if (at.entity instanceof MagicColor.Color color) {
SkinImage manaSymbol = FSkin.getImage(FSkinProp.MANA_IMG.get(color.getShortName()));
final MiscCardPanel mp = new MiscCardPanel(matchUI, "", manaSymbol);
mp.setCardBounds(0, 0, 70, 70);
pnlTargets.add(mp, "w 100px!, h 150px!, gap 5px 5px 3px 3px, ax center");

View File

@@ -471,12 +471,12 @@ public class PlayerControllerForTests extends PlayerController {
@Override
public byte chooseColor(String message, SpellAbility sa, ColorSet colors) {
return Iterables.getFirst(colors, MagicColor.WHITE);
return Iterables.getFirst(colors, MagicColor.Color.WHITE).getColorMask();
}
@Override
public byte chooseColorAllowColorless(String message, Card card, ColorSet colors) {
return Iterables.getFirst(colors, (byte)0);
return Iterables.getFirst(colors, MagicColor.Color.COLORLESS).getColorMask();
}
private CardCollection chooseItems(CardCollectionView items, int amount) {