mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
fix 514.3a, give player priority on cleanup when something happened (#12115)
This commit is contained in:
parent
f1791a3c70
commit
72a2e32d1c
4 changed files with 106 additions and 7 deletions
|
|
@ -28,8 +28,9 @@ public class EndPhase extends Phase {
|
|||
@Override
|
||||
protected void playStep(Game game) {
|
||||
if (currentStep.getType() == PhaseStep.CLEANUP) {
|
||||
game.getState().increaseStepNum();
|
||||
game.getTurn().setEndTurnRequested(false); // so triggers trigger again
|
||||
currentStep.beginStep(game, activePlayerId);
|
||||
prePriority(game, activePlayerId);
|
||||
// 514.3a At this point, the game checks to see if any state-based actions would be performed
|
||||
// and/or any triggered abilities are waiting to be put onto the stack (including those that
|
||||
// trigger "at the beginning of the next cleanup step"). If so, those state-based actions are
|
||||
|
|
@ -37,10 +38,19 @@ public class EndPhase extends Phase {
|
|||
// priority. Players may cast spells and activate abilities. Once the stack is empty and all players
|
||||
// pass in succession, another cleanup step begins
|
||||
if (game.checkStateAndTriggered()) {
|
||||
game.playPriority(activePlayerId, true);
|
||||
playStep(game);
|
||||
// Queues a new cleanup step
|
||||
game.getState().getTurnMods().add(new TurnMod(activePlayerId).withExtraStep(new CleanupStep()));
|
||||
// resume priority
|
||||
if (!game.isPaused() && !game.checkIfGameIsOver() && !game.executingRollback()) {
|
||||
currentStep.priority(game, activePlayerId, false);
|
||||
if (game.executingRollback()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!game.isPaused() && !game.checkIfGameIsOver() && !game.executingRollback()) {
|
||||
postPriority(game, activePlayerId);
|
||||
}
|
||||
currentStep.endStep(game, activePlayerId);
|
||||
} else {
|
||||
super.playStep(game);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -275,4 +275,7 @@ public abstract class Phase implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return type.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
|
||||
package mage.game.turn;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.util.Copyable;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Game's step
|
||||
* <p>
|
||||
|
|
@ -85,4 +85,7 @@ public abstract class Step implements Serializable, Copyable<Step> {
|
|||
return stepPart;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return type.getStepText();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue