Effective stats display.

This commit is contained in:
marcins78@gmail.com
2011-09-21 14:56:28 +00:00
parent 02f8144538
commit 235af5fe15
2 changed files with 55 additions and 11 deletions

View File

@@ -5,26 +5,46 @@ public enum Keyword {
SKIRMISH("Skirmish"), FELLOWSHIP("Fellowship"), RESPONSE("Response"), MANEUVER("Maneuver"), ARCHERY("Archery"), SHADOW("Shadow"), ASSIGNMENT("Assignment"), REGROUP("Regroup"),
RING_BOUND("Ring-Bound"), RING_BEARER("Ring-Bearer"),
RING_BOUND("Ring-Bound", true), RING_BEARER("Ring-Bearer", true),
ROAMING("Roaming"),
ROAMING("Roaming", true),
WEATHER("Weather"), TALE("Tale"), SPELL("Spell"), SEARCH("Search"), STEALTH("Stealth"),
RIVER("River"), PLAINS("Plains"), UNDERGROUND("Underground"), SANCTUARY("Sanctuary"), FOREST("Forest"), MARSH("Marsh"), MOUNTAIN("Mountain"),
DAMAGE("Damage"), DEFENDER("Defender"), FIERCE("Fierce"), ARCHER("Archer"), RANGER("Ranger"), TRACKER("Tracker"),
DAMAGE("Damage", true, true), DEFENDER("Defender", true, true), FIERCE("Fierce", true), ARCHER("Archer", true), RANGER("Ranger", true), TRACKER("Tracker", true),
HAND_WEAPON("Hand Weapon"), ARMOR("Armor"), HELM("Helm"), MOUNT("Mount"), RANGED_WEAPON("Ranged Weapon"), CLOAK("Cloak"), PIPE("Pipe"),
PIPEWEED("Pipeweed"), SHIELD("Shield");
private String _humanReadable;
private boolean _infoDisplayable;
private boolean _multiples;
private Keyword(String humanReadable) {
this(humanReadable, false);
}
private Keyword(String humanReadable, boolean infoDisplayable) {
this(humanReadable, infoDisplayable, false);
}
private Keyword(String humanReadable, boolean infoDisplayable, boolean multiples) {
_humanReadable = humanReadable;
_infoDisplayable = infoDisplayable;
_multiples = multiples;
}
public String getHumanReadable() {
return _humanReadable;
}
public boolean isInfoDisplayable() {
return _infoDisplayable;
}
public boolean isMultiples() {
return _multiples;
}
}

View File

@@ -1,6 +1,6 @@
package com.gempukku.lotro.game;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.game.formats.LotroFormat;
import com.gempukku.lotro.game.state.GameState;
@@ -80,14 +80,38 @@ public class LotroGameMediator {
if (modifiers.size() == 0)
sb.append("<br><i>nothing</i>");
CardType type = card.getBlueprint().getCardType();
if (type == CardType.COMPANION || type == CardType.ALLY || type == CardType.MINION) {
sb.append("<br><br><b>Effective stats:</b>");
sb.append("<br><b>Strength:</b> " + _lotroGame.getModifiersQuerying().getStrength(_lotroGame.getGameState(), card));
sb.append("<br><b>Vitality:</b> " + _lotroGame.getModifiersQuerying().getVitality(_lotroGame.getGameState(), card));
if (type == CardType.MINION)
sb.append("<br><b>Twilight cost:</b> " + _lotroGame.getModifiersQuerying().getTwilightCost(_lotroGame.getGameState(), card));
sb.append("<br><br><b>Effective stats:</b>");
try {
int twilightCost = _lotroGame.getModifiersQuerying().getTwilightCost(_lotroGame.getGameState(), card);
sb.append("<br><b>Twilight cost:</b> " + twilightCost);
} catch (UnsupportedOperationException exp) {
}
try {
int strength = _lotroGame.getModifiersQuerying().getStrength(_lotroGame.getGameState(), card);
sb.append("<br><b>Strength:</b> " + strength);
} catch (UnsupportedOperationException exp) {
}
try {
int vitality = _lotroGame.getModifiersQuerying().getVitality(_lotroGame.getGameState(), card);
sb.append("<br><b>Vitality:</b> " + vitality);
} catch (UnsupportedOperationException exp) {
}
StringBuilder keywords = new StringBuilder();
for (Keyword keyword : Keyword.values()) {
if (keyword.isInfoDisplayable()) {
if (keyword.isMultiples()) {
int count = _lotroGame.getModifiersQuerying().getKeywordCount(_lotroGame.getGameState(), card, keyword);
if (count > 0)
keywords.append(keyword.getHumanReadable() + " +" + count + ", ");
} else {
if (_lotroGame.getModifiersQuerying().hasKeyword(_lotroGame.getGameState(), card, keyword))
keywords.append(keyword.getHumanReadable() + ", ");
}
}
}
if (keywords.length() > 0)
sb.append("<br><b>Keywords:</b> " + keywords.substring(0, keywords.length() - 2));
return sb.toString();
} finally {