forked from External/mage
fix Obeka, Splitter of Seconds (#12085)
Now adding BeginningPhases with all but Upkeep skipped. Previously upkeep steps were added during combat phase, which was incorrect. fix #12085
This commit is contained in:
parent
add0fa4f58
commit
8a29dcc735
5 changed files with 46 additions and 7 deletions
|
|
@ -12,6 +12,7 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -258,4 +259,20 @@ public abstract class Phase implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* One card [[Okea, Splitter of Seconds]], adds extra beginning phases with
|
||||
* all but upkeep steps skipped.
|
||||
* To achieve that, this function is called right after creating the extra Phase,
|
||||
* before running it.
|
||||
*/
|
||||
public void keepOnlyStep(PhaseStep step) {
|
||||
if (count != 0) {
|
||||
throw new IllegalStateException("Wrong code usage: illegal Phase modification once it started running");
|
||||
}
|
||||
this.steps = this.steps.stream().filter(s -> s.getType().equals(step)).collect(Collectors.toList());
|
||||
if (this.steps.isEmpty()) {
|
||||
throw new IllegalStateException("Wrong code usage: keepOnlyStep should not remove all the steps in a phase - " + step);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue