use of mage.players.StubPlayer in project mage by magefree.
the class TestGameType method reloadCards.
private void reloadCards() {
// apply selected theme (warning, it will be applied for all app, so can be bugged in other dialogs - but it's ok for debug)
PreferencesDialog.setCurrentTheme((ThemeType) comboTheme.getSelectedItem());
cardsPanel.cleanUp();
cardsPanel.setCustomRenderMode(comboRenderMode.getSelectedIndex());
// enable full battlefield render mode (it was bugged in test dialog so was disabled in old days, not it works fine)
cardsPanel.setCustomNeedFullPermanentRender(true);
cardsPanel.setCustomCardSize(new Dimension(getCardWidth(), getCardHeight()));
cardsPanel.setCustomXOffsetBetweenCardsOrColumns(10);
cardsPanel.setCustomCardIconsPanelPosition(CardIconPosition.fromString((String) comboCardIconsPosition.getSelectedItem()));
cardsPanel.setCustomCardIconsPanelOrder(CardIconOrder.fromString((String) comboCardIconsOrder.getSelectedItem()));
cardsPanel.setCustomCardIconsPanelColor((CardIconColor) comboCardColor.getSelectedItem());
cardsPanel.setCustomCardIconsMaxVisibleCount((Integer) spinnerCardIconsMaxVisible.getValue());
int needAdditionalIcons = Math.min(99, Math.max(0, (Integer) spinnerCardIconsAdditionalAmount.getValue()));
// reload new settings
cardsPanel.changeGUISize();
// sample popup menus
JMenuItem item;
JPopupMenu popupCardMenu = new JPopupMenu();
item = new JMenuItem("Card menu 1");
popupCardMenu.add(item);
item = new JMenuItem("Card menu 2");
popupCardMenu.add(item);
item = new JMenuItem("Card menu 3");
popupCardMenu.add(item);
//
JPopupMenu popupPanelMenu = new JPopupMenu();
item = new JMenuItem("Panel menu 1");
popupPanelMenu.add(item);
item = new JMenuItem("Panel menu 2");
popupPanelMenu.add(item);
item = new JMenuItem("Panel menu 3");
popupPanelMenu.add(item);
// init card listener for clicks, menu and other events
if (this.cardListener == null) {
this.cardListener = event -> {
switch(event.getEventType()) {
case CARD_CLICK:
case CARD_DOUBLE_CLICK:
handleCardClick(event);
break;
case CARD_POPUP_MENU:
if (event.getSource() != null) {
// card
handlePopupMenu(event, popupCardMenu);
} else {
// panel
handlePopupMenu(event, popupPanelMenu);
}
break;
}
};
cardsPanel.addCardEventListener(this.cardListener);
}
game = new TestGame(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20);
Deck deck = new Deck();
Player playerYou = new StubPlayer("player1", RangeOfInfluence.ALL);
game.addPlayer(playerYou, deck);
Player playerOpponent = new StubPlayer("player2", RangeOfInfluence.ALL);
game.addPlayer(playerOpponent, deck);
List<Ability> additionalIcons = Collections.singletonList(new SimpleStaticAbility(Zone.ALL, null));
for (int i = 0; i < needAdditionalIcons; i++) {
String text = "";
if (RandomUtil.nextBoolean()) {
if (RandomUtil.nextBoolean()) {
text = "75";
} else {
text = "8";
}
}
additionalIcons.get(0).addIcon(new CardIconImpl(CardIconType.PLAYABLE_COUNT, "test icon " + i + 1, text));
}
List<CardView> cardViews = new ArrayList<>();
/* // test morphed
cardViews.add(createPermanentCard(game, playerYou.getId(), "RNA", "263", 0, 0, 0, false, null)); // mountain
cardViews.add(createPermanentCard(game, playerYou.getId(), "RNA", "185", 0, 0, 0, true, null)); // Judith, the Scourge Diva
cardViews.add(createHandCard(game, playerYou.getId(), "DIS", "153")); // Odds // Ends (split card)
cardViews.add(createHandCard(game, playerYou.getId(), "ELD", "38")); // Animating Faerie (adventure card)
cardViews.add(createFaceDownCard(game, playerOpponent.getId(), "ELD", "38", false, false, false)); // face down
cardViews.add(createFaceDownCard(game, playerOpponent.getId(), "ELD", "38", true, false, true)); // morphed
cardViews.add(createFaceDownCard(game, playerOpponent.getId(), "ELD", "38", false, true, false)); // manifested
//*/
/* //test emblems
cardViews.add(createPermanentCard(game, playerYou.getId(), "RNA", "78", 125, 89, 0, false, false, null)); // Noxious Groodion
cardViews.add(createPermanentCard(game, playerYou.getId(), "RNA", "14", 3, 5, 2, false, false, null)); // Knight of Sorrows
cardViews.add(createPermanentCard(game, playerYou.getId(), "DKA", "140", 5, 2, 2, false, false, null)); // Huntmaster of the Fells, transforms
cardViews.add(createPermanentCard(game, playerYou.getId(), "RNA", "221", 0, 0, 0, false, false, null)); // Bedeck // Bedazzle
cardViews.add(createPermanentCard(game, playerYou.getId(), "XLN", "234", 0, 0, 0, false, false, null)); // Conqueror's Galleon
cardViews.add(createEmblem(new AjaniAdversaryOfTyrantsEmblem())); // Emblem Ajani
cardViews.add(createPlane(new AkoumPlane())); // Plane - Akoum
//*/
// test split, transform and mdf in hands
// Accursed Witch
cardViews.add(createHandCard(game, playerYou.getId(), "SOI", "97"));
// Fire // Ice
cardViews.add(createHandCard(game, playerYou.getId(), "UMA", "225"));
// Giant Killer
cardViews.add(createHandCard(game, playerYou.getId(), "ELD", "14"));
// Akoum Warrior
cardViews.add(createHandCard(game, playerYou.getId(), "ZNR", "134"));
// */
// * //test card icons
// Grizzly Bears
cardViews.add(createHandCard(game, playerYou.getId(), "POR", "169"));
// Huntmaster of the Fells, transforms
cardViews.add(createHandCard(game, playerYou.getId(), "DKA", "140"));
// Huntmaster of the Fells, transforms
cardViews.add(createPermanentCard(game, playerYou.getId(), "DKA", "140", 3, 3, 1, false, true, additionalIcons));
// Hinterland Drake
cardViews.add(createPermanentCard(game, playerYou.getId(), "MB1", "401", 1, 1, 0, false, false, additionalIcons));
// duplicate cards
if (checkBoxGenerateManyCards.isSelected()) {
while (cardViews.size() < 30) {
int addingCount = cardViews.size();
for (int i = 0; i < addingCount; i++) {
CardView view = cardViews.get(i);
CardView newView = new CardView(view);
cardViews.add(newView);
}
}
}
BigCard big = new BigCard();
CardsView view = new CardsView(cardViews);
cardsPanel.loadCards(view, big, game.getId());
}
Aggregations