- Adding count of types to the Tooltip for Graveyards for improved Delirium QOL

This commit is contained in:
Sol
2016-07-30 20:05:48 +00:00
parent 7dc03721ff
commit d30fd6ab21
2 changed files with 21 additions and 8 deletions

View File

@@ -1,11 +1,9 @@
package forge.game.player;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.Map.Entry;
import forge.card.CardType;
import forge.card.mana.ManaAtom;
import forge.game.card.CounterType;
@@ -311,6 +309,20 @@ public class PlayerView extends GameEntityView {
TrackableCollection<CardView> cards = get(zoneProp);
return cards == null ? 0 : cards.size();
}
public int getZoneTypes(TrackableProperty zoneProp) {
TrackableCollection<CardView> cards = get(zoneProp);
HashSet<CardType.CoreType> types = new HashSet<>();
if (cards == null)
return 0;
for(CardView c : cards) {
types.addAll((Collection<? extends CardType.CoreType>) c.getCurrentState().getType().getCoreTypes());
}
return cards.size();
}
private static TrackableProperty getZoneProp(final ZoneType zone) {
switch (zone) {
case Ante:

View File

@@ -11,6 +11,7 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants;
import forge.card.mana.ManaAtom;
import forge.trackable.TrackableProperty;
import net.miginfocom.swing.MigLayout;
import org.apache.commons.lang3.StringUtils;
@@ -33,7 +34,7 @@ public class PlayerDetailsPanel extends JPanel {
// Info labels
private final DetailLabel lblHand = new DetailLabel(FSkinProp.IMG_ZONE_HAND, "Hand (%s/%s)");
private final DetailLabel lblGraveyard = new DetailLabel(FSkinProp.IMG_ZONE_GRAVEYARD, "Graveyard (%s)");
private final DetailLabel lblGraveyard = new DetailLabel(FSkinProp.IMG_ZONE_GRAVEYARD, "Graveyard (%s) Types[%s]");
private final DetailLabel lblLibrary = new DetailLabel(FSkinProp.IMG_ZONE_LIBRARY, "Library (%s)");
private final DetailLabel lblExile = new DetailLabel(FSkinProp.IMG_ZONE_EXILE, "Exile (%s)");
private final DetailLabel lblFlashback = new DetailLabel(FSkinProp.IMG_ZONE_FLASHBACK, "Flashback cards (%s)");
@@ -110,20 +111,20 @@ public class PlayerDetailsPanel extends JPanel {
/**
* Handles observer update of player Zones - hand, graveyard, etc.
*
* @param p0 &emsp; {@link forge.game.player.Player}
*/
public void updateZones() {
final String handSize = String.valueOf(player.getHandSize()),
graveyardSize = String.valueOf(player.getGraveyardSize()),
deliriumCount = String.valueOf(player.getZoneTypes(TrackableProperty.Graveyard)),
librarySize = String.valueOf(player.getLibrarySize()),
flashbackSize = String.valueOf(player.getFlashbackSize()),
exileSize = String.valueOf(player.getExileSize()),
commandSize = String.valueOf(player.getCommandSize());
lblHand.setText(handSize);
lblHand.setToolTip(handSize, player.getMaxHandString());
lblGraveyard.setText(graveyardSize);
lblGraveyard.setToolTip(graveyardSize);
lblGraveyard.setToolTip(graveyardSize, deliriumCount);
lblLibrary.setText(librarySize);
lblLibrary.setToolTip(librarySize);
lblFlashback.setText(flashbackSize);