- 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:
Agetian
2015-06-03 07:02:10 +00:00
parent d58e48e90d
commit dc5535c5ca
5 changed files with 27 additions and 18 deletions

View File

@@ -301,7 +301,8 @@ public enum CSubmenuPreferences implements ICDoc {
private void initializeColorIdentityCombobox() { private void initializeColorIdentityCombobox() {
final String[] elems = {ForgeConstants.DISP_COLOR_IDENT_NEVER, ForgeConstants.DISP_COLOR_IDENT_CHANGED, 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 FPref userSetting = FPref.UI_DISPLAY_COLOR_IDENTITY;
final FComboBoxPanel<String> panel = this.view.getDisplayColorIdentity(); final FComboBoxPanel<String> panel = this.view.getDisplayColorIdentity();
final FComboBox<String> comboBox = createComboBox(elems, userSetting); final FComboBox<String> comboBox = createComboBox(elems, userSetting);

View File

@@ -168,7 +168,8 @@ public class SettingsPage extends TabPage<SettingsScreen> {
"Displays the color identity of cards in the card detail information panel.", "Displays the color identity of cards in the card detail information panel.",
new String[]{ new String[]{
ForgeConstants.DISP_COLOR_IDENT_NEVER, ForgeConstants.DISP_COLOR_IDENT_MULTICOLOR, 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); 4);
//Card Overlays //Card Overlays

View File

@@ -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 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 for all cards, even mono-color), to "Changed" (which displays color
identity of all cards whose color identity has been altered compared to its identity of all cards whose color identity has been altered compared to its
"pristine" state) or "Multicolor" (which only displays color identity of cards "pristine" state), to "Multicolor" (which only displays color identity of cards
that are currently of two or more colors). This might help with effects such as that are currently of two or more colors) or to "Multi+Changed" (which displays
Painter's Servant which add colors to cards and which make most cards display color identity of all multicolor cards and also of all cards the identity of
with the gold border. The option is currently found under "Graphic Options" for which has changed). This might help with effects such as Painter's Servant which
both versions of Forge. 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 - - Display tokens on the same row as other cards / on their own row -

View File

@@ -239,14 +239,22 @@ public class CardDetailUtil {
public static String formatCardColorIdentity(final CardStateView state) { public static String formatCardColorIdentity(final CardStateView state) {
final String colorIdentMode = FModel.getPreferences().getPref(ForgePreferences.FPref.UI_DISPLAY_COLOR_IDENTITY); final String colorIdentMode = FModel.getPreferences().getPref(ForgePreferences.FPref.UI_DISPLAY_COLOR_IDENTITY);
final CardView card = state.getCard();
boolean showIdentity = false; boolean showIdentity = false;
String colorIdent = ""; 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)) { 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); 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 = ""; String origIdent = "";
PaperCard origPaperCard = null; PaperCard origPaperCard = null;
Card origCard = null; Card origCard = null;
@@ -267,17 +275,14 @@ public class CardDetailUtil {
} catch(Exception ex) { } catch(Exception ex) {
System.err.println("Unexpected behavior: card " + card.getName() + "[" + card.getId() + "] tripped an exception when trying to process color identity."); System.err.println("Unexpected behavior: card " + card.getName() + "[" + card.getId() + "] tripped an exception when trying to process color identity.");
} }
showIdentity = !colorIdent.equals(origIdent); isChanged = !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;
} }
// do not show identity for temp effect cards, emblems and the like if ((colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_MULTICOLOR) && isMulticolor) ||
if (state.getType().hasSubtype("Effect")) { (colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_CHANGED) && isChanged) ||
showIdentity = false; (colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_MULTI_OR_CHANGED) && (isChanged || isMulticolor)) ||
(colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_ALWAYS))) {
showIdentity = true;
} }
} }

View File

@@ -182,6 +182,7 @@ public final class ForgeConstants {
public static final String DISP_COLOR_IDENT_ALWAYS = "Always"; 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_CHANGED = "Changed";
public static final String DISP_COLOR_IDENT_MULTICOLOR = "Multicolor"; 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"; public static final String DISP_COLOR_IDENT_NEVER = "Never";
} }