use of org.magic.game.model.counters.ItemCounter in project MtgDesktopCompanion by nicho92.
the class DisplayableCard method initActions.
public void initActions() {
if (rightActions) {
menu.removeAll();
menu.add(new JMenuItem(new SelectionActions(this)));
menu.add(new JMenuItem(new TapActions(this)));
if (magicCard.getFullType().toLowerCase().contains("creature")) {
JMenu mnuModifier = new JMenu("P/T");
mnuModifier.add(new BonusCounterActions(this, new BonusCounter(1, 0)));
mnuModifier.add(new BonusCounterActions(this, new BonusCounter(-1, 0)));
mnuModifier.add(new BonusCounterActions(this, new BonusCounter(0, 1)));
mnuModifier.add(new BonusCounterActions(this, new BonusCounter(0, -1)));
mnuModifier.add(new BonusCounterActions(this, new BonusCounter(1, 1)));
mnuModifier.add(new BonusCounterActions(this, new BonusCounter(-1, -1)));
mnuModifier.add(new FixCreaturePowerActions(this));
menu.add(mnuModifier);
}
JMenu mnuCounter = new JMenu("Counter");
mnuCounter.add(new ItemCounterActions(this, new ItemCounter("Yellow", Color.YELLOW)));
mnuCounter.add(new ItemCounterActions(this, new ItemCounter("Green", Color.GREEN)));
mnuCounter.add(new ItemCounterActions(this, new ItemCounter("Orange", Color.ORANGE)));
menu.add(mnuCounter);
if (magicCard.getFullType().contains("Planeswalker")) {
JMenu mnuModifier = new JMenu("Loyalty");
for (LoyaltyCounter count : listLoyalty()) mnuModifier.add(new LoyaltyActions(this, count));
menu.add(mnuModifier);
}
if (magicCard.getSubtypes().contains("Aura") || magicCard.getSubtypes().contains("Equipment")) {
menu.add(new JMenuItem(new AttachActions(this)));
}
Set<MTGKeyWord> l = MTGControler.getInstance().getKeyWordManager().getKeywordsFrom(magicCard);
JMenu abilities = new JMenu("Actions");
if (magicCard.getLayout().equalsIgnoreCase("aftermath"))
l.add(MTGControler.getInstance().getKeyWordManager().generateFromString("Aftermath"));
if (!l.isEmpty()) {
for (final MTGKeyWord k : l) {
JMenuItem it;
try {
it = new JMenuItem(generateActionFrom(k));
} catch (Exception e) {
it = new JMenuItem(k.getKeyword());
it.setToolTipText(k.getDescription());
}
abilities.add(it);
}
menu.add(abilities);
}
if (!counters.isEmpty()) {
JMenu mnuModifier = new JMenu("Remove Counter");
for (final AbstractCounter count : counters) mnuModifier.add(new JMenuItem(new RemoveCounterActions(this, count)));
menu.add(mnuModifier);
}
if (magicCard.getText() != null && magicCard.getText().contains("copy of"))
menu.add(new CopyFromActions(this));
menu.add(sep);
if (GamePanelGUI.getInstance().getTokenGenerator().isTokenizer(magicCard)) {
menu.add(new JMenuItem(new CreateActions(this)));
}
if (GamePanelGUI.getInstance().getTokenGenerator().isEmblemizer(magicCard))
menu.add(new JMenuItem(new EmblemActions(this)));
setComponentPopupMenu(menu);
}
}
use of org.magic.game.model.counters.ItemCounter 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);
}
}
Aggregations