From db0fc1b4395dc1fd31e43b40c97eb0e3e104a251 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 2 Feb 2018 00:27:12 +0100 Subject: [PATCH] * Some changes to skip handling. --- .../src/mage/player/human/HumanPlayer.java | 11 ++++++----- Mage/src/main/java/mage/players/PlayerImpl.java | 14 ++++++++------ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index 0980c720e9..bdda0915ed 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -74,7 +74,6 @@ import mage.target.common.TargetDefender; import mage.util.GameLog; import mage.util.ManaUtil; import mage.util.MessageToClient; -import mage.util.RandomUtil; import org.apache.log4j.Logger; /** @@ -152,7 +151,7 @@ public class HumanPlayer extends PlayerImpl { protected void waitResponseOpen() { // wait response open for answer process - while(!responseOpenedForAnswer && canRespond()) { + while (!responseOpenedForAnswer && canRespond()) { try { Thread.sleep(100); } catch (InterruptedException e) { @@ -403,7 +402,7 @@ public class HumanPlayer extends PlayerImpl { waitForResponse(game); String val = response.getString(); if (val != null) { - if(choice.isKeyChoice()){ + if (choice.isKeyChoice()) { choice.setChoiceByKey(val); } else { choice.setChoice(val); @@ -747,8 +746,10 @@ public class HumanPlayer extends PlayerImpl { } } if (game.getStack().isEmpty()) { - passedUntilStackResolved = false; boolean dontCheckPassStep = false; + if (passedUntilStackResolved) { // Don't skip to next step with this action. It always only resolves a stack. If stack is empty it does nothing. + dontCheckPassStep = true; + } if (passedTurn || passedTurnSkipStack) { if (passWithManaPoolCheck(game)) { @@ -1797,7 +1798,7 @@ public class HumanPlayer extends PlayerImpl { @Override public void skip() { - waitResponseOpen(); + // waitResponseOpen(); //skip is direct event, no need to wait it synchronized (response) { response.setInteger(0); response.notifyAll(); diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 051afdd9f8..93724ea0ec 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -139,7 +139,7 @@ public abstract class PlayerImpl implements Player, Serializable { protected boolean passedUntilEndOfTurn; // F5 protected boolean passedUntilNextMain; // F7 protected boolean passedUntilStackResolved; // F10 - protected Date dateLastAddedToStack; // F10 + protected Date dateLastAddedToStack; protected boolean passedUntilEndStepBeforeMyTurn; // F11 protected boolean skippedAtLeastOnce; // used to track if passed started in specific phase /** @@ -2105,11 +2105,13 @@ public abstract class PlayerImpl implements Player, Serializable { skippedAtLeastOnce = !(game.getTurn().getStepType() == PhaseStep.POSTCOMBAT_MAIN || game.getTurn().getStepType() == PhaseStep.PRECOMBAT_MAIN); this.skip(); break; - case PASS_PRIORITY_UNTIL_STACK_RESOLVED: //F8 - resetPlayerPassedActions(); - passedUntilStackResolved = true; - dateLastAddedToStack = game.getStack().getDateLastAdded(); - this.skip(); + case PASS_PRIORITY_UNTIL_STACK_RESOLVED: // Default F10 - Skips until the current stack is resolved + if (!game.getStack().isEmpty()) { // If stack is empty do nothing + resetPlayerPassedActions(); + passedUntilStackResolved = true; + dateLastAddedToStack = game.getStack().getDateLastAdded(); + this.skip(); + } break; case PASS_PRIORITY_UNTIL_END_STEP_BEFORE_MY_NEXT_TURN: //F11 resetPlayerPassedActions();