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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
Aggregations