mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- Added the Multi+Changed mode for displaying color identity (displays color identity of all multicolor cards and of all cards with changed identity).
- Refactored and optimized the color identity display code.
This commit is contained in:
@@ -301,7 +301,8 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
|
||||
private void initializeColorIdentityCombobox() {
|
||||
final String[] elems = {ForgeConstants.DISP_COLOR_IDENT_NEVER, ForgeConstants.DISP_COLOR_IDENT_CHANGED,
|
||||
ForgeConstants.DISP_COLOR_IDENT_MULTICOLOR, ForgeConstants.DISP_COLOR_IDENT_ALWAYS};
|
||||
ForgeConstants.DISP_COLOR_IDENT_MULTICOLOR, ForgeConstants.DISP_COLOR_IDENT_MULTI_OR_CHANGED,
|
||||
ForgeConstants.DISP_COLOR_IDENT_ALWAYS};
|
||||
final FPref userSetting = FPref.UI_DISPLAY_COLOR_IDENTITY;
|
||||
final FComboBoxPanel<String> panel = this.view.getDisplayColorIdentity();
|
||||
final FComboBox<String> comboBox = createComboBox(elems, userSetting);
|
||||
|
||||
@@ -168,7 +168,8 @@ public class SettingsPage extends TabPage<SettingsScreen> {
|
||||
"Displays the color identity of cards in the card detail information panel.",
|
||||
new String[]{
|
||||
ForgeConstants.DISP_COLOR_IDENT_NEVER, ForgeConstants.DISP_COLOR_IDENT_MULTICOLOR,
|
||||
ForgeConstants.DISP_COLOR_IDENT_CHANGED, ForgeConstants.DISP_COLOR_IDENT_ALWAYS}),
|
||||
ForgeConstants.DISP_COLOR_IDENT_CHANGED, ForgeConstants.DISP_COLOR_IDENT_MULTI_OR_CHANGED,
|
||||
ForgeConstants.DISP_COLOR_IDENT_ALWAYS}),
|
||||
4);
|
||||
|
||||
//Card Overlays
|
||||
|
||||
@@ -37,11 +37,12 @@ that allows you to display the current color identity of cards. It's disabled
|
||||
by default (set to "Never") but can be toggled to "Always" (which displays color
|
||||
identity for all cards, even mono-color), to "Changed" (which displays color
|
||||
identity of all cards whose color identity has been altered compared to its
|
||||
"pristine" state) or "Multicolor" (which only displays color identity of cards
|
||||
that are currently of two or more colors). This might help with effects such as
|
||||
Painter's Servant which add colors to cards and which make most cards display
|
||||
with the gold border. The option is currently found under "Graphic Options" for
|
||||
both versions of Forge.
|
||||
"pristine" state), to "Multicolor" (which only displays color identity of cards
|
||||
that are currently of two or more colors) or to "Multi+Changed" (which displays
|
||||
color identity of all multicolor cards and also of all cards the identity of
|
||||
which has changed). This might help with effects such as Painter's Servant which
|
||||
add colors to cards and which make most cards display with the gold border. The
|
||||
option is currently found under "Graphic Options" for both versions of Forge.
|
||||
|
||||
|
||||
- Display tokens on the same row as other cards / on their own row -
|
||||
|
||||
@@ -239,14 +239,22 @@ public class CardDetailUtil {
|
||||
|
||||
public static String formatCardColorIdentity(final CardStateView state) {
|
||||
final String colorIdentMode = FModel.getPreferences().getPref(ForgePreferences.FPref.UI_DISPLAY_COLOR_IDENTITY);
|
||||
final CardView card = state.getCard();
|
||||
boolean showIdentity = false;
|
||||
String colorIdent = "";
|
||||
|
||||
// do not show identity for temp effect cards, emblems and the like
|
||||
if (state.getType().hasSubtype("Effect")) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (!colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_NEVER)) {
|
||||
final CardView card = state.getCard();
|
||||
boolean isMulticolor = state.getColors().countColors() > 1;
|
||||
boolean isChanged = false;
|
||||
colorIdent = getColorIdentity(state);
|
||||
|
||||
if (colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_CHANGED)) {
|
||||
// do not waste CPU cycles on this if the mode does not involve checking for changed color identity
|
||||
if (colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_CHANGED) || colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_MULTI_OR_CHANGED)) {
|
||||
String origIdent = "";
|
||||
PaperCard origPaperCard = null;
|
||||
Card origCard = null;
|
||||
@@ -267,17 +275,14 @@ public class CardDetailUtil {
|
||||
} catch(Exception ex) {
|
||||
System.err.println("Unexpected behavior: card " + card.getName() + "[" + card.getId() + "] tripped an exception when trying to process color identity.");
|
||||
}
|
||||
showIdentity = !colorIdent.equals(origIdent);
|
||||
} else if (colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_MULTICOLOR)) {
|
||||
final int numColors = state.getColors().countColors();
|
||||
showIdentity = numColors > 1;
|
||||
} else if (colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_ALWAYS)) {
|
||||
showIdentity = true;
|
||||
isChanged = !colorIdent.equals(origIdent);
|
||||
}
|
||||
|
||||
// do not show identity for temp effect cards, emblems and the like
|
||||
if (state.getType().hasSubtype("Effect")) {
|
||||
showIdentity = false;
|
||||
if ((colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_MULTICOLOR) && isMulticolor) ||
|
||||
(colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_CHANGED) && isChanged) ||
|
||||
(colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_MULTI_OR_CHANGED) && (isChanged || isMulticolor)) ||
|
||||
(colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_ALWAYS))) {
|
||||
showIdentity = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -182,6 +182,7 @@ public final class ForgeConstants {
|
||||
public static final String DISP_COLOR_IDENT_ALWAYS = "Always";
|
||||
public static final String DISP_COLOR_IDENT_CHANGED = "Changed";
|
||||
public static final String DISP_COLOR_IDENT_MULTICOLOR = "Multicolor";
|
||||
public static final String DISP_COLOR_IDENT_MULTI_OR_CHANGED = "Multi+Changed";
|
||||
public static final String DISP_COLOR_IDENT_NEVER = "Never";
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user