Search in sources :

Example 11 with DisplayableCard

use of org.magic.game.gui.components.DisplayableCard in project MtgDesktopCompanion by nicho92.

the class AftermathActions method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    try {
        super.actionPerformed(e);
        DisplayableCard card2 = new DisplayableCard(mc, MTGControler.getInstance().getCardsDimension(), true);
        GamePanelGUI.getInstance().getPlayer().logAction("Aftermath " + card2 + " for " + cost);
        GamePanelGUI.getInstance().getPlayer().getGraveyard().remove(card.getMagicCard());
        GamePanelGUI.getInstance().getPlayer().getGraveyard().add(mc);
        GamePanelGUI.getInstance().getPlayer().playCardFromGraveyard(mc);
        GamePanelGUI.getInstance().getPanelGrave().remove(card);
        GamePanelGUI.getInstance().getPanelGrave().postTreatment(card);
        GamePanelGUI.getInstance().getPanelBattleField().addComponent(card2);
        GamePanelGUI.getInstance().getPanelBattleField().updatePanel();
    } catch (Exception e1) {
        logger.error(e1);
    }
}
Also used : DisplayableCard(org.magic.game.gui.components.DisplayableCard)

Example 12 with DisplayableCard

use of org.magic.game.gui.components.DisplayableCard in project MtgDesktopCompanion by nicho92.

the class CreateActions method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    try {
        MagicCard tok = GamePanelGUI.getInstance().getTokenGenerator().generateTokenFor(card.getMagicCard());
        DisplayableCard dc = new DisplayableCard(tok, MTGControler.getInstance().getCardsDimension(), true);
        dc.setMagicCard(tok);
        GamePanelGUI.getInstance().getPanelBattleField().addComponent(dc);
        GamePanelGUI.getInstance().getPanelBattleField().revalidate();
        GamePanelGUI.getInstance().getPanelBattleField().repaint();
        GamePanelGUI.getInstance().getPlayer().playToken(tok);
    } catch (Exception ex) {
        logger.error(ex);
    }
}
Also used : MagicCard(org.magic.api.beans.MagicCard) DisplayableCard(org.magic.game.gui.components.DisplayableCard)

Example 13 with DisplayableCard

use of org.magic.game.gui.components.DisplayableCard in project MtgDesktopCompanion by nicho92.

the class EmbalmActions method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    try {
        MagicCard tok = GamePanelGUI.getInstance().getTokenGenerator().generateTokenFor(card.getMagicCard());
        DisplayableCard dc = new DisplayableCard(tok, MTGControler.getInstance().getCardsDimension(), true);
        dc.addCounter(new ItemCounter("Embalm", Color.YELLOW));
        dc.setMagicCard(tok);
        GamePanelGUI.getInstance().getPlayer().exileCardFromGraveyard(card.getMagicCard());
        GamePanelGUI.getInstance().getPanelGrave().remove(card);
        GamePanelGUI.getInstance().getPanelBattleField().addComponent(dc);
        GamePanelGUI.getInstance().getPanelBattleField().revalidate();
        GamePanelGUI.getInstance().getPanelBattleField().repaint();
        GamePanelGUI.getInstance().getPanelGrave().postTreatment(card);
        GamePanelGUI.getInstance().getPlayer().playToken(tok);
        GamePanelGUI.getInstance().getPlayer().logAction("Embalm " + card);
    } catch (Exception ex) {
        logger.error(ex);
    }
}
Also used : MagicCard(org.magic.api.beans.MagicCard) DisplayableCard(org.magic.game.gui.components.DisplayableCard) ItemCounter(org.magic.game.model.counters.ItemCounter)

Example 14 with DisplayableCard

use of org.magic.game.gui.components.DisplayableCard in project MtgDesktopCompanion by nicho92.

the class EternalizeActions method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    try {
        MagicCard tok = GamePanelGUI.getInstance().getTokenGenerator().generateTokenFor(card.getMagicCard());
        DisplayableCard dc = new DisplayableCard(tok, MTGControler.getInstance().getCardsDimension(), true);
        dc.setMagicCard(tok);
        GamePanelGUI.getInstance().getPlayer().exileCardFromGraveyard(card.getMagicCard());
        GamePanelGUI.getInstance().getPanelGrave().remove(card);
        GamePanelGUI.getInstance().getPanelBattleField().addComponent(dc);
        GamePanelGUI.getInstance().getPanelBattleField().revalidate();
        GamePanelGUI.getInstance().getPanelBattleField().repaint();
        GamePanelGUI.getInstance().getPanelGrave().postTreatment(card);
        GamePanelGUI.getInstance().getPlayer().playToken(tok);
        GamePanelGUI.getInstance().getPlayer().logAction("Embalm " + card);
    } catch (Exception ex) {
        logger.error(ex);
    }
}
Also used : MagicCard(org.magic.api.beans.MagicCard) DisplayableCard(org.magic.game.gui.components.DisplayableCard)

Example 15 with DisplayableCard

use of org.magic.game.gui.components.DisplayableCard in project MtgDesktopCompanion by nicho92.

the class SearchCardFrame method init.

private void init(Player p, final PositionEnum source) {
    setSize(new Dimension(800, 600));
    scPane = new JScrollPane();
    pane = new HandPanel() {

        @Override
        public PositionEnum getOrigine() {
            return source;
        }

        @Override
        public void moveCard(DisplayableCard mc, PositionEnum to) {
            switch(source) {
                case LIBRARY:
                    GamePanelGUI.getInstance().getPanelLibrary().moveCard(mc, to);
                    break;
                case EXIL:
                    GamePanelGUI.getInstance().getExilPanel().moveCard(mc, to);
                    break;
                case GRAVEYARD:
                    GamePanelGUI.getInstance().getPanelGrave().moveCard(mc, to);
                    break;
                default:
                    break;
            }
        }
    };
    pane.setPlayer(p);
    scPane.setViewportView(pane);
    getContentPane().add(scPane);
}
Also used : JScrollPane(javax.swing.JScrollPane) PositionEnum(org.magic.game.model.PositionEnum) DisplayableCard(org.magic.game.gui.components.DisplayableCard) Dimension(java.awt.Dimension) HandPanel(org.magic.game.gui.components.HandPanel)

Aggregations

DisplayableCard (org.magic.game.gui.components.DisplayableCard)20 MagicCard (org.magic.api.beans.MagicCard)10 Dimension (java.awt.Dimension)4 IOException (java.io.IOException)4 MagicEdition (org.magic.api.beans.MagicEdition)4 JScrollPane (javax.swing.JScrollPane)3 BorderLayout (java.awt.BorderLayout)2 FlowLayout (java.awt.FlowLayout)2 GridLayout (java.awt.GridLayout)2 Point (java.awt.Point)2 ArrayList (java.util.ArrayList)2 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)2 JButton (javax.swing.JButton)2 JLabel (javax.swing.JLabel)2 JPanel (javax.swing.JPanel)2 JSplitPane (javax.swing.JSplitPane)2 JTextField (javax.swing.JTextField)2 PositionEnum (org.magic.game.model.PositionEnum)2 Component (java.awt.Component)1 GridBagConstraints (java.awt.GridBagConstraints)1