mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 12:31:59 -08:00
Merge pull request #2533 from magefree/issue-2492-emrakul-extra-turn
* Emrakul, the Promised End - Fix that extra turn is not giving when …
This commit is contained in:
commit
de28ea797e
4 changed files with 95 additions and 8 deletions
|
|
@ -53,6 +53,11 @@ public class TurnMod implements Serializable {
|
|||
private TurnPhase afterPhase;
|
||||
private PhaseStep afterStep;
|
||||
|
||||
// Turn mod that should be applied after current turn mod.
|
||||
// Implemented only for control player turn mod!
|
||||
// Added for Emrakul, the Promised End.
|
||||
private TurnMod subsequentTurnMod;
|
||||
|
||||
/**
|
||||
* Used to define if a player skips the next turn or gets an extra turn.
|
||||
*
|
||||
|
|
@ -142,6 +147,9 @@ public class TurnMod implements Serializable {
|
|||
this.skipStep = mod.skipStep;
|
||||
this.afterPhase = mod.afterPhase;
|
||||
this.afterStep = mod.afterStep;
|
||||
if (mod.subsequentTurnMod != null) {
|
||||
this.subsequentTurnMod = mod.subsequentTurnMod.copy();
|
||||
}
|
||||
}
|
||||
|
||||
public UUID getPlayerId() {
|
||||
|
|
@ -191,4 +199,12 @@ public class TurnMod implements Serializable {
|
|||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public TurnMod getSubsequentTurnMod() {
|
||||
return subsequentTurnMod;
|
||||
}
|
||||
|
||||
public void setSubsequentTurnMod(TurnMod subsequentTurnMod) {
|
||||
this.subsequentTurnMod = subsequentTurnMod;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,11 +86,11 @@ public class TurnMods extends ArrayList<TurnMod> {
|
|||
|
||||
public UUID controlsTurn(UUID playerId) {
|
||||
ListIterator<TurnMod> it = this.listIterator(this.size());
|
||||
UUID newControllerId = null;
|
||||
TurnMod controlPlayerTurnMod = null;
|
||||
while (it.hasPrevious()) {
|
||||
TurnMod turnMod = it.previous();
|
||||
if (turnMod.getNewControllerId() != null && turnMod.getPlayerId().equals(playerId)) {
|
||||
newControllerId = turnMod.getNewControllerId();
|
||||
controlPlayerTurnMod = turnMod;
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
|
@ -102,7 +102,11 @@ public class TurnMods extends ArrayList<TurnMod> {
|
|||
it.remove();
|
||||
}
|
||||
}
|
||||
return newControllerId;
|
||||
// apply subsequent turn mod
|
||||
if (controlPlayerTurnMod != null && controlPlayerTurnMod.getSubsequentTurnMod() != null) {
|
||||
this.add(controlPlayerTurnMod.getSubsequentTurnMod());
|
||||
}
|
||||
return controlPlayerTurnMod != null ? controlPlayerTurnMod.getNewControllerId() : null;
|
||||
}
|
||||
|
||||
public Step extraStep(UUID playerId, PhaseStep afterStep) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue