spjspj - Add the 'Skip to End Step of Previous Player' button to the GamePanel and associated changes

This commit is contained in:
spjspj 2016-03-27 00:07:23 +11:00
parent fa5dd387b4
commit 3dfe9de05f
13 changed files with 143 additions and 17 deletions

View file

@ -396,8 +396,8 @@ public final class GamePanel extends javax.swing.JPanel {
jSplitPane2.setDividerSize(GUISizeHelper.dividerBarSize); jSplitPane2.setDividerSize(GUISizeHelper.dividerBarSize);
stackObjects.setCardDimension(GUISizeHelper.handCardDimension); stackObjects.setCardDimension(GUISizeHelper.handCardDimension);
int newStackWidth = jPanel3.getWidth() * GUISizeHelper.stackWidth / 100; int newStackWidth = jPanel3.getWidth() * GUISizeHelper.stackWidth / 100;
if (newStackWidth < 360) { if (newStackWidth < 410) {
newStackWidth = 360; newStackWidth = 410;
} }
Dimension newDimension = new Dimension(jPanel3.getWidth() - newStackWidth, GUISizeHelper.handCardDimension.height + GUISizeHelper.scrollBarSize); Dimension newDimension = new Dimension(jPanel3.getWidth() - newStackWidth, GUISizeHelper.handCardDimension.height + GUISizeHelper.scrollBarSize);
handContainer.setPreferredSize(newDimension); handContainer.setPreferredSize(newDimension);
@ -508,6 +508,7 @@ public final class GamePanel extends javax.swing.JPanel {
this.btnSkipToNextMain.setVisible(true); this.btnSkipToNextMain.setVisible(true);
this.btnSkipStack.setVisible(true); this.btnSkipStack.setVisible(true);
this.btnSkipToYourTurn.setVisible(true); this.btnSkipToYourTurn.setVisible(true);
this.btnSkipToEndStepBeforeYourTurn.setVisible(true);
this.pnlReplay.setVisible(false); this.pnlReplay.setVisible(false);
@ -541,6 +542,7 @@ public final class GamePanel extends javax.swing.JPanel {
this.btnSkipToNextMain.setVisible(false); this.btnSkipToNextMain.setVisible(false);
this.btnSkipStack.setVisible(false); this.btnSkipStack.setVisible(false);
this.btnSkipToYourTurn.setVisible(false); this.btnSkipToYourTurn.setVisible(false);
this.btnSkipToEndStepBeforeYourTurn.setVisible(false);
this.pnlReplay.setVisible(false); this.pnlReplay.setVisible(false);
this.gameChatPanel.clear(); this.gameChatPanel.clear();
@ -774,7 +776,8 @@ public final class GamePanel extends javax.swing.JPanel {
} }
players.get(player.getPlayerId()).update(player); players.get(player.getPlayerId()).update(player);
if (player.getPlayerId().equals(playerId)) { if (player.getPlayerId().equals(playerId)) {
updateSkipButtons(player.isPassedTurn(), player.isPassedUntilEndOfTurn(), player.isPassedUntilNextMain(), player.isPassedAllTurns(), player.isPassedUntilStackResolved()); updateSkipButtons(player.isPassedTurn(), player.isPassedUntilEndOfTurn(), player.isPassedUntilNextMain(), player.isPassedAllTurns(), player.isPassedUntilStackResolved(),
player.isPassedUntilEndStepBeforeMyTurn());
} }
// update open or remove closed graveyard windows // update open or remove closed graveyard windows
graveyards.put(player.getName(), player.getGraveyard()); graveyards.put(player.getName(), player.getGraveyard());
@ -850,7 +853,7 @@ public final class GamePanel extends javax.swing.JPanel {
static final int BORDER_SIZE = 2; static final int BORDER_SIZE = 2;
private void updateSkipButtons(boolean turn, boolean endOfTurn, boolean nextMain, boolean allTurns, boolean stack) { private void updateSkipButtons(boolean turn, boolean endOfTurn, boolean nextMain, boolean allTurns, boolean stack, boolean endStepBeforeYourStep) {
if (turn) { //F4 if (turn) { //F4
btnSkipToNextTurn.setBorder(new LineBorder(Color.red, BORDER_SIZE)); btnSkipToNextTurn.setBorder(new LineBorder(Color.red, BORDER_SIZE));
} else { } else {
@ -877,6 +880,12 @@ public final class GamePanel extends javax.swing.JPanel {
btnSkipToYourTurn.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); btnSkipToYourTurn.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
} }
if (endStepBeforeYourStep) { // F11
btnSkipToEndStepBeforeYourTurn.setBorder(new LineBorder(Color.red, BORDER_SIZE));
} else {
btnSkipToEndStepBeforeYourTurn.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
}
} }
/** /**
@ -1274,6 +1283,7 @@ public final class GamePanel extends javax.swing.JPanel {
btnSkipToNextMain = new javax.swing.JButton(); // F7 btnSkipToNextMain = new javax.swing.JButton(); // F7
btnSkipStack = new javax.swing.JButton(); // F8 btnSkipStack = new javax.swing.JButton(); // F8
btnSkipToYourTurn = new javax.swing.JButton(); // F9 btnSkipToYourTurn = new javax.swing.JButton(); // F9
btnSkipToEndStepBeforeYourTurn = new javax.swing.JButton(); // F11
btnConcede = new javax.swing.JButton(); btnConcede = new javax.swing.JButton();
btnSwitchHands = new javax.swing.JButton(); btnSwitchHands = new javax.swing.JButton();
@ -1302,7 +1312,7 @@ public final class GamePanel extends javax.swing.JPanel {
handCards = new HashMap<>(); handCards = new HashMap<>();
pnlShortCuts.setOpaque(false); pnlShortCuts.setOpaque(false);
pnlShortCuts.setPreferredSize(new Dimension(400, 72)); pnlShortCuts.setPreferredSize(new Dimension(410, 72));
stackObjects = new mage.client.cards.Cards(); stackObjects = new mage.client.cards.Cards();
@ -1473,6 +1483,29 @@ public final class GamePanel extends javax.swing.JPanel {
} }
}); });
btnSkipToEndStepBeforeYourTurn.setContentAreaFilled(false);
btnSkipToEndStepBeforeYourTurn.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
btnSkipToEndStepBeforeYourTurn.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSkipEndStepBeforeYourTurnButtonImage()));
btnSkipToEndStepBeforeYourTurn.setToolTipText("Skip to the end step before your turn (F11) - adjust using preferences.");
btnSkipToEndStepBeforeYourTurn.setFocusable(false);
btnSkipToEndStepBeforeYourTurn.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent evt) {
if (evt.getButton() == MouseEvent.BUTTON1) {
btnSkipToEndStepBeforeYourTurnActionPerformed(null);
}
}
});
KeyStroke ks11 = KeyStroke.getKeyStroke(KeyEvent.VK_F11, 0);
this.getInputMap(c).put(ks11, "F11_PRESS");
this.getActionMap().put("F11_PRESS", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
btnSkipToEndStepBeforeYourTurnActionPerformed(actionEvent);
}
});
btnSkipStack.setContentAreaFilled(false); btnSkipStack.setContentAreaFilled(false);
btnSkipStack.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); btnSkipStack.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
btnSkipStack.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSkipStackButtonImage())); btnSkipStack.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSkipStackButtonImage()));
@ -1695,6 +1728,7 @@ public final class GamePanel extends javax.swing.JPanel {
.addComponent(btnSkipToNextMain) .addComponent(btnSkipToNextMain)
.addComponent(btnSkipToYourTurn) .addComponent(btnSkipToYourTurn)
.addComponent(btnSkipStack) .addComponent(btnSkipStack)
.addComponent(btnSkipToEndStepBeforeYourTurn)
) )
.addGroup(gl_pnlShortCuts.createSequentialGroup() .addGroup(gl_pnlShortCuts.createSequentialGroup()
.addComponent(txtSpellsCast) .addComponent(txtSpellsCast)
@ -1727,6 +1761,7 @@ public final class GamePanel extends javax.swing.JPanel {
.addComponent(btnSkipToNextMain) .addComponent(btnSkipToNextMain)
.addComponent(btnSkipToYourTurn) .addComponent(btnSkipToYourTurn)
.addComponent(btnSkipStack) .addComponent(btnSkipStack)
.addComponent(btnSkipToEndStepBeforeYourTurn)
) )
.addGroup(gl_pnlShortCuts.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(gl_pnlShortCuts.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(txtSpellsCast) .addComponent(txtSpellsCast)
@ -1799,8 +1834,8 @@ public final class GamePanel extends javax.swing.JPanel {
.addComponent(handContainer, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(handContainer, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
) )
.addGroup(gl_jPanel3.createParallelGroup(Alignment.LEADING) .addGroup(gl_jPanel3.createParallelGroup(Alignment.LEADING)
.addComponent(pnlShortCuts, 360, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) .addComponent(pnlShortCuts, 410, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
.addComponent(stackObjects, 360, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) .addComponent(stackObjects, 410, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
) )
) )
.addGap(0) .addGap(0)
@ -1886,6 +1921,9 @@ public final class GamePanel extends javax.swing.JPanel {
for (MouseListener ml : this.btnSkipStack.getMouseListeners()) { for (MouseListener ml : this.btnSkipStack.getMouseListeners()) {
this.btnSkipStack.removeMouseListener(ml); this.btnSkipStack.removeMouseListener(ml);
} }
for (MouseListener ml : this.btnSkipToEndStepBeforeYourTurn.getMouseListeners()) {
this.btnSkipToEndStepBeforeYourTurn.removeMouseListener(ml);
}
for (MouseListener ml : this.btnSkipToEndTurn.getMouseListeners()) { for (MouseListener ml : this.btnSkipToEndTurn.getMouseListeners()) {
this.btnSkipToEndTurn.removeMouseListener(ml); this.btnSkipToEndTurn.removeMouseListener(ml);
} }
@ -1956,37 +1994,43 @@ public final class GamePanel extends javax.swing.JPanel {
private void btnEndTurnActionPerformed(java.awt.event.ActionEvent evt) { private void btnEndTurnActionPerformed(java.awt.event.ActionEvent evt) {
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_TURN, gameId, null); session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_TURN, gameId, null);
AudioManager.playOnSkipButton(); AudioManager.playOnSkipButton();
updateSkipButtons(true, false, false, false, false); updateSkipButtons(true, false, false, false, false, false);
} }
private void btnUntilEndOfTurnActionPerformed(java.awt.event.ActionEvent evt) { private void btnUntilEndOfTurnActionPerformed(java.awt.event.ActionEvent evt) {
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_TURN_END_STEP, gameId, null); session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_TURN_END_STEP, gameId, null);
AudioManager.playOnSkipButton(); AudioManager.playOnSkipButton();
updateSkipButtons(false, true, false, false, false); updateSkipButtons(false, true, false, false, false, false);
} }
private void btnUntilNextMainPhaseActionPerformed(java.awt.event.ActionEvent evt) { private void btnUntilNextMainPhaseActionPerformed(java.awt.event.ActionEvent evt) {
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_MAIN_PHASE, gameId, null); session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_MAIN_PHASE, gameId, null);
AudioManager.playOnSkipButton(); AudioManager.playOnSkipButton();
updateSkipButtons(false, false, true, false, false); updateSkipButtons(false, false, true, false, false, false);
} }
private void btnPassPriorityUntilNextYourTurnActionPerformed(java.awt.event.ActionEvent evt) { private void btnPassPriorityUntilNextYourTurnActionPerformed(java.awt.event.ActionEvent evt) {
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_MY_NEXT_TURN, gameId, null); session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_MY_NEXT_TURN, gameId, null);
AudioManager.playOnSkipButton(); AudioManager.playOnSkipButton();
updateSkipButtons(false, false, false, true, false); updateSkipButtons(false, false, false, true, false, false);
} }
private void btnPassPriorityUntilStackResolvedActionPerformed(java.awt.event.ActionEvent evt) { private void btnPassPriorityUntilStackResolvedActionPerformed(java.awt.event.ActionEvent evt) {
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_STACK_RESOLVED, gameId, null); session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_STACK_RESOLVED, gameId, null);
AudioManager.playOnSkipButton(); AudioManager.playOnSkipButton();
updateSkipButtons(false, false, false, false, true); updateSkipButtons(false, false, false, false, true, false);
}
private void btnSkipToEndStepBeforeYourTurnActionPerformed(java.awt.event.ActionEvent evt) {
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_END_STEP_BEFORE_MY_NEXT_TURN, gameId, null);
AudioManager.playOnSkipButton();
updateSkipButtons(false, false, false, false, false, true);
} }
private void restorePriorityActionPerformed(java.awt.event.ActionEvent evt) { private void restorePriorityActionPerformed(java.awt.event.ActionEvent evt) {
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_CANCEL_ALL_ACTIONS, gameId, null); session.sendPlayerAction(PlayerAction.PASS_PRIORITY_CANCEL_ALL_ACTIONS, gameId, null);
AudioManager.playOnSkipButtonCancel(); AudioManager.playOnSkipButtonCancel();
updateSkipButtons(false, false, false, false, false); updateSkipButtons(false, false, false, false, false, false);
} }
private void mouseClickPhaseBar(MouseEvent evt) { private void mouseClickPhaseBar(MouseEvent evt) {
@ -2205,6 +2249,7 @@ public final class GamePanel extends javax.swing.JPanel {
private javax.swing.JButton btnSkipToNextMain; // F7 private javax.swing.JButton btnSkipToNextMain; // F7
private javax.swing.JButton btnSkipStack; // F8 private javax.swing.JButton btnSkipStack; // F8
private javax.swing.JButton btnSkipToYourTurn; // F9 private javax.swing.JButton btnSkipToYourTurn; // F9
private javax.swing.JButton btnSkipToEndStepBeforeYourTurn; // F11
private javax.swing.JButton btnConcede; private javax.swing.JButton btnConcede;
private javax.swing.JButton btnSwitchHands; private javax.swing.JButton btnSwitchHands;

View file

@ -184,6 +184,10 @@ public class PlayAreaPanel extends javax.swing.JPanel {
gamePanel.getSession().sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_MY_NEXT_TURN, gameId, null); gamePanel.getSession().sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_MY_NEXT_TURN, gameId, null);
break; break;
} }
case "F11": {
gamePanel.getSession().sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_END_STEP_BEFORE_MY_NEXT_TURN, gameId, null);
break;
}
} }
} }
}; };
@ -229,7 +233,14 @@ public class PlayAreaPanel extends javax.swing.JPanel {
menuItem = new JMenuItem("<html><b>F9</b> - Everything until your own next turn"); menuItem = new JMenuItem("<html><b>F9</b> - Everything until your own next turn");
menuItem.setActionCommand("F9"); menuItem.setActionCommand("F9");
menuItem.setToolTipText(tooltipText); menuItem.setToolTipText(tooltipText);
menuItem.setMnemonic(KeyEvent.VK_N); menuItem.setMnemonic(KeyEvent.VK_V);
skipMenu.add(menuItem);
menuItem.addActionListener(skipListener);
menuItem = new JMenuItem("<html><b>F11</b> - Everything until end step prior to your own next turn");
menuItem.setActionCommand("F11");
menuItem.setToolTipText(tooltipText);
menuItem.setMnemonic(KeyEvent.VK_P);
skipMenu.add(menuItem); skipMenu.add(menuItem);
menuItem.addActionListener(skipListener); menuItem.addActionListener(skipListener);

View file

@ -41,6 +41,7 @@ public interface ImageManager {
Image getSkipEndTurnButtonImage(); Image getSkipEndTurnButtonImage();
Image getSkipMainButtonImage(); Image getSkipMainButtonImage();
Image getSkipStackButtonImage(); Image getSkipStackButtonImage();
Image getSkipEndStepBeforeYourTurnButtonImage();
Image getSkipYourNextTurnButtonImage(); Image getSkipYourNextTurnButtonImage();

View file

@ -328,6 +328,14 @@ public class ImageManagerImpl implements ImageManager {
return imageSkipStackButton; return imageSkipStackButton;
} }
@Override
public Image getSkipEndStepBeforeYourTurnButtonImage() {
if (imageSkipUntilEndStepBeforeYourTurnButton == null) {
imageSkipUntilEndStepBeforeYourTurnButton = getBufferedImageFromResource("/buttons/skip_to_previous_end.png");
}
return imageSkipUntilEndStepBeforeYourTurnButton;
}
@Override @Override
public Image getSkipYourNextTurnButtonImage() { public Image getSkipYourNextTurnButtonImage() {
if (imageSkipYourNextTurnButton == null) { if (imageSkipYourNextTurnButton == null) {
@ -427,6 +435,7 @@ public class ImageManagerImpl implements ImageManager {
private static BufferedImage imageSkipToEndTurnButton; private static BufferedImage imageSkipToEndTurnButton;
private static BufferedImage imageSkipToMainButton; private static BufferedImage imageSkipToMainButton;
private static BufferedImage imageSkipStackButton; private static BufferedImage imageSkipStackButton;
private static BufferedImage imageSkipUntilEndStepBeforeYourTurnButton;
private static BufferedImage imageSkipYourNextTurnButton; private static BufferedImage imageSkipYourNextTurnButton;
private static Map<String, Image> phasesImages; private static Map<String, Image> phasesImages;

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -83,6 +83,7 @@ public class PlayerView implements Serializable {
private final boolean passedUntilNextMain; // F6 private final boolean passedUntilNextMain; // F6
private final boolean passedUntilStackResolved; // F8 private final boolean passedUntilStackResolved; // F8
private final boolean passedAllTurns; // F9 private final boolean passedAllTurns; // F9
private final boolean passedUntilEndStepBeforeMyTurn; // F11
public PlayerView(Player player, GameState state, Game game, UUID createdForPlayerId, UUID watcherUserId) { public PlayerView(Player player, GameState state, Game game, UUID createdForPlayerId, UUID watcherUserId) {
this.playerId = player.getId(); this.playerId = player.getId();
@ -167,6 +168,7 @@ public class PlayerView implements Serializable {
this.passedUntilNextMain = player.getPassedUntilNextMain(); this.passedUntilNextMain = player.getPassedUntilNextMain();
this.passedAllTurns = player.getPassedAllTurns(); this.passedAllTurns = player.getPassedAllTurns();
this.passedUntilStackResolved = player.getPassedUntilStackResolved(); this.passedUntilStackResolved = player.getPassedUntilStackResolved();
this.passedUntilEndStepBeforeMyTurn = player.getPassedUntilEndStepBeforeMyTurn();
} }
private boolean showInBattlefield(Permanent permanent, GameState state) { private boolean showInBattlefield(Permanent permanent, GameState state) {
@ -303,4 +305,8 @@ public class PlayerView implements Serializable {
public boolean isPassedUntilStackResolved() { public boolean isPassedUntilStackResolved() {
return passedUntilStackResolved; return passedUntilStackResolved;
} }
public boolean isPassedUntilEndStepBeforeMyTurn() {
return passedUntilEndStepBeforeMyTurn;
}
} }

View file

@ -91,6 +91,7 @@ import mage.game.permanent.Permanent;
import mage.game.tournament.Tournament; import mage.game.tournament.Tournament;
import mage.players.Player; import mage.players.Player;
import mage.players.PlayerImpl; import mage.players.PlayerImpl;
import mage.players.PlayerList;
import mage.target.Target; import mage.target.Target;
import mage.target.TargetAmount; import mage.target.TargetAmount;
import mage.target.TargetCard; import mage.target.TargetCard;
@ -589,6 +590,21 @@ public class HumanPlayer extends PlayerImpl {
return false; return false;
} }
} }
if (passedUntilEndStepBeforeMyTurn) {
if (!game.getTurn().getStepType().equals(PhaseStep.END_TURN)) {
if (passWithManaPoolCheck(game)) {
return false;
}
} else {
PlayerList playerList = game.getState().getPlayerList(playerId);
if (!playerList.getPrevious().equals(game.getActivePlayerId())) {
if (passWithManaPoolCheck(game)) {
return false;
}
}
}
}
if (game.getStack().isEmpty()) { if (game.getStack().isEmpty()) {
passedUntilStackResolved = false; passedUntilStackResolved = false;
boolean dontCheckPassStep = false; boolean dontCheckPassStep = false;
@ -878,7 +894,7 @@ public class HumanPlayer extends PlayerImpl {
FilterCreatureForCombat filter = filterCreatureForCombat.copy(); FilterCreatureForCombat filter = filterCreatureForCombat.copy();
filter.add(new ControllerIdPredicate(attackingPlayerId)); filter.add(new ControllerIdPredicate(attackingPlayerId));
while (!abort) { while (!abort) {
if (passedAllTurns if (passedAllTurns || passedUntilEndStepBeforeMyTurn
|| (!getUserData().getUserSkipPrioritySteps().isStopOnDeclareAttackersDuringSkipAction() && (passedTurn || passedUntilEndOfTurn || passedUntilNextMain))) { || (!getUserData().getUserSkipPrioritySteps().isStopOnDeclareAttackersDuringSkipAction() && (passedTurn || passedUntilEndOfTurn || passedUntilNextMain))) {
return; return;
} }

View file

@ -117,7 +117,6 @@ public class TestPlayer implements Player {
private int maxCallsWithoutAction = 100; private int maxCallsWithoutAction = 100;
private int foundNoAction = 0; private int foundNoAction = 0;
private boolean AIPlayer; private boolean AIPlayer;
private final List<PlayerAction> actions = new ArrayList<>(); private final List<PlayerAction> actions = new ArrayList<>();
private final List<String> choices = new ArrayList<>(); private final List<String> choices = new ArrayList<>();
private final List<String> targets = new ArrayList<>(); private final List<String> targets = new ArrayList<>();
@ -1929,6 +1928,11 @@ public class TestPlayer implements Player {
return computerPlayer.getPassedUntilStackResolved(); return computerPlayer.getPassedUntilStackResolved();
} }
@Override
public boolean getPassedUntilEndStepBeforeMyTurn() {
return computerPlayer.getPassedUntilEndStepBeforeMyTurn();
}
@Override @Override
public void revokePermissionToSeeHandCards() { public void revokePermissionToSeeHandCards() {
computerPlayer.revokePermissionToSeeHandCards(); computerPlayer.revokePermissionToSeeHandCards();

View file

@ -348,11 +348,17 @@ public class PlayerStub implements Player {
return false; return false;
} }
@Override @Override
public boolean getPassedAllTurns() { public boolean getPassedAllTurns() {
return false; return false;
} }
@Override
public boolean getPassedUntilEndStepBeforeMyTurn() {
return false;
}
@Override @Override
public AbilityType getJustActivatedType() { public AbilityType getJustActivatedType() {
return null; return null;

View file

@ -39,6 +39,7 @@ public enum PlayerAction {
PASS_PRIORITY_UNTIL_NEXT_MAIN_PHASE, PASS_PRIORITY_UNTIL_NEXT_MAIN_PHASE,
PASS_PRIORITY_UNTIL_NEXT_TURN, PASS_PRIORITY_UNTIL_NEXT_TURN,
PASS_PRIORITY_UNTIL_STACK_RESOLVED, PASS_PRIORITY_UNTIL_STACK_RESOLVED,
PASS_PRIORITY_UNTIL_END_STEP_BEFORE_MY_NEXT_TURN,
PASS_PRIORITY_CANCEL_ALL_ACTIONS, PASS_PRIORITY_CANCEL_ALL_ACTIONS,
TRIGGER_AUTO_ORDER_ABILITY_FIRST, TRIGGER_AUTO_ORDER_ABILITY_FIRST,
TRIGGER_AUTO_ORDER_NAME_FIRST, TRIGGER_AUTO_ORDER_NAME_FIRST,

View file

@ -193,6 +193,8 @@ public interface Player extends MageItem, Copyable<Player> {
boolean getPassedUntilStackResolved(); boolean getPassedUntilStackResolved();
boolean getPassedUntilEndStepBeforeMyTurn();
boolean getPassedAllTurns(); boolean getPassedAllTurns();
AbilityType getJustActivatedType(); AbilityType getJustActivatedType();

View file

@ -178,6 +178,7 @@ public abstract class PlayerImpl implements Player, Serializable {
protected boolean passedUntilEndOfTurn; // F5 protected boolean passedUntilEndOfTurn; // F5
protected boolean passedUntilNextMain; // F6 protected boolean passedUntilNextMain; // F6
protected boolean passedUntilStackResolved; // F8 protected boolean passedUntilStackResolved; // F8
protected boolean passedUntilEndStepBeforeMyTurn; // F11
protected Date dateLastAddedToStack; // F8 protected Date dateLastAddedToStack; // F8
protected boolean skippedAtLeastOnce; // used to track if passed started in specific phase protected boolean skippedAtLeastOnce; // used to track if passed started in specific phase
/** /**
@ -327,6 +328,7 @@ public abstract class PlayerImpl implements Player, Serializable {
this.passedUntilNextMain = player.passedUntilNextMain; this.passedUntilNextMain = player.passedUntilNextMain;
this.skippedAtLeastOnce = player.skippedAtLeastOnce; this.skippedAtLeastOnce = player.skippedAtLeastOnce;
this.passedUntilStackResolved = player.passedUntilStackResolved; this.passedUntilStackResolved = player.passedUntilStackResolved;
this.passedUntilEndStepBeforeMyTurn = player.passedUntilEndStepBeforeMyTurn;
this.dateLastAddedToStack = player.dateLastAddedToStack; this.dateLastAddedToStack = player.dateLastAddedToStack;
this.passedAllTurns = player.passedAllTurns; this.passedAllTurns = player.passedAllTurns;
this.justActivatedType = player.justActivatedType; this.justActivatedType = player.justActivatedType;
@ -454,6 +456,7 @@ public abstract class PlayerImpl implements Player, Serializable {
this.passedUntilNextMain = false; this.passedUntilNextMain = false;
this.skippedAtLeastOnce = false; this.skippedAtLeastOnce = false;
this.passedUntilStackResolved = false; this.passedUntilStackResolved = false;
this.passedUntilEndStepBeforeMyTurn = false;
this.passedAllTurns = false; this.passedAllTurns = false;
this.justActivatedType = null; this.justActivatedType = null;
this.canGainLife = true; this.canGainLife = true;
@ -1945,6 +1948,7 @@ public abstract class PlayerImpl implements Player, Serializable {
this.passedUntilEndOfTurn = false; this.passedUntilEndOfTurn = false;
this.passedUntilNextMain = false; this.passedUntilNextMain = false;
this.passedUntilStackResolved = false; this.passedUntilStackResolved = false;
this.passedUntilEndStepBeforeMyTurn = false;
this.dateLastAddedToStack = null; this.dateLastAddedToStack = null;
this.skippedAtLeastOnce = false; this.skippedAtLeastOnce = false;
this.passedAllTurns = false; this.passedAllTurns = false;
@ -1991,6 +1995,7 @@ public abstract class PlayerImpl implements Player, Serializable {
passedTurn = false; passedTurn = false;
passedAllTurns = true; passedAllTurns = true;
passedUntilStackResolved = false; passedUntilStackResolved = false;
passedUntilEndStepBeforeMyTurn = false;
this.skip(); this.skip();
break; break;
case PASS_PRIORITY_UNTIL_TURN_END_STEP: // F5 case PASS_PRIORITY_UNTIL_TURN_END_STEP: // F5
@ -1999,6 +2004,7 @@ public abstract class PlayerImpl implements Player, Serializable {
passedAllTurns = false; passedAllTurns = false;
passedUntilEndOfTurn = true; passedUntilEndOfTurn = true;
passedUntilStackResolved = false; passedUntilStackResolved = false;
passedUntilEndStepBeforeMyTurn = false;
skippedAtLeastOnce = !PhaseStep.END_TURN.equals(game.getTurn().getStepType()); skippedAtLeastOnce = !PhaseStep.END_TURN.equals(game.getTurn().getStepType());
this.skip(); this.skip();
break; break;
@ -2007,6 +2013,7 @@ public abstract class PlayerImpl implements Player, Serializable {
passedAllTurns = false; passedAllTurns = false;
passedUntilEndOfTurn = false; passedUntilEndOfTurn = false;
passedUntilStackResolved = false; passedUntilStackResolved = false;
passedUntilEndStepBeforeMyTurn = false;
passedTurn = true; passedTurn = true;
this.skip(); this.skip();
break; break;
@ -2016,6 +2023,7 @@ public abstract class PlayerImpl implements Player, Serializable {
passedUntilEndOfTurn = false; passedUntilEndOfTurn = false;
passedUntilNextMain = true; passedUntilNextMain = true;
passedUntilStackResolved = false; passedUntilStackResolved = false;
passedUntilEndStepBeforeMyTurn = false;
skippedAtLeastOnce = !(game.getTurn().getStepType().equals(PhaseStep.POSTCOMBAT_MAIN) || game.getTurn().getStepType().equals(PhaseStep.PRECOMBAT_MAIN)); skippedAtLeastOnce = !(game.getTurn().getStepType().equals(PhaseStep.POSTCOMBAT_MAIN) || game.getTurn().getStepType().equals(PhaseStep.PRECOMBAT_MAIN));
this.skip(); this.skip();
break; break;
@ -2025,15 +2033,26 @@ public abstract class PlayerImpl implements Player, Serializable {
passedUntilEndOfTurn = false; passedUntilEndOfTurn = false;
passedUntilNextMain = false; passedUntilNextMain = false;
passedUntilStackResolved = true; passedUntilStackResolved = true;
passedUntilEndStepBeforeMyTurn = false;
dateLastAddedToStack = game.getStack().getDateLastAdded(); dateLastAddedToStack = game.getStack().getDateLastAdded();
this.skip(); this.skip();
break; break;
case PASS_PRIORITY_UNTIL_END_STEP_BEFORE_MY_NEXT_TURN: //F11
passedAllTurns = false;
passedTurn = false;
passedUntilEndOfTurn = false;
passedUntilNextMain = false;
passedUntilStackResolved = false;
passedUntilEndStepBeforeMyTurn = true;
this.skip();
break;
case PASS_PRIORITY_CANCEL_ALL_ACTIONS: case PASS_PRIORITY_CANCEL_ALL_ACTIONS:
passedAllTurns = false; passedAllTurns = false;
passedTurn = false; passedTurn = false;
passedUntilEndOfTurn = false; passedUntilEndOfTurn = false;
passedUntilNextMain = false; passedUntilNextMain = false;
passedUntilStackResolved = false; passedUntilStackResolved = false;
passedUntilEndStepBeforeMyTurn = false;
break; break;
case PERMISSION_REQUESTS_ALLOWED_OFF: case PERMISSION_REQUESTS_ALLOWED_OFF:
userData.setAllowRequestShowHandCards(false); userData.setAllowRequestShowHandCards(false);
@ -2965,6 +2984,7 @@ public abstract class PlayerImpl implements Player, Serializable {
@Override @Override
public void becomesActivePlayer() { public void becomesActivePlayer() {
this.passedAllTurns = false; this.passedAllTurns = false;
this.passedUntilEndStepBeforeMyTurn = false;
this.turns++; this.turns++;
} }
@ -3462,6 +3482,11 @@ public abstract class PlayerImpl implements Player, Serializable {
return passedUntilStackResolved; return passedUntilStackResolved;
} }
@Override
public boolean getPassedUntilEndStepBeforeMyTurn() {
return passedUntilEndStepBeforeMyTurn;
}
@Override @Override
public AbilityType getJustActivatedType() { public AbilityType getJustActivatedType() {
return justActivatedType; return justActivatedType;