Added F10 to skip priority while the stack resolves.

This commit is contained in:
LevelX2 2014-11-16 09:00:28 +01:00
parent a2484cc6d9
commit 5b78dbe5c2
5 changed files with 47 additions and 7 deletions

View file

@ -210,7 +210,9 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
@Override
public String toString() {
StringBuilder sbMana = new StringBuilder();
if (colorless > 0) {
sbMana.append("{").append(Integer.toString(colorless)).append("}");
}
for (int i = 0; i < red; i++) {
sbMana.append("{R}");
}
@ -220,18 +222,15 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
for (int i = 0; i < blue; i++) {
sbMana.append("{U}");
}
for (int i = 0; i < black; i++) {
sbMana.append("{B}");
}
for (int i = 0; i < white; i++) {
sbMana.append("{W}");
}
for (int i = 0; i < black; i++) {
sbMana.append("{B}");
}
for (int i = 0; i < any; i++) {
sbMana.append("{Any}");
}
if (colorless > 0) {
sbMana.append("{").append(Integer.toString(colorless)).append("}");
}
return sbMana.toString();
}

View file

@ -37,6 +37,7 @@ public enum PlayerAction {
PASS_PRIORITY_UNTIL_TURN_END_STEP,
PASS_PRIORITY_UNTIL_NEXT_MAIN_PHASE,
PASS_PRIORITY_UNTIL_NEXT_TURN,
PASS_PRIORITY_UNTIL_STACK_RESOLVED,
PASS_PRIORITY_CANCEL_ALL_ACTIONS,
UNDO,
CONCEDE,

View file

@ -29,6 +29,7 @@
package mage.game.stack;
import java.util.ArrayDeque;
import java.util.Date;
import java.util.UUID;
import mage.MageObject;
import mage.constants.Zone;
@ -41,6 +42,8 @@ import mage.game.events.GameEvent;
*/
public class SpellStack extends ArrayDeque<StackObject> {
protected Date dateLastAdded;
public SpellStack () {}
public SpellStack(final SpellStack stack) {
@ -123,4 +126,15 @@ public class SpellStack extends ArrayDeque<StackObject> {
public SpellStack copy() {
return new SpellStack(this);
}
@Override
public void push(StackObject e) {
super.push(e);
this.dateLastAdded = new Date();
}
public Date getDateLastAdded() {
return dateLastAdded;
}
}

View file

@ -127,6 +127,7 @@ public interface Player extends MageItem, Copyable<Player> {
boolean getPassedTurn();
boolean getPassedUntilEndOfTurn();
boolean getPassedUntilNextMain();
boolean getPassedUntilStackResolved();
boolean getPassedAllTurns();
boolean hasLost();

View file

@ -30,6 +30,7 @@ package mage.players;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -159,6 +160,8 @@ public abstract class PlayerImpl implements Player, Serializable {
protected boolean passedTurn; // F4
protected boolean passedUntilEndOfTurn; // F5
protected boolean passedUntilNextMain; // F6
protected boolean passedUntilStackResolved; // F8
protected Date dateLastAddedToStack; // F8
protected boolean skippedAtLeastOnce; // used to track if passed started in specific phase
/**
* This indicates that player passed all turns until his own turn starts (F9).
@ -293,6 +296,8 @@ public abstract class PlayerImpl implements Player, Serializable {
this.passedUntilEndOfTurn = player.passedUntilEndOfTurn;
this.passedUntilNextMain = player.passedUntilNextMain;
this.skippedAtLeastOnce = player.skippedAtLeastOnce;
this.passedUntilStackResolved = player.passedUntilStackResolved;
this.dateLastAddedToStack = player.dateLastAddedToStack;
this.passedAllTurns = player.passedAllTurns;
this.priorityTimeLeft = player.getPriorityTimeLeft();
@ -404,6 +409,7 @@ public abstract class PlayerImpl implements Player, Serializable {
this.passedUntilEndOfTurn = false;
this.passedUntilNextMain = false;
this.skippedAtLeastOnce = false;
this.passedUntilStackResolved = false;
this.passedAllTurns = false;
this.canGainLife = true;
this.canLoseLife = true;
@ -1708,6 +1714,7 @@ public abstract class PlayerImpl implements Player, Serializable {
passedUntilEndOfTurn = false;
passedTurn = false;
passedAllTurns = true;
passedUntilStackResolved = false;
this.skip();
break;
case PASS_PRIORITY_UNTIL_TURN_END_STEP: // F5
@ -1715,6 +1722,7 @@ public abstract class PlayerImpl implements Player, Serializable {
passedTurn = false;
passedAllTurns = false;
passedUntilEndOfTurn = true;
passedUntilStackResolved = false;
skippedAtLeastOnce = !game.getTurn().getStepType().equals(PhaseStep.END_TURN);
this.skip();
break;
@ -1722,6 +1730,7 @@ public abstract class PlayerImpl implements Player, Serializable {
passedUntilNextMain = false;
passedAllTurns = false;
passedUntilEndOfTurn = false;
passedUntilStackResolved = false;
passedTurn = true;
this.skip();
break;
@ -1730,14 +1739,25 @@ public abstract class PlayerImpl implements Player, Serializable {
passedTurn = false;
passedUntilEndOfTurn = false;
passedUntilNextMain = true;
passedUntilStackResolved = false;
skippedAtLeastOnce = !(game.getTurn().getStepType().equals(PhaseStep.POSTCOMBAT_MAIN) || game.getTurn().getStepType().equals(PhaseStep.PRECOMBAT_MAIN));
this.skip();
break;
case PASS_PRIORITY_UNTIL_STACK_RESOLVED: //F8
passedAllTurns = false;
passedTurn = false;
passedUntilEndOfTurn = false;
passedUntilNextMain = false;
passedUntilStackResolved = true;
dateLastAddedToStack = game.getStack().getDateLastAdded();
this.skip();
break;
case PASS_PRIORITY_CANCEL_ALL_ACTIONS:
passedAllTurns = false;
passedTurn = false;
passedUntilEndOfTurn = false;
passedUntilNextMain = false;
passedUntilStackResolved = false;
}
logger.trace("PASS Priority: " + playerAction.toString());
}
@ -2684,4 +2704,9 @@ public abstract class PlayerImpl implements Player, Serializable {
return passedTurn;
}
@Override
public boolean getPassedUntilStackResolved() {
return passedUntilStackResolved;
}
}