mirror of
https://github.com/correl/mage.git
synced 2024-11-24 11:09:54 +00:00
* Some changes to skip handling.
This commit is contained in:
parent
f9ca04dfbb
commit
db0fc1b439
2 changed files with 14 additions and 11 deletions
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue