* Fixed a problem of EndTurnEffect not beeing able to remove stackAbilities and endless looping as a result (fixes #3221).

This commit is contained in:
LevelX2 2017-04-25 21:30:45 +02:00
parent 24b99216f8
commit 80beebccf5
2 changed files with 42 additions and 5 deletions

View file

@ -278,10 +278,12 @@ public class Turn implements Serializable {
// 1) All spells and abilities on the stack are exiled. This includes (e.g.) Time Stop, though it will continue to resolve.
// It also includes spells and abilities that can't be countered.
while (!game.getStack().isEmpty()) {
while (!game.hasEnded() && !game.getStack().isEmpty()) {
StackObject stackObject = game.getStack().peekFirst();
if (stackObject instanceof Spell) {
((Spell) stackObject).moveToExile(null, "", source.getSourceId(), game);
} else {
game.getStack().remove(stackObject); // stack ability
}
}
// 2) All attacking and blocking creatures are removed from combat.