mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Added F10 to skip priority while the stack resolves.
This commit is contained in:
parent
a2484cc6d9
commit
5b78dbe5c2
5 changed files with 47 additions and 7 deletions
|
@ -210,7 +210,9 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sbMana = new StringBuilder();
|
StringBuilder sbMana = new StringBuilder();
|
||||||
|
if (colorless > 0) {
|
||||||
|
sbMana.append("{").append(Integer.toString(colorless)).append("}");
|
||||||
|
}
|
||||||
for (int i = 0; i < red; i++) {
|
for (int i = 0; i < red; i++) {
|
||||||
sbMana.append("{R}");
|
sbMana.append("{R}");
|
||||||
}
|
}
|
||||||
|
@ -220,18 +222,15 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
|
||||||
for (int i = 0; i < blue; i++) {
|
for (int i = 0; i < blue; i++) {
|
||||||
sbMana.append("{U}");
|
sbMana.append("{U}");
|
||||||
}
|
}
|
||||||
for (int i = 0; i < black; i++) {
|
|
||||||
sbMana.append("{B}");
|
|
||||||
}
|
|
||||||
for (int i = 0; i < white; i++) {
|
for (int i = 0; i < white; i++) {
|
||||||
sbMana.append("{W}");
|
sbMana.append("{W}");
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < black; i++) {
|
||||||
|
sbMana.append("{B}");
|
||||||
|
}
|
||||||
for (int i = 0; i < any; i++) {
|
for (int i = 0; i < any; i++) {
|
||||||
sbMana.append("{Any}");
|
sbMana.append("{Any}");
|
||||||
}
|
}
|
||||||
if (colorless > 0) {
|
|
||||||
sbMana.append("{").append(Integer.toString(colorless)).append("}");
|
|
||||||
}
|
|
||||||
return sbMana.toString();
|
return sbMana.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ public enum PlayerAction {
|
||||||
PASS_PRIORITY_UNTIL_TURN_END_STEP,
|
PASS_PRIORITY_UNTIL_TURN_END_STEP,
|
||||||
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_CANCEL_ALL_ACTIONS,
|
PASS_PRIORITY_CANCEL_ALL_ACTIONS,
|
||||||
UNDO,
|
UNDO,
|
||||||
CONCEDE,
|
CONCEDE,
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
package mage.game.stack;
|
package mage.game.stack;
|
||||||
|
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
@ -41,6 +42,8 @@ import mage.game.events.GameEvent;
|
||||||
*/
|
*/
|
||||||
public class SpellStack extends ArrayDeque<StackObject> {
|
public class SpellStack extends ArrayDeque<StackObject> {
|
||||||
|
|
||||||
|
protected Date dateLastAdded;
|
||||||
|
|
||||||
public SpellStack () {}
|
public SpellStack () {}
|
||||||
|
|
||||||
public SpellStack(final SpellStack stack) {
|
public SpellStack(final SpellStack stack) {
|
||||||
|
@ -123,4 +126,15 @@ public class SpellStack extends ArrayDeque<StackObject> {
|
||||||
public SpellStack copy() {
|
public SpellStack copy() {
|
||||||
return new SpellStack(this);
|
return new SpellStack(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void push(StackObject e) {
|
||||||
|
super.push(e);
|
||||||
|
this.dateLastAdded = new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDateLastAdded() {
|
||||||
|
return dateLastAdded;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,6 +127,7 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
boolean getPassedTurn();
|
boolean getPassedTurn();
|
||||||
boolean getPassedUntilEndOfTurn();
|
boolean getPassedUntilEndOfTurn();
|
||||||
boolean getPassedUntilNextMain();
|
boolean getPassedUntilNextMain();
|
||||||
|
boolean getPassedUntilStackResolved();
|
||||||
boolean getPassedAllTurns();
|
boolean getPassedAllTurns();
|
||||||
|
|
||||||
boolean hasLost();
|
boolean hasLost();
|
||||||
|
|
|
@ -30,6 +30,7 @@ package mage.players;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -159,6 +160,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
protected boolean passedTurn; // F4
|
protected boolean passedTurn; // F4
|
||||||
protected boolean passedUntilEndOfTurn; // F5
|
protected boolean passedUntilEndOfTurn; // F5
|
||||||
protected boolean passedUntilNextMain; // F6
|
protected boolean passedUntilNextMain; // F6
|
||||||
|
protected boolean passedUntilStackResolved; // 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
|
||||||
/**
|
/**
|
||||||
* This indicates that player passed all turns until his own turn starts (F9).
|
* 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.passedUntilEndOfTurn = player.passedUntilEndOfTurn;
|
||||||
this.passedUntilNextMain = player.passedUntilNextMain;
|
this.passedUntilNextMain = player.passedUntilNextMain;
|
||||||
this.skippedAtLeastOnce = player.skippedAtLeastOnce;
|
this.skippedAtLeastOnce = player.skippedAtLeastOnce;
|
||||||
|
this.passedUntilStackResolved = player.passedUntilStackResolved;
|
||||||
|
this.dateLastAddedToStack = player.dateLastAddedToStack;
|
||||||
this.passedAllTurns = player.passedAllTurns;
|
this.passedAllTurns = player.passedAllTurns;
|
||||||
|
|
||||||
this.priorityTimeLeft = player.getPriorityTimeLeft();
|
this.priorityTimeLeft = player.getPriorityTimeLeft();
|
||||||
|
@ -404,6 +409,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
this.passedUntilEndOfTurn = false;
|
this.passedUntilEndOfTurn = false;
|
||||||
this.passedUntilNextMain = false;
|
this.passedUntilNextMain = false;
|
||||||
this.skippedAtLeastOnce = false;
|
this.skippedAtLeastOnce = false;
|
||||||
|
this.passedUntilStackResolved = false;
|
||||||
this.passedAllTurns = false;
|
this.passedAllTurns = false;
|
||||||
this.canGainLife = true;
|
this.canGainLife = true;
|
||||||
this.canLoseLife = true;
|
this.canLoseLife = true;
|
||||||
|
@ -1708,6 +1714,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
passedUntilEndOfTurn = false;
|
passedUntilEndOfTurn = false;
|
||||||
passedTurn = false;
|
passedTurn = false;
|
||||||
passedAllTurns = true;
|
passedAllTurns = true;
|
||||||
|
passedUntilStackResolved = false;
|
||||||
this.skip();
|
this.skip();
|
||||||
break;
|
break;
|
||||||
case PASS_PRIORITY_UNTIL_TURN_END_STEP: // F5
|
case PASS_PRIORITY_UNTIL_TURN_END_STEP: // F5
|
||||||
|
@ -1715,6 +1722,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
passedTurn = false;
|
passedTurn = false;
|
||||||
passedAllTurns = false;
|
passedAllTurns = false;
|
||||||
passedUntilEndOfTurn = true;
|
passedUntilEndOfTurn = true;
|
||||||
|
passedUntilStackResolved = false;
|
||||||
skippedAtLeastOnce = !game.getTurn().getStepType().equals(PhaseStep.END_TURN);
|
skippedAtLeastOnce = !game.getTurn().getStepType().equals(PhaseStep.END_TURN);
|
||||||
this.skip();
|
this.skip();
|
||||||
break;
|
break;
|
||||||
|
@ -1722,6 +1730,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
passedUntilNextMain = false;
|
passedUntilNextMain = false;
|
||||||
passedAllTurns = false;
|
passedAllTurns = false;
|
||||||
passedUntilEndOfTurn = false;
|
passedUntilEndOfTurn = false;
|
||||||
|
passedUntilStackResolved = false;
|
||||||
passedTurn = true;
|
passedTurn = true;
|
||||||
this.skip();
|
this.skip();
|
||||||
break;
|
break;
|
||||||
|
@ -1730,14 +1739,25 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
passedTurn = false;
|
passedTurn = false;
|
||||||
passedUntilEndOfTurn = false;
|
passedUntilEndOfTurn = false;
|
||||||
passedUntilNextMain = true;
|
passedUntilNextMain = true;
|
||||||
|
passedUntilStackResolved = 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;
|
||||||
|
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:
|
case PASS_PRIORITY_CANCEL_ALL_ACTIONS:
|
||||||
passedAllTurns = false;
|
passedAllTurns = false;
|
||||||
passedTurn = false;
|
passedTurn = false;
|
||||||
passedUntilEndOfTurn = false;
|
passedUntilEndOfTurn = false;
|
||||||
passedUntilNextMain = false;
|
passedUntilNextMain = false;
|
||||||
|
passedUntilStackResolved = false;
|
||||||
}
|
}
|
||||||
logger.trace("PASS Priority: " + playerAction.toString());
|
logger.trace("PASS Priority: " + playerAction.toString());
|
||||||
}
|
}
|
||||||
|
@ -2684,4 +2704,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
return passedTurn;
|
return passedTurn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getPassedUntilStackResolved() {
|
||||||
|
return passedUntilStackResolved;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue