mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
- Added an option to display color identity of cards in the card detail panel (details in CHANGES.txt).
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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"),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user