- Added an option to display color identity of cards in the card detail panel (details in CHANGES.txt).

This commit is contained in:
Agetian
2015-06-01 20:04:38 +00:00
parent df213262ec
commit 21323a4f72
6 changed files with 64 additions and 0 deletions

View File

@@ -18,6 +18,8 @@ import forge.game.card.CounterType;
import forge.item.InventoryItemFromSet;
import forge.item.PreconDeck;
import forge.item.SealedProduct;
import forge.model.FModel;
import forge.properties.ForgePreferences;
import forge.util.Lang;
public class CardDetailUtil {
@@ -153,6 +155,19 @@ public class CardDetailUtil {
return borderColors;
}
public static String getColorIdentity(final CardStateView c) {
ColorSet identity = c.getColors();
String strIdentity = "";
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}"; }
return strIdentity;
}
public static DetailColors getRarityColor(final CardRarity rarity) {
switch (rarity) {
case Uncommon:
@@ -492,6 +507,20 @@ public class CardDetailUtil {
area.append("Must block " + mustBlockThese);
}
//show card color identity if enabled
String colorIdentMode = FModel.getPreferences().getPref(ForgePreferences.FPref.UI_DISPLAY_COLOR_IDENTITY);
if (!colorIdentMode.equals("Never")) {
final String colorIdent = getColorIdentity(state);
final int numColors = state.getColors().countColors();
if (!colorIdentMode.equals("Only Multicolor") || numColors > 1) {
if (area.length() != 0) {
area.append("\n\n");
}
area.append("Color identity: ");
area.append(colorIdent.isEmpty() ? "colorless" : colorIdent);
}
}
//show current storm count for storm cards
if (state.hasStorm()) {
if (gameView != null) {

View File

@@ -78,6 +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_FOR_TOUCHSCREN("false"),