mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- Renamed the "Display Color Identity" option to "Display Current Color Info" (to avoid confusion because color identity is actually not the same as the sum of current colors of the card, e.g. a Forest should has a green identity because it produces green mane but it's a colorless card nonetheless). Internal functions and variables related to this code is also renamed accordingly to avoid confusion.
This commit is contained in:
@@ -300,10 +300,10 @@ 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_MULTI_OR_CHANGED,
|
||||
ForgeConstants.DISP_COLOR_IDENT_ALWAYS};
|
||||
final FPref userSetting = FPref.UI_DISPLAY_COLOR_IDENTITY;
|
||||
final String[] elems = {ForgeConstants.DISP_CURRENT_COLORS_NEVER, ForgeConstants.DISP_CURRENT_COLORS_CHANGED,
|
||||
ForgeConstants.DISP_CURRENT_COLORS_MULTICOLOR, ForgeConstants.DISP_CURRENT_COLORS_MULTI_OR_CHANGED,
|
||||
ForgeConstants.DISP_CURRENT_COLORS_ALWAYS};
|
||||
final FPref userSetting = FPref.UI_DISPLAY_CURRENT_COLORS;
|
||||
final FComboBoxPanel<String> panel = this.view.getDisplayColorIdentity();
|
||||
final FComboBox<String> comboBox = createComboBox(elems, userSetting);
|
||||
final String selectedItem = this.prefs.getPref(userSetting);
|
||||
|
||||
@@ -89,7 +89,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
private final FComboBoxPanel<GameLogEntryType> cbpGameLogEntryType = new FComboBoxPanel<>("Game Log Verbosity:");
|
||||
private final FComboBoxPanel<CloseAction> cbpCloseAction = new FComboBoxPanel<>("Close Action:");
|
||||
private final FComboBoxPanel<String> cbpAiProfiles = new FComboBoxPanel<>("AI Personality:");
|
||||
private final FComboBoxPanel<String> cbpDisplayColorIdentity = new FComboBoxPanel<>("Display Color Identity:");
|
||||
private final FComboBoxPanel<String> cbpDisplayCurrentCardColors = new FComboBoxPanel<>("Display Card Color Info:");
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -225,8 +225,8 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
pnlPrefs.add(cbStackCreatures, regularConstraints);
|
||||
pnlPrefs.add(new NoteLabel("Stacks identical creatures on the battlefield like lands, artifacts, and enchantments."), regularConstraints);
|
||||
|
||||
pnlPrefs.add(cbpDisplayColorIdentity, "w 80%!, gap 10% 0 0 10px, span 2 1");
|
||||
pnlPrefs.add(new NoteLabel("Displays the color identity of cards in the card detail information panel."), regularConstraints);
|
||||
pnlPrefs.add(cbpDisplayCurrentCardColors, "w 80%!, gap 10% 0 0 10px, span 2 1");
|
||||
pnlPrefs.add(new NoteLabel("Displays the current color of cards in the card detail information panel."), regularConstraints);
|
||||
|
||||
// Sound options
|
||||
pnlPrefs.add(new SectionLabel("Sound Options"), sectionConstraints + ", gaptop 2%");
|
||||
@@ -499,7 +499,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
}
|
||||
|
||||
public FComboBoxPanel<String> getDisplayColorIdentity() {
|
||||
return cbpDisplayColorIdentity;
|
||||
return cbpDisplayCurrentCardColors;
|
||||
}
|
||||
|
||||
public FComboBoxPanel<CloseAction> getCloseActionComboBoxPanel() {
|
||||
|
||||
@@ -163,13 +163,13 @@ public class SettingsPage extends TabPage<SettingsScreen> {
|
||||
"Show Match Background",
|
||||
"Show match background image on battlefield, otherwise background texture shown instead."),
|
||||
4);
|
||||
lstSettings.addItem(new CustomSelectSetting(FPref.UI_DISPLAY_COLOR_IDENTITY,
|
||||
"Display Color Identity",
|
||||
"Displays the color identity of cards in the card detail information panel.",
|
||||
lstSettings.addItem(new CustomSelectSetting(FPref.UI_DISPLAY_CURRENT_COLORS,
|
||||
"Display Card Color Info",
|
||||
"Displays the current color 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_MULTI_OR_CHANGED,
|
||||
ForgeConstants.DISP_COLOR_IDENT_ALWAYS}),
|
||||
ForgeConstants.DISP_CURRENT_COLORS_NEVER, ForgeConstants.DISP_CURRENT_COLORS_MULTICOLOR,
|
||||
ForgeConstants.DISP_CURRENT_COLORS_CHANGED, ForgeConstants.DISP_CURRENT_COLORS_MULTI_OR_CHANGED,
|
||||
ForgeConstants.DISP_CURRENT_COLORS_ALWAYS}),
|
||||
4);
|
||||
|
||||
//Card Overlays
|
||||
|
||||
@@ -158,21 +158,21 @@ public class CardDetailUtil {
|
||||
return borderColors;
|
||||
}
|
||||
|
||||
public static String getColorIdentity(final CardStateView c) {
|
||||
ColorSet identity = c.getColors();
|
||||
String strIdentity = "";
|
||||
public static String getCurrentColors(final CardStateView c) {
|
||||
ColorSet curColors = c.getColors();
|
||||
String strCurColors = "";
|
||||
|
||||
if (identity.hasWhite()) { strIdentity += "{W}"; }
|
||||
if (identity.hasBlue()) { strIdentity += "{U}"; }
|
||||
if (identity.hasBlack()) { strIdentity += "{B}"; }
|
||||
if (identity.hasRed()) { strIdentity += "{R}"; }
|
||||
if (identity.hasGreen()) { strIdentity += "{G}"; }
|
||||
if (curColors.hasWhite()) { strCurColors += "{W}"; }
|
||||
if (curColors.hasBlue()) { strCurColors += "{U}"; }
|
||||
if (curColors.hasBlack()) { strCurColors += "{B}"; }
|
||||
if (curColors.hasRed()) { strCurColors += "{R}"; }
|
||||
if (curColors.hasGreen()) { strCurColors += "{G}"; }
|
||||
|
||||
if (strIdentity.isEmpty()) {
|
||||
strIdentity = "colorless";
|
||||
if (strCurColors.isEmpty()) {
|
||||
strCurColors = "colorless";
|
||||
}
|
||||
|
||||
return strIdentity;
|
||||
return strCurColors;
|
||||
}
|
||||
|
||||
public static DetailColors getRarityColor(final CardRarity rarity) {
|
||||
@@ -237,24 +237,24 @@ public class CardDetailUtil {
|
||||
return id.isEmpty() ? id : "[" + id + "]";
|
||||
}
|
||||
|
||||
public static String formatCardColorIdentity(final CardStateView state) {
|
||||
final String colorIdentMode = FModel.getPreferences().getPref(ForgePreferences.FPref.UI_DISPLAY_COLOR_IDENTITY);
|
||||
boolean showIdentity = false;
|
||||
String colorIdent = "";
|
||||
public static String formatCurrentCardColors(final CardStateView state) {
|
||||
final String showCurColorMode = FModel.getPreferences().getPref(ForgePreferences.FPref.UI_DISPLAY_CURRENT_COLORS);
|
||||
boolean showCurColors = false;
|
||||
String curColors = "";
|
||||
|
||||
// do not show identity for temp effect cards, emblems and the like
|
||||
// do not show current colors for temp effect cards, emblems and the like
|
||||
if (state.getType().hasSubtype("Effect")) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (!colorIdentMode.equals(ForgeConstants.DISP_COLOR_IDENT_NEVER)) {
|
||||
if (!showCurColorMode.equals(ForgeConstants.DISP_CURRENT_COLORS_NEVER)) {
|
||||
final CardView card = state.getCard();
|
||||
boolean isMulticolor = state.getColors().countColors() > 1;
|
||||
boolean isChanged = false;
|
||||
colorIdent = getColorIdentity(state);
|
||||
curColors = getCurrentColors(state);
|
||||
|
||||
// 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)) {
|
||||
if (showCurColorMode.equals(ForgeConstants.DISP_CURRENT_COLORS_CHANGED) || showCurColorMode.equals(ForgeConstants.DISP_CURRENT_COLORS_MULTI_OR_CHANGED)) {
|
||||
String origIdent = "";
|
||||
PaperCard origPaperCard = null;
|
||||
Card origCard = null;
|
||||
@@ -271,22 +271,22 @@ public class CardDetailUtil {
|
||||
if (origPaperCard != null) {
|
||||
origCard = Card.getCardForUi(origPaperCard); // if null, probably a variant card
|
||||
}
|
||||
origIdent = origCard != null ? getColorIdentity(CardView.get(origCard).getCurrentState()) : "";
|
||||
origIdent = origCard != null ? getCurrentColors(CardView.get(origCard).getCurrentState()) : "";
|
||||
} catch(Exception ex) {
|
||||
System.err.println("Unexpected behavior: card " + card.getName() + "[" + card.getId() + "] tripped an exception when trying to process color identity.");
|
||||
}
|
||||
isChanged = !colorIdent.equals(origIdent);
|
||||
isChanged = !curColors.equals(origIdent);
|
||||
}
|
||||
|
||||
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;
|
||||
if ((showCurColorMode.equals(ForgeConstants.DISP_CURRENT_COLORS_MULTICOLOR) && isMulticolor) ||
|
||||
(showCurColorMode.equals(ForgeConstants.DISP_CURRENT_COLORS_CHANGED) && isChanged) ||
|
||||
(showCurColorMode.equals(ForgeConstants.DISP_CURRENT_COLORS_MULTI_OR_CHANGED) && (isChanged || isMulticolor)) ||
|
||||
(showCurColorMode.equals(ForgeConstants.DISP_CURRENT_COLORS_ALWAYS))) {
|
||||
showCurColors = true;
|
||||
}
|
||||
}
|
||||
|
||||
return showIdentity ? colorIdent : "";
|
||||
return showCurColors ? curColors : "";
|
||||
}
|
||||
|
||||
public static String composeCardText(final CardStateView state, final GameView gameView, final boolean canShow) {
|
||||
@@ -566,14 +566,14 @@ public class CardDetailUtil {
|
||||
area.append("Must block " + mustBlockThese);
|
||||
}
|
||||
|
||||
//show card color identity if enabled
|
||||
String colorIdent = formatCardColorIdentity(state);
|
||||
if (!colorIdent.isEmpty()) {
|
||||
//show current card colors if enabled
|
||||
String curCardColors = formatCurrentCardColors(state);
|
||||
if (!curCardColors.isEmpty()) {
|
||||
if (area.length() != 0) {
|
||||
area.append("\n\n");
|
||||
}
|
||||
area.append("Color identity: ");
|
||||
area.append(colorIdent);
|
||||
area.append("Current Card Colors: ");
|
||||
area.append(curCardColors);
|
||||
}
|
||||
|
||||
//show current storm count for storm cards
|
||||
|
||||
@@ -179,10 +179,10 @@ public final class ForgeConstants {
|
||||
public static final String URL_PRICE_DOWNLOAD = "http://www.cardforge.org/MagicInfo/pricegen.php";
|
||||
|
||||
// Constants for Display Card Identity game setting
|
||||
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";
|
||||
public static final String DISP_CURRENT_COLORS_ALWAYS = "Always";
|
||||
public static final String DISP_CURRENT_COLORS_CHANGED = "Changed";
|
||||
public static final String DISP_CURRENT_COLORS_MULTICOLOR = "Multicolor";
|
||||
public static final String DISP_CURRENT_COLORS_MULTI_OR_CHANGED = "Multi+Changed";
|
||||
public static final String DISP_CURRENT_COLORS_NEVER = "Never";
|
||||
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
|
||||
UI_MANA_LOST_PROMPT ("false"), // Prompt on losing mana when passing priority
|
||||
UI_PAUSE_WHILE_MINIMIZED("false"),
|
||||
UI_TOKENS_IN_SEPARATE_ROW("false"), // Display tokens in their own battlefield row.
|
||||
UI_DISPLAY_COLOR_IDENTITY("Never"),
|
||||
UI_DISPLAY_CURRENT_COLORS("Never"),
|
||||
|
||||
UI_FOR_TOUCHSCREN("false"),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user