* Some changes to skip handling.

This commit is contained in:
LevelX2 2018-02-02 00:27:12 +01:00
parent f9ca04dfbb
commit db0fc1b439
2 changed files with 14 additions and 11 deletions

View file

@ -74,7 +74,6 @@ import mage.target.common.TargetDefender;
import mage.util.GameLog; import mage.util.GameLog;
import mage.util.ManaUtil; import mage.util.ManaUtil;
import mage.util.MessageToClient; import mage.util.MessageToClient;
import mage.util.RandomUtil;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
@ -152,7 +151,7 @@ public class HumanPlayer extends PlayerImpl {
protected void waitResponseOpen() { protected void waitResponseOpen() {
// wait response open for answer process // wait response open for answer process
while(!responseOpenedForAnswer && canRespond()) { while (!responseOpenedForAnswer && canRespond()) {
try { try {
Thread.sleep(100); Thread.sleep(100);
} catch (InterruptedException e) { } catch (InterruptedException e) {
@ -403,7 +402,7 @@ public class HumanPlayer extends PlayerImpl {
waitForResponse(game); waitForResponse(game);
String val = response.getString(); String val = response.getString();
if (val != null) { if (val != null) {
if(choice.isKeyChoice()){ if (choice.isKeyChoice()) {
choice.setChoiceByKey(val); choice.setChoiceByKey(val);
} else { } else {
choice.setChoice(val); choice.setChoice(val);
@ -747,8 +746,10 @@ public class HumanPlayer extends PlayerImpl {
} }
} }
if (game.getStack().isEmpty()) { if (game.getStack().isEmpty()) {
passedUntilStackResolved = false;
boolean dontCheckPassStep = 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 if (passedTurn
|| passedTurnSkipStack) { || passedTurnSkipStack) {
if (passWithManaPoolCheck(game)) { if (passWithManaPoolCheck(game)) {
@ -1797,7 +1798,7 @@ public class HumanPlayer extends PlayerImpl {
@Override @Override
public void skip() { public void skip() {
waitResponseOpen(); // waitResponseOpen(); //skip is direct event, no need to wait it
synchronized (response) { synchronized (response) {
response.setInteger(0); response.setInteger(0);
response.notifyAll(); response.notifyAll();

View file

@ -139,7 +139,7 @@ public abstract class PlayerImpl implements Player, Serializable {
protected boolean passedUntilEndOfTurn; // F5 protected boolean passedUntilEndOfTurn; // F5
protected boolean passedUntilNextMain; // F7 protected boolean passedUntilNextMain; // F7
protected boolean passedUntilStackResolved; // F10 protected boolean passedUntilStackResolved; // F10
protected Date dateLastAddedToStack; // F10 protected Date dateLastAddedToStack;
protected boolean passedUntilEndStepBeforeMyTurn; // F11 protected boolean passedUntilEndStepBeforeMyTurn; // F11
protected boolean skippedAtLeastOnce; // used to track if passed started in specific phase 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); skippedAtLeastOnce = !(game.getTurn().getStepType() == PhaseStep.POSTCOMBAT_MAIN || game.getTurn().getStepType() == PhaseStep.PRECOMBAT_MAIN);
this.skip(); this.skip();
break; break;
case PASS_PRIORITY_UNTIL_STACK_RESOLVED: //F8 case PASS_PRIORITY_UNTIL_STACK_RESOLVED: // Default F10 - Skips until the current stack is resolved
resetPlayerPassedActions(); if (!game.getStack().isEmpty()) { // If stack is empty do nothing
passedUntilStackResolved = true; resetPlayerPassedActions();
dateLastAddedToStack = game.getStack().getDateLastAdded(); passedUntilStackResolved = true;
this.skip(); dateLastAddedToStack = game.getStack().getDateLastAdded();
this.skip();
}
break; break;
case PASS_PRIORITY_UNTIL_END_STEP_BEFORE_MY_NEXT_TURN: //F11 case PASS_PRIORITY_UNTIL_END_STEP_BEFORE_MY_NEXT_TURN: //F11
resetPlayerPassedActions(); resetPlayerPassedActions();