mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
Added F5 button to skip priority until end step of opponent. Added PlayerAction handling.
This commit is contained in:
parent
ebd21eab1d
commit
aa842efacc
17 changed files with 185 additions and 327 deletions
|
|
@ -48,6 +48,7 @@ import mage.client.components.MageTextArea;
|
|||
import mage.client.dialog.MageDialog;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
import mage.client.util.gui.ArrowBuilder;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.remote.Session;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -304,7 +305,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
}//GEN-LAST:event_btnSpecialActionPerformed
|
||||
|
||||
private void btnUndoActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
session.undo(gameId);
|
||||
session.sendPlayerAction(PlayerAction.UNDO, gameId);
|
||||
}
|
||||
|
||||
public void setHelperPanel(HelperPanel helper) {
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ import java.util.*;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import mage.constants.PlayerAction;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -942,6 +943,15 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
});
|
||||
|
||||
ks = KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0);
|
||||
this.getInputMap(c).put(ks, "F5_PRESS");
|
||||
this.getActionMap().put("F5_PRESS", new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
btnUntilEndOfTurnActionPerformed(null);
|
||||
}
|
||||
});
|
||||
|
||||
KeyStroke ks9 = KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0);
|
||||
this.getInputMap(c).put(ks9, "F9_PRESS");
|
||||
this.getActionMap().put("F9_PRESS", new AbstractAction() {
|
||||
|
|
@ -1345,25 +1355,31 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
|
||||
private void btnConcedeActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if (modalQuestion("Are you sure you want to concede?", "Confirm concede") == JOptionPane.YES_OPTION) {
|
||||
session.concedeGame(gameId);
|
||||
session.sendPlayerAction(PlayerAction.CONCEDE, gameId);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnEndTurnActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if (feedbackPanel != null && FeedbackMode.SELECT.equals(feedbackPanel.getMode())) {
|
||||
session.passTurnPriority(gameId);
|
||||
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_TURN, gameId);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnUntilEndOfTurnActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if (feedbackPanel != null && FeedbackMode.SELECT.equals(feedbackPanel.getMode())) {
|
||||
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_OPPONENTS_TURN_END_STEP, gameId);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnPassPriorityUntilNextYourTurnActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if (feedbackPanel != null && FeedbackMode.SELECT.equals(feedbackPanel.getMode())) {
|
||||
session.passPriorityUntilNextYourTurn(gameId);
|
||||
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_MY_NEXT_TURN, gameId);
|
||||
}
|
||||
}
|
||||
|
||||
private void restorePriorityActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if (feedbackPanel != null) {
|
||||
session.restorePriority(gameId);
|
||||
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_CANCEL_ALL_ACTIONS, gameId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ import javax.swing.event.ChangeListener;
|
|||
import mage.cards.decks.importer.DeckImporterUtil;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.view.PlayerView;
|
||||
|
||||
/**
|
||||
|
|
@ -149,7 +150,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
menuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
gamePanel.getSession().restorePriority(gameId);
|
||||
gamePanel.getSession().sendPlayerAction(PlayerAction.PASS_PRIORITY_CANCEL_ALL_ACTIONS, gameId);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -162,7 +163,18 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
menuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
gamePanel.getSession().passTurnPriority(gameId);
|
||||
gamePanel.getSession().sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_TURN, gameId);
|
||||
}
|
||||
});
|
||||
|
||||
menuItem = new JMenuItem("F5 - Skip phases until opponent's end step (stop on stack/attack/block)");
|
||||
popupMenu.add(menuItem);
|
||||
|
||||
// Skip to next end step of turn (F5)
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
gamePanel.getSession().sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_OPPONENTS_TURN_END_STEP, gameId);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -173,7 +185,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
menuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
gamePanel.getSession().passPriorityUntilNextYourTurn(gameId);
|
||||
gamePanel.getSession().sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_MY_NEXT_TURN, gameId);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -190,7 +202,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
public void actionPerformed(ActionEvent e) {
|
||||
boolean manaPoolAutomatic = ((JCheckBoxMenuItem)e.getSource()).getState();
|
||||
gamePanel.setMenuStates(manaPoolAutomatic);
|
||||
gamePanel.getSession().setManaPoolMode(manaPoolAutomatic, gameId);
|
||||
gamePanel.getSession().sendPlayerAction(manaPoolAutomatic ? PlayerAction.MANA_AUTO_PAYMENT_ON: PlayerAction.MANA_AUTO_PAYMENT_OFF, gameId);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -204,7 +216,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (JOptionPane.showConfirmDialog(PlayAreaPanel.this, "Are you sure you want to concede the game?", "Confirm concede game", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
MageFrame.getSession().concedeGame(gameId);
|
||||
MageFrame.getSession().sendPlayerAction(PlayerAction.CONCEDE, gameId);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -374,8 +374,9 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
.append("<br/>Turn mousewheel down (ALT-s) - enlarge original/alternate image of card the mousepointer hovers over")
|
||||
.append("<br/><b>F2</b> - Confirm \"Ok\", \"Yes\" or \"Done\" button")
|
||||
.append("<br/><b>F4</b> - Skip current turn but stop on declare attackers/blockers and something on the stack")
|
||||
.append("<br/><b>F5</b> - Skip to next end step of opponent's turn but stop on declare attackers/blockers and something on the stack")
|
||||
.append("<br/><b>F9</b> - Skip everything until your next turn")
|
||||
.append("<br/><b>F3</b> - Undo F4/F9").toString(),
|
||||
.append("<br/><b>F3</b> - Undo F4/F5/F9").toString(),
|
||||
null, MessageType.USER_INFO, ChatMessage.MessageColor.ORANGE);
|
||||
break;
|
||||
case TOURNAMENT:
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class PhaseManager {
|
|||
|
||||
private static final Preferences prefs = MageFrame.getPreferences();
|
||||
|
||||
private static Map<String, String> mapYou = new HashMap<String, String>() {{
|
||||
private static final Map<String, String> mapYou = new HashMap<String, String>() {{
|
||||
put("Upkeep - play instants and activated abilities.", UPKEEP_YOU);
|
||||
put("Draw - play instants and activated abilities.", DRAW_YOU);
|
||||
put("Precombat Main - play spells and abilities.", MAIN_YOU);
|
||||
|
|
@ -73,7 +73,7 @@ public class PhaseManager {
|
|||
put("End Turn - play instants and activated abilities.", END_OF_TURN_YOU);
|
||||
}};
|
||||
|
||||
private static Map<String, String> mapOthers = new HashMap<String, String>() {{
|
||||
private static final Map<String, String> mapOthers = new HashMap<String, String>() {{
|
||||
put("Upkeep - play instants and activated abilities.", UPKEEP_OTHERS);
|
||||
put("Draw - play instants and activated abilities.", DRAW_OTHERS);
|
||||
put("Precombat Main - play instants and activated abilities.", MAIN_OTHERS);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue