* Added id and colored font to shown related object names of stack abilities.

This commit is contained in:
LevelX2 2015-07-26 10:17:04 +02:00
parent 5694f8aa8c
commit b029de3ec9
3 changed files with 36 additions and 3 deletions

View file

@ -49,6 +49,7 @@ import mage.game.GameState;
import mage.game.command.Emblem;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.TargetPointer;
import mage.util.GameLog;
/**
*
@ -145,11 +146,11 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
for (UUID uuid : abilityTargets) {
MageObject mageObject = game.getObject(uuid);
if (mageObject != null) {
names.add(mageObject.getName());
names.add(GameLog.getColoredObjectIdNameForTooltip(mageObject));
}
}
if (!names.isEmpty()) {
abilityView.getRules().add("<i>Related to: " + names.toString() + "</i>");
abilityView.getRules().add("<i>Related objects: " + names.toString() + "</i>");
}
}
}

View file

@ -41,6 +41,7 @@ import mage.game.Game;
import mage.game.stack.StackAbility;
import mage.target.targetpointer.FixedTarget;
import mage.target.targetpointer.TargetPointer;
import mage.util.GameLog;
/**
*
@ -118,7 +119,7 @@ public class StackAbilityView extends CardView {
if ((mageObject instanceof Card) && ((Card) mageObject).isFaceDown(game)) {
continue;
}
names.add(mageObject.getName());
names.add(GameLog.getColoredObjectIdNameForTooltip(mageObject));
}
}

View file

@ -39,6 +39,7 @@ public class GameLog {
static final String LOG_COLOR_PLAYER = "#20B2AA"; // LightSeaGreen
static final String LOG_COLOR_PLAYER_REQUEST = "#D2691E"; // Chocolate
static final String LOG_COLOR_PLAYER_CONFIRM = "#D2691E"; // Chocolate
// colors for more dark background
static final String LOG_COLOR_GREEN = "#90EE90"; // LightGreen
static final String LOG_COLOR_RED = "#FF6347"; // Tomato
static final String LOG_COLOR_BLUE = "#87CEFA"; // LightSkyBlue
@ -46,6 +47,14 @@ public class GameLog {
static final String LOG_COLOR_WHITE = "#F0E68C"; // Khaki
static final String LOG_COLOR_MULTI = "#DAA520"; // GoldenRod
static final String LOG_COLOR_COLORLESS = "#B0C4DE"; // LightSteelBlue
// colors for tooltip (light background)
static final String LOG_TT_COLOR_RED = "Red"; // Tomato
static final String LOG_TT_COLOR_GREEN = "Green"; // LightGreen
static final String LOG_TT_COLOR_BLUE = "Blue";
static final String LOG_TT_COLOR_BLACK = "Black";
static final String LOG_TT_COLOR_WHITE = "#CCDB00";
static final String LOG_TT_COLOR_MULTI = "#FFAC40";
static final String LOG_TT_COLOR_COLORLESS = "#94A4BA";
static final String LOG_COLOR_NEUTRAL = "#F0F8FF"; // AliceBlue
public static String replaceNameByColoredName(MageObject mageObject, String text) {
@ -60,6 +69,10 @@ public class GameLog {
return "<font color=\'" + getColorName(mageObject.getColor(null)) + "\'>" + mageObject.getName() + " [" + mageObject.getId().toString().substring(0, 3) + "]</font>";
}
public static String getColoredObjectIdNameForTooltip(MageObject mageObject) {
return "<font color=\'" + getTooltipColorName(mageObject.getColor(null)) + "\'>" + mageObject.getName() + " [" + mageObject.getId().toString().substring(0, 3) + "]</font>";
}
public static String getNeutralColoredText(String text) {
return "<font color=\'" + LOG_COLOR_NEUTRAL + "\'>" + text + "</font>";
}
@ -97,4 +110,22 @@ public class GameLog {
return LOG_COLOR_BLACK;
}
}
private static String getTooltipColorName(ObjectColor objectColor) {
if (objectColor.isMulticolored()) {
return LOG_TT_COLOR_MULTI;
} else if (objectColor.isColorless()) {
return LOG_TT_COLOR_COLORLESS;
} else if (objectColor.isRed()) {
return LOG_TT_COLOR_RED;
} else if (objectColor.isGreen()) {
return LOG_TT_COLOR_GREEN;
} else if (objectColor.isBlue()) {
return LOG_TT_COLOR_BLUE;
} else if (objectColor.isWhite()) {
return LOG_TT_COLOR_WHITE;
} else {
return LOG_TT_COLOR_BLACK;
}
}
}