Added Experience Counters to Desktop Forge

Experience counters are at the lowest priority from Poison>Energy>Experience. It uses the Commander 2015 symbol, in which Experience Counters appeared.
There was a lot of transplanting involved copying the Energy code to fit the Experience model. This means there might be some unforseen problems though so check it out. I did several run throughs with Aetherwind Basker, Attune with Aether, Caress of Phyrexia, Leeches, and the Experience counter commanders to find anything remaining. There's a difference between "There are no bugs" and "I found no bugs".

Speaking of Leeches, there was an odd bug in the ProcessRunLogThing, saying "SVar 'X' not found in ability, fallback to Card (Leeches). Ability is ()". Something to do with Svar:X:TargetedPlayer$PoisonCounters maybe?
This commit is contained in:
Indigo Dragon
2017-11-06 15:15:21 +00:00
parent e00b18bf40
commit 715f991d0d
5 changed files with 43 additions and 4 deletions

View File

@@ -73,10 +73,11 @@ public class VField implements IVDoc<CField> {
private final PlayerDetailsPanel detailsPanel; private final PlayerDetailsPanel detailsPanel;
// Avatar area // Avatar area
private final FLabel lblAvatar = new FLabel.Builder().fontAlign(SwingConstants.CENTER).iconScaleFactor(1.0f).build(); private final FLabel lblAvatar = new FLabel.Builder().fontAlign(SwingConstants.CENTER).iconScaleFactor(1.0f).build();
private final FLabel lblLife = new FLabel.Builder().fontAlign(SwingConstants.CENTER).fontStyle(Font.BOLD).build(); private final FLabel lblLife = new FLabel.Builder().fontAlign(SwingConstants.CENTER).fontStyle(Font.BOLD).build();
private final FLabel lblPoison = new FLabel.Builder().fontAlign(SwingConstants.CENTER).fontStyle(Font.BOLD).icon(FSkin.getImage(FSkinProp.IMG_ZONE_POISON)).iconInBackground().build(); private final FLabel lblPoison = new FLabel.Builder().fontAlign(SwingConstants.CENTER).fontStyle(Font.BOLD).icon(FSkin.getImage(FSkinProp.IMG_ZONE_POISON)).iconInBackground().build();
private final FLabel lblEnergy = new FLabel.Builder().fontAlign(SwingConstants.CENTER).fontStyle(Font.BOLD).icon(FSkin.getImage(FSkinProp.IMG_ENERGY)).iconInBackground().build(); private final FLabel lblEnergy = new FLabel.Builder().fontAlign(SwingConstants.CENTER).fontStyle(Font.BOLD).icon(FSkin.getImage(FSkinProp.IMG_ENERGY)).iconInBackground().build();
private final FLabel lblExperience = new FLabel.Builder().fontAlign(SwingConstants.CENTER).fontStyle(Font.BOLD).icon(FSkin.getImage(FSkinProp.IMG_EXPERIENCE)).iconInBackground().build();
private final PhaseIndicator phaseIndicator = new PhaseIndicator(); private final PhaseIndicator phaseIndicator = new PhaseIndicator();
@@ -110,6 +111,7 @@ public class VField implements IVDoc<CField> {
lblLife.setFocusable(false); lblLife.setFocusable(false);
lblPoison.setFocusable(false); lblPoison.setFocusable(false);
lblEnergy.setFocusable(false); lblEnergy.setFocusable(false);
lblExperience.setFocusable(false);
avatarArea.setOpaque(false); avatarArea.setOpaque(false);
avatarArea.setBackground(FSkin.getColor(FSkin.Colors.CLR_HOVER)); avatarArea.setBackground(FSkin.getColor(FSkin.Colors.CLR_HOVER));
@@ -212,6 +214,28 @@ public class VField implements IVDoc<CField> {
detailsPanel.updateZones(); detailsPanel.updateZones();
} }
private void addLblExperience() {
if (lblExperience.isShowing() || lblEnergy.isShowing()) {
return; // energy takes precedence
}
if (lblExperience.isShowing() || lblPoison.isShowing()) {
return; // poison takes precedence
}
avatarArea.remove(lblLife);
lblLife.setIcon(FSkin.getImage(FSkinProp.ICO_QUEST_LIFE));
avatarArea.add(lblLife, "w 50%!, h 20px!, split 2");
avatarArea.add(lblExperience, "w 50%!, h 20px!, wrap");
}
private void removeLblExperience() {
if (!lblExperience.isShowing()) {
return;
}
avatarArea.remove(lblExperience);
avatarArea.remove(lblLife);
avatarArea.add(lblLife, "w 100%!, h 20px!, wrap");
}
private void addLblEnergy() { private void addLblEnergy() {
if (lblEnergy.isShowing() || lblPoison.isShowing()) { if (lblEnergy.isShowing() || lblPoison.isShowing()) {
return; // poison takes precedence return; // poison takes precedence
@@ -262,9 +286,11 @@ public class VField implements IVDoc<CField> {
// Update poison and/or energy counters, poison counters take precedence // Update poison and/or energy counters, poison counters take precedence
final int poison = player.getCounters(CounterType.POISON); final int poison = player.getCounters(CounterType.POISON);
final int energy = player.getCounters(CounterType.ENERGY); final int energy = player.getCounters(CounterType.ENERGY);
final int experience = player.getCounters(CounterType.EXPERIENCE);
if (poison > 0) { if (poison > 0) {
removeLblEnergy(); removeLblEnergy();
removeLblExperience();
addLblPoison(); addLblPoison();
lblPoison.setText(String.valueOf(poison)); lblPoison.setText(String.valueOf(poison));
if (poison < POISON_CRITICAL) { if (poison < POISON_CRITICAL) {
@@ -277,6 +303,7 @@ public class VField implements IVDoc<CField> {
} }
if (energy > 0) { if (energy > 0) {
removeLblExperience();
if (poison == 0) { if (poison == 0) {
addLblEnergy(); addLblEnergy();
lblEnergy.setText(String.valueOf(energy)); lblEnergy.setText(String.valueOf(energy));
@@ -285,6 +312,15 @@ public class VField implements IVDoc<CField> {
removeLblEnergy(); removeLblEnergy();
} }
if (experience > 0) {
if (poison == 0 && energy == 0) {
addLblExperience();
lblExperience.setText(String.valueOf(experience));
}
} else {
removeLblExperience();
}
final boolean highlighted = isHighlighted(); final boolean highlighted = isHighlighted();
this.avatarArea.setBorder(highlighted ? borderAvatarHighlighted : borderAvatarSimple ); this.avatarArea.setBorder(highlighted ? borderAvatarHighlighted : borderAvatarSimple );
this.avatarArea.setOpaque(highlighted); this.avatarArea.setOpaque(highlighted);

View File

@@ -85,6 +85,7 @@ public class CardFaceSymbols {
MANA_IMAGES.put("S", FSkin.getImage(FSkinProp.IMG_MANA_SNOW, manaImageSize, manaImageSize)); MANA_IMAGES.put("S", FSkin.getImage(FSkinProp.IMG_MANA_SNOW, manaImageSize, manaImageSize));
MANA_IMAGES.put("T", FSkin.getImage(FSkinProp.IMG_TAP, manaImageSize, manaImageSize)); MANA_IMAGES.put("T", FSkin.getImage(FSkinProp.IMG_TAP, manaImageSize, manaImageSize));
MANA_IMAGES.put("E", FSkin.getImage(FSkinProp.IMG_ENERGY, 40, 40)); MANA_IMAGES.put("E", FSkin.getImage(FSkinProp.IMG_ENERGY, 40, 40));
MANA_IMAGES.put("EXPERIENCE", FSkin.getImage(FSkinProp.IMG_EXPERIENCE, 40, 30));
MANA_IMAGES.put("slash", FSkin.getImage(FSkinProp.IMG_SLASH, manaImageSize, manaImageSize)); MANA_IMAGES.put("slash", FSkin.getImage(FSkinProp.IMG_SLASH, manaImageSize, manaImageSize));
MANA_IMAGES.put("attack", FSkin.getImage(FSkinProp.IMG_ATTACK, 32, 32)); MANA_IMAGES.put("attack", FSkin.getImage(FSkinProp.IMG_ATTACK, 32, 32));
MANA_IMAGES.put("defend", FSkin.getImage(FSkinProp.IMG_DEFEND, 32, 32)); MANA_IMAGES.put("defend", FSkin.getImage(FSkinProp.IMG_DEFEND, 32, 32));

View File

@@ -1285,6 +1285,7 @@ public class FSkin {
addEncodingSymbol("S", FSkinProp.IMG_MANA_SNOW); addEncodingSymbol("S", FSkinProp.IMG_MANA_SNOW);
addEncodingSymbol("T", FSkinProp.IMG_TAP); addEncodingSymbol("T", FSkinProp.IMG_TAP);
addEncodingSymbol("E", FSkinProp.IMG_ENERGY); addEncodingSymbol("E", FSkinProp.IMG_ENERGY);
addEncodingSymbol("EXPERIENCE", FSkinProp.IMG_EXPERIENCE);
// Set look and feel after skin loaded // Set look and feel after skin loaded
FView.SINGLETON_INSTANCE.setSplashProgessBarMessage("Setting look and feel..."); FView.SINGLETON_INSTANCE.setSplashProgessBarMessage("Setting look and feel...");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 642 KiB

After

Width:  |  Height:  |  Size: 686 KiB

View File

@@ -130,6 +130,7 @@ public enum FSkinProp {
IMG_COUNTERS3 (new int[] {80, 320, 80, 80}, PropType.IMAGE), IMG_COUNTERS3 (new int[] {80, 320, 80, 80}, PropType.IMAGE),
IMG_COUNTERS_MULTI (new int[] {80, 400, 80, 80}, PropType.IMAGE), IMG_COUNTERS_MULTI (new int[] {80, 400, 80, 80}, PropType.IMAGE),
IMG_ENERGY (new int[] {320, 120, 40, 40}, PropType.IMAGE), IMG_ENERGY (new int[] {320, 120, 40, 40}, PropType.IMAGE),
IMG_EXPERIENCE (new int[] {280, 120, 40, 30}, PropType.IMAGE),
//foils //foils
FOIL_01 (new int[] {0, 0, 400, 570}, PropType.FOIL), FOIL_01 (new int[] {0, 0, 400, 570}, PropType.FOIL),