* Fixed that commanders of players were not removed if a player left a game. Fixed a problem that continuous effects of objects of players that left the game were not removed immediately.

This commit is contained in:
LevelX2 2018-06-09 14:10:48 +02:00
parent 4ceffd17ef
commit 717308ba12
4 changed files with 135 additions and 8 deletions

View file

@ -1,4 +1,3 @@
package mage.game;
import java.io.IOException;
@ -2552,11 +2551,11 @@ public abstract class GameImpl implements Game, Serializable {
}
}
//Remove all emblems/plane the player controls
//Remove all commander/emblems/plane the player controls
boolean addPlaneAgain = false;
for (Iterator<CommandObject> it = this.getState().getCommand().iterator(); it.hasNext();) {
CommandObject obj = it.next();
if ((obj instanceof Emblem || obj instanceof Plane) && obj.getControllerId().equals(playerId)) {
if (obj.getControllerId().equals(playerId)) {
if (obj instanceof Emblem) {
((Emblem) obj).discardEffects();// This may not be the best fix but it works
}
@ -2590,6 +2589,8 @@ public abstract class GameImpl implements Game, Serializable {
it.remove();
}
}
// Make sure effects of no longer existing objects are removed
getContinuousEffects().removeInactiveEffects(this);
// If the current monarch leaves the game. When that happens, the player whose turn it is becomes the monarch.
// If the monarch leaves the game on their turn, the next player in turn order becomes the monarch.
if (playerId.equals(getMonarchId())) {