Remove plane from old player and add in new one
@@ -2537,15 +2537,35 @@ public abstract class GameImpl implements Game, Serializable {
}
}
- //Remove all emblems the player controls
+ //Remove all 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 instanceof Emblem) {
((Emblem) obj).discardEffects();// This may not be the best fix but it works
+ }
+ if (obj instanceof Plane) {
+ ((Plane) obj).discardEffects();
+ // Readd a new one
+ addPlaneAgain = true;
+ }
it.remove();
}
}
+ if (addPlaneAgain) {
+ boolean addedAgain = false;
+ for (Player aplayer : state.getPlayers().values()) {
+ if (!aplayer.hasLeft() && !addedAgain) {
+ addedAgain = true;
+ Plane plane = Plane.getRandomPlane();
+ plane.setControllerId(aplayer.getId());
+ addPlane(plane, null, aplayer.getId());
+ }
+ }
+ }
+
Iterator<Entry<UUID, Card>> it = gameCards.entrySet().iterator();
while (it.hasNext()) {
