mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
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:
@@ -73,10 +73,11 @@ public class VField implements IVDoc<CField> {
|
||||
private final PlayerDetailsPanel detailsPanel;
|
||||
|
||||
// Avatar area
|
||||
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 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 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 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 lblExperience = new FLabel.Builder().fontAlign(SwingConstants.CENTER).fontStyle(Font.BOLD).icon(FSkin.getImage(FSkinProp.IMG_EXPERIENCE)).iconInBackground().build();
|
||||
|
||||
private final PhaseIndicator phaseIndicator = new PhaseIndicator();
|
||||
|
||||
@@ -110,6 +111,7 @@ public class VField implements IVDoc<CField> {
|
||||
lblLife.setFocusable(false);
|
||||
lblPoison.setFocusable(false);
|
||||
lblEnergy.setFocusable(false);
|
||||
lblExperience.setFocusable(false);
|
||||
|
||||
avatarArea.setOpaque(false);
|
||||
avatarArea.setBackground(FSkin.getColor(FSkin.Colors.CLR_HOVER));
|
||||
@@ -212,6 +214,28 @@ public class VField implements IVDoc<CField> {
|
||||
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() {
|
||||
if (lblEnergy.isShowing() || lblPoison.isShowing()) {
|
||||
return; // poison takes precedence
|
||||
@@ -262,9 +286,11 @@ public class VField implements IVDoc<CField> {
|
||||
// Update poison and/or energy counters, poison counters take precedence
|
||||
final int poison = player.getCounters(CounterType.POISON);
|
||||
final int energy = player.getCounters(CounterType.ENERGY);
|
||||
final int experience = player.getCounters(CounterType.EXPERIENCE);
|
||||
|
||||
if (poison > 0) {
|
||||
removeLblEnergy();
|
||||
removeLblExperience();
|
||||
addLblPoison();
|
||||
lblPoison.setText(String.valueOf(poison));
|
||||
if (poison < POISON_CRITICAL) {
|
||||
@@ -277,6 +303,7 @@ public class VField implements IVDoc<CField> {
|
||||
}
|
||||
|
||||
if (energy > 0) {
|
||||
removeLblExperience();
|
||||
if (poison == 0) {
|
||||
addLblEnergy();
|
||||
lblEnergy.setText(String.valueOf(energy));
|
||||
@@ -285,6 +312,15 @@ public class VField implements IVDoc<CField> {
|
||||
removeLblEnergy();
|
||||
}
|
||||
|
||||
if (experience > 0) {
|
||||
if (poison == 0 && energy == 0) {
|
||||
addLblExperience();
|
||||
lblExperience.setText(String.valueOf(experience));
|
||||
}
|
||||
} else {
|
||||
removeLblExperience();
|
||||
}
|
||||
|
||||
final boolean highlighted = isHighlighted();
|
||||
this.avatarArea.setBorder(highlighted ? borderAvatarHighlighted : borderAvatarSimple );
|
||||
this.avatarArea.setOpaque(highlighted);
|
||||
|
||||
@@ -85,6 +85,7 @@ public class CardFaceSymbols {
|
||||
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("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("attack", FSkin.getImage(FSkinProp.IMG_ATTACK, 32, 32));
|
||||
MANA_IMAGES.put("defend", FSkin.getImage(FSkinProp.IMG_DEFEND, 32, 32));
|
||||
|
||||
@@ -1285,6 +1285,7 @@ public class FSkin {
|
||||
addEncodingSymbol("S", FSkinProp.IMG_MANA_SNOW);
|
||||
addEncodingSymbol("T", FSkinProp.IMG_TAP);
|
||||
addEncodingSymbol("E", FSkinProp.IMG_ENERGY);
|
||||
addEncodingSymbol("EXPERIENCE", FSkinProp.IMG_EXPERIENCE);
|
||||
|
||||
// Set look and feel after skin loaded
|
||||
FView.SINGLETON_INSTANCE.setSplashProgessBarMessage("Setting look and feel...");
|
||||
|
||||
Reference in New Issue
Block a user