GUI: introduced default card hints:

* refactor: added helper emblems instead rad counter's inherent emblems (use initGameDefaultHelperEmblems to define new card hints or other fake objects);
* refactor: added card hints support for emblems, planes and other command objects;
* GUI: added storm counter as default card hint (use hints tool to see it, closes #12360);
This commit is contained in:
Oleg Agafonov 2024-07-27 09:40:41 +04:00
parent 83823acec7
commit 521a0f6e32
36 changed files with 234 additions and 144 deletions

View file

@ -152,7 +152,7 @@ public class MageEditorPane extends JEditorPane {
if (cardView == null) {
Plane plane = Plane.createPlaneByFullName(cardName);
if (plane != null) {
cardView = new CardView(new PlaneView(plane));
cardView = new CardView(new PlaneView(plane, null));
}
}

View file

@ -423,7 +423,7 @@ public class MageBook extends JComponent {
}
private void addEmblem(Emblem emblem, BigCard bigCard, UUID gameId, Rectangle rectangle) {
CardView cardView = new CardView(new EmblemView(emblem));
CardView cardView = new CardView(new EmblemView(emblem, null));
addCard(cardView, bigCard, gameId, rectangle, false);
}
@ -433,7 +433,7 @@ public class MageBook extends JComponent {
}
private void addPlane(Plane plane, BigCard bigCard, UUID gameId, Rectangle rectangle) {
CardView cardView = new CardView(new PlaneView(plane));
CardView cardView = new CardView(new PlaneView(plane, null));
addCard(cardView, bigCard, gameId, rectangle, false);
}

View file

@ -163,7 +163,7 @@ public class CardHintsHelperDialog extends MageDialog implements MageDesktopIcon
settings.add(this.currentGroup.toString());
// from search
if (this.currentSearch.length() > 0 && !this.currentSearch.equals(SEARCH_EMPTY_TEXT)) {
if (!this.currentSearch.isEmpty() && !this.currentSearch.equals(SEARCH_EMPTY_TEXT)) {
settings.add(this.currentSearch);
}
@ -235,6 +235,11 @@ public class CardHintsHelperDialog extends MageDialog implements MageDesktopIcon
this.lastHints.add(new CardHintInfo(currentPlayer, "hand", card));
});
// helper emblems for better UX
this.lastGameView.getMyHelperEmblems().values().forEach(card -> {
this.lastHints.add(new CardHintInfo(currentPlayer, "xmage", card));
});
// stack
this.lastGameView.getStack().values().forEach(card -> {
this.lastHints.add(new CardHintInfo(currentPlayer, "stack", card));

View file

@ -223,20 +223,20 @@ public class TestCardRenderDialog extends MageDialog {
return cardView;
}
private AbilityView createEmblem(Emblem emblem) {
AbilityView emblemView = new AbilityView(emblem.getAbilities().get(0), emblem.getName(), new CardView(new EmblemView(emblem)));
private AbilityView createEmblem(Game game, Emblem emblem) {
AbilityView emblemView = new AbilityView(emblem.getAbilities().get(0), emblem.getName(), new CardView(new EmblemView(emblem, game)));
emblemView.setName(emblem.getName());
return emblemView;
}
private AbilityView createDungeon(Dungeon dungeon) {
private AbilityView createDungeon(Game game, Dungeon dungeon) {
AbilityView emblemView = new AbilityView(dungeon.getAbilities().get(0), dungeon.getName(), new CardView(new DungeonView(dungeon)));
emblemView.setName(dungeon.getName());
return emblemView;
}
private AbilityView createPlane(Plane plane) {
AbilityView planeView = new AbilityView(plane.getAbilities().get(0), plane.getName(), new CardView(new PlaneView(plane)));
private AbilityView createPlane(Game game, Plane plane) {
AbilityView planeView = new AbilityView(plane.getAbilities().get(0), plane.getName(), new CardView(new PlaneView(plane, game)));
planeView.setName(plane.getName());
return planeView;
}

View file

@ -145,6 +145,7 @@ public final class GamePanel extends javax.swing.JPanel {
}
this.game.getMyHand().values().forEach(c -> this.allCardsIndex.put(c.getId(), c));
this.game.getMyHelperEmblems().values().forEach(c -> this.allCardsIndex.put(c.getId(), c));
this.game.getStack().values().forEach(c -> this.allCardsIndex.put(c.getId(), c));
this.game.getExile()
.stream()