Show storm count in card detail pane for storm cards

This commit is contained in:
drdev
2014-05-04 21:25:00 +00:00
parent 4aa8d57647
commit 4ba4533c61
3 changed files with 12 additions and 18 deletions

View File

@@ -56,7 +56,6 @@ public enum VPlayers implements IVDoc<CPlayers> {
// Other fields
private Map<Player, JLabel[]> infoLBLs;
private JLabel stormLabel;
//========= Overridden methods
@@ -69,8 +68,6 @@ public enum VPlayers implements IVDoc<CPlayers> {
pnl.setLayout(new MigLayout("insets 0, gap 0, wrap"));
final String constraints = "w 97%!, gapleft 2%, gapbottom 1%";
stormLabel = new InfoLabel();
pnl.add(stormLabel, constraints);
for (final Entry<Player, JLabel[]> p : infoLBLs.entrySet()) {
for(JLabel label : p.getValue() )
pnl.add(label, constraints);
@@ -175,16 +172,6 @@ public enum VPlayers implements IVDoc<CPlayers> {
temp[7].setText(CardFactoryUtil.getCommanderInfo(p0));
}
}
updateStormLabel(game);
}
/**
* @param game */
public void updateStormLabel(Game game) {
// No need to update if this panel isn't showing
if (!parentCell.getSelected().equals(this)) { return; }
stormLabel.setText("Storm count: " + game.getStack().getCardsCastThisTurn().size());
}
//========= Custom class handling

View File

@@ -18,7 +18,6 @@ import forge.toolbox.FLabel;
public class VPlayers extends FDropDown {
private Map<Player, InfoLabel[]> infoLabels;
private InfoLabel stormLabel;
public VPlayers() {
infoLabels = new HashMap<Player, InfoLabel[]>();
@@ -36,8 +35,6 @@ public class VPlayers extends FDropDown {
name.setText(p.getName());
}
stormLabel = add(new InfoLabel());
}
private class InfoLabel extends FLabel {
@@ -83,8 +80,6 @@ public class VPlayers extends FDropDown {
temp[7].setText(CardFactoryUtil.getCommanderInfo(p0));
}
}
stormLabel.setText("Storm count: " + FControl.getGame().getStack().getCardsCastThisTurn().size());
return new ScrollBounds(maxWidth, maxVisibleHeight);
}
}

View File

@@ -5,6 +5,7 @@ import java.util.Iterator;
import java.util.List;
import forge.GuiBase;
import forge.game.Game;
import forge.game.GameEntity;
import forge.game.card.Card;
import forge.game.card.CounterType;
@@ -497,6 +498,17 @@ public class CardDetailUtil {
String mustBlockThese = Lang.joinHomogenous(card.getMustBlockCards());
area.append("Must block " + mustBlockThese);
}
//show current storm count for storm cards
if (card.getKeyword().contains("Storm")) {
Game game = GuiBase.getInterface().getGame();
if (game != null) {
if (area.length() != 0) {
area.append("\n\n");
}
area.append("Current Storm Count: " + game.getStack().getCardsCastThisTurn().size());
}
}
return area.toString();
}