mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
Merge pull request #4873 from spjspj/master
Remove plane from old player and add in new one
This commit is contained in:
commit
26bc78dc8c
1 changed files with 22 additions and 2 deletions
|
|
@ -2565,14 +2565,34 @@ 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();) {
|
for (Iterator<CommandObject> it = this.getState().getCommand().iterator(); it.hasNext();) {
|
||||||
CommandObject obj = it.next();
|
CommandObject obj = it.next();
|
||||||
if ((obj instanceof Emblem || obj instanceof Plane) && obj.getControllerId().equals(playerId)) {
|
if ((obj instanceof Emblem || obj instanceof Plane) && obj.getControllerId().equals(playerId)) {
|
||||||
((Emblem) obj).discardEffects();// This may not be the best fix but it works
|
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();
|
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();
|
Iterator<Entry<UUID, Card>> it = gameCards.entrySet().iterator();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue