mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Merge origin/master
This commit is contained in:
commit
d34c081f19
3 changed files with 22 additions and 23 deletions
|
@ -199,14 +199,14 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
// CardView popupMenu was invoked last
|
||||
private CardView cardViewPopupMenu;
|
||||
|
||||
// popup menu for a card
|
||||
private JPopupMenu popupMenuCardPanel;
|
||||
// popup menu for triggered abilities order
|
||||
private JPopupMenu popupMenuTriggerOrder;
|
||||
|
||||
public GamePanel() {
|
||||
initComponents();
|
||||
|
||||
createTriggerOrderPupupMenu();
|
||||
this.add(popupMenuCardPanel);
|
||||
initPopupMenuTriggerOrder();
|
||||
//this.add(popupMenuTriggerOrder);
|
||||
|
||||
pickNumber = new PickNumberDialog();
|
||||
MageFrame.getDesktop().add(pickNumber, JLayeredPane.MODAL_LAYER);
|
||||
|
@ -1107,12 +1107,10 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
hideAll();
|
||||
ShowCardsDialog showCards = new ShowCardsDialog();
|
||||
JPopupMenu popupMenu = null;
|
||||
Listener<Event> eventListener = null;
|
||||
if (PopUpMenuType.TRIGGER_ORDER.equals(popupMenuType)) {
|
||||
popupMenu = getTriggerOrderPopupMenu();
|
||||
eventListener = getTriggerOrderEventListener(showCards);
|
||||
popupMenu = popupMenuTriggerOrder;
|
||||
}
|
||||
showCards.loadCards(title, cards, bigCard, Config.dimensionsEnlarged, gameId, required, options, popupMenu, eventListener);
|
||||
showCards.loadCards(title, cards, bigCard, Config.dimensionsEnlarged, gameId, required, options, popupMenu, getShowCardsEventListener(showCards));
|
||||
return showCards;
|
||||
}
|
||||
|
||||
|
@ -1985,8 +1983,8 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
hoverButtons.put(name, button);
|
||||
}
|
||||
|
||||
// TriggerOrderPopupMenu
|
||||
private Listener<Event> getTriggerOrderEventListener(final ShowCardsDialog dialog) {
|
||||
// Event listener for the ShowCardsDialog
|
||||
private Listener<Event> getShowCardsEventListener(final ShowCardsDialog dialog) {
|
||||
return new Listener<Event>() {
|
||||
@Override
|
||||
public void event(Event event) {
|
||||
|
@ -2011,7 +2009,8 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
String abilityRuleText = null;
|
||||
if (cardViewPopupMenu instanceof CardView && cardViewPopupMenu.getAbility() != null) {
|
||||
abilityId = cardViewPopupMenu.getAbility().getId();
|
||||
if (!cardViewPopupMenu.getAbility().getRules().isEmpty() && !cardViewPopupMenu.getAbility().getRules().equals("")) {
|
||||
if (!cardViewPopupMenu.getAbility().getRules().isEmpty()
|
||||
&& !cardViewPopupMenu.getAbility().getRules().get(0).isEmpty()) {
|
||||
abilityRuleText = cardViewPopupMenu.getAbility().getRules().get(0);
|
||||
}
|
||||
}
|
||||
|
@ -2038,11 +2037,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
public JPopupMenu getTriggerOrderPopupMenu() {
|
||||
return popupMenuCardPanel;
|
||||
}
|
||||
|
||||
private void createTriggerOrderPupupMenu() {
|
||||
private void initPopupMenuTriggerOrder() {
|
||||
|
||||
ActionListener actionListener = new ActionListener() {
|
||||
@Override
|
||||
|
@ -2051,34 +2046,34 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
};
|
||||
|
||||
popupMenuCardPanel = new JPopupMenu();
|
||||
popupMenuTriggerOrder = new JPopupMenu();
|
||||
|
||||
// String tooltipText = "";
|
||||
JMenuItem menuItem;
|
||||
menuItem = new JMenuItem("Put this ability always first on the stack");
|
||||
menuItem.setActionCommand(CMD_AUTO_ORDER_FIRST);
|
||||
menuItem.addActionListener(actionListener);
|
||||
popupMenuCardPanel.add(menuItem);
|
||||
popupMenuTriggerOrder.add(menuItem);
|
||||
|
||||
menuItem = new JMenuItem("Put this ability always last on the stack");
|
||||
menuItem.setActionCommand(CMD_AUTO_ORDER_LAST);
|
||||
menuItem.addActionListener(actionListener);
|
||||
popupMenuCardPanel.add(menuItem);
|
||||
popupMenuTriggerOrder.add(menuItem);
|
||||
|
||||
menuItem = new JMenuItem("Put all abilities with that rule text always first on the stack");
|
||||
menuItem.setActionCommand(CMD_AUTO_ORDER_NAME_FIRST);
|
||||
menuItem.addActionListener(actionListener);
|
||||
popupMenuCardPanel.add(menuItem);
|
||||
popupMenuTriggerOrder.add(menuItem);
|
||||
|
||||
menuItem = new JMenuItem("Put all abilities with that rule text always last on the stack");
|
||||
menuItem.setActionCommand(CMD_AUTO_ORDER_NAME_LAST);
|
||||
menuItem.addActionListener(actionListener);
|
||||
popupMenuCardPanel.add(menuItem);
|
||||
popupMenuTriggerOrder.add(menuItem);
|
||||
|
||||
menuItem = new JMenuItem("Reset all order settings for triggered abilities");
|
||||
menuItem.setActionCommand(CMD_AUTO_ORDER_RESET_ALL);
|
||||
menuItem.addActionListener(actionListener);
|
||||
popupMenuCardPanel.add(menuItem);
|
||||
popupMenuTriggerOrder.add(menuItem);
|
||||
}
|
||||
|
||||
public String getGameLog() {
|
||||
|
|
|
@ -292,6 +292,10 @@ public class MageActionCallback implements ActionCallback {
|
|||
// drag'n'drop is allowed for HAND zone only
|
||||
return;
|
||||
}
|
||||
if (!SwingUtilities.isLeftMouseButton(e)) {
|
||||
// only allow draging with the left mouse button
|
||||
return;
|
||||
}
|
||||
isDragging = true;
|
||||
prevCard = card;
|
||||
Point p = card.getCardLocation();
|
||||
|
|
|
@ -85,7 +85,7 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect {
|
|||
this.playerId = effect.playerId;
|
||||
this.additionalCardType = effect.additionalCardType;
|
||||
this.gainsHaste = effect.gainsHaste;
|
||||
this.addedTokenPermanents.addAll(effect.addedTokenPermanents);
|
||||
this.addedTokenPermanents = new ArrayList<>(effect.addedTokenPermanents);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue