mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- Adding count of types to the Tooltip for Graveyards for improved Delirium QOL
This commit is contained in:
@@ -1,11 +1,9 @@
|
|||||||
package forge.game.player;
|
package forge.game.player;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import forge.card.CardType;
|
||||||
import forge.card.mana.ManaAtom;
|
import forge.card.mana.ManaAtom;
|
||||||
import forge.game.card.CounterType;
|
import forge.game.card.CounterType;
|
||||||
|
|
||||||
@@ -311,6 +309,20 @@ public class PlayerView extends GameEntityView {
|
|||||||
TrackableCollection<CardView> cards = get(zoneProp);
|
TrackableCollection<CardView> cards = get(zoneProp);
|
||||||
return cards == null ? 0 : cards.size();
|
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) {
|
private static TrackableProperty getZoneProp(final ZoneType zone) {
|
||||||
switch (zone) {
|
switch (zone) {
|
||||||
case Ante:
|
case Ante:
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import javax.swing.JPanel;
|
|||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
|
|
||||||
import forge.card.mana.ManaAtom;
|
import forge.card.mana.ManaAtom;
|
||||||
|
import forge.trackable.TrackableProperty;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -33,7 +34,7 @@ public class PlayerDetailsPanel extends JPanel {
|
|||||||
|
|
||||||
// Info labels
|
// Info labels
|
||||||
private final DetailLabel lblHand = new DetailLabel(FSkinProp.IMG_ZONE_HAND, "Hand (%s/%s)");
|
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 lblLibrary = new DetailLabel(FSkinProp.IMG_ZONE_LIBRARY, "Library (%s)");
|
||||||
private final DetailLabel lblExile = new DetailLabel(FSkinProp.IMG_ZONE_EXILE, "Exile (%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)");
|
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.
|
* Handles observer update of player Zones - hand, graveyard, etc.
|
||||||
*
|
|
||||||
* @param p0   {@link forge.game.player.Player}
|
|
||||||
*/
|
*/
|
||||||
public void updateZones() {
|
public void updateZones() {
|
||||||
final String handSize = String.valueOf(player.getHandSize()),
|
final String handSize = String.valueOf(player.getHandSize()),
|
||||||
graveyardSize = String.valueOf(player.getGraveyardSize()),
|
graveyardSize = String.valueOf(player.getGraveyardSize()),
|
||||||
|
deliriumCount = String.valueOf(player.getZoneTypes(TrackableProperty.Graveyard)),
|
||||||
librarySize = String.valueOf(player.getLibrarySize()),
|
librarySize = String.valueOf(player.getLibrarySize()),
|
||||||
flashbackSize = String.valueOf(player.getFlashbackSize()),
|
flashbackSize = String.valueOf(player.getFlashbackSize()),
|
||||||
exileSize = String.valueOf(player.getExileSize()),
|
exileSize = String.valueOf(player.getExileSize()),
|
||||||
commandSize = String.valueOf(player.getCommandSize());
|
commandSize = String.valueOf(player.getCommandSize());
|
||||||
|
|
||||||
lblHand.setText(handSize);
|
lblHand.setText(handSize);
|
||||||
lblHand.setToolTip(handSize, player.getMaxHandString());
|
lblHand.setToolTip(handSize, player.getMaxHandString());
|
||||||
lblGraveyard.setText(graveyardSize);
|
lblGraveyard.setText(graveyardSize);
|
||||||
lblGraveyard.setToolTip(graveyardSize);
|
lblGraveyard.setToolTip(graveyardSize, deliriumCount);
|
||||||
lblLibrary.setText(librarySize);
|
lblLibrary.setText(librarySize);
|
||||||
lblLibrary.setToolTip(librarySize);
|
lblLibrary.setToolTip(librarySize);
|
||||||
lblFlashback.setText(flashbackSize);
|
lblFlashback.setText(flashbackSize);
|
||||||
|
|||||||
Reference in New Issue
Block a user