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