* Grasp of Fate - Fixed rule text. Fixed that exiled permanents did not return to battlefeild if the Grasp left the battlefield because its owner lost or left the game.

This commit is contained in:
LevelX2 2018-04-24 17:50:35 +02:00
parent 6ebd715e17
commit 7b2ff38225
5 changed files with 78 additions and 6 deletions

View file

@ -2493,6 +2493,7 @@ public abstract class GameImpl implements Game, Serializable {
return;
}
//20100423 - 800.4a
Set<Card> toOutside = new HashSet<>();
for (Iterator<Permanent> it = getBattlefield().getAllPermanents().iterator(); it.hasNext();) {
Permanent perm = it.next();
if (perm.getOwnerId().equals(playerId)) {
@ -2511,7 +2512,8 @@ public abstract class GameImpl implements Game, Serializable {
if (perm.isCreature() && this.getCombat() != null) {
perm.removeFromCombat(this, true);
}
it.remove();
toOutside.add(perm);
// it.remove();
} else if (perm.getControllerId().equals(player.getId())) {
// and any effects which give that player control of any objects or players end
Effects:
@ -2531,6 +2533,18 @@ public abstract class GameImpl implements Game, Serializable {
}
}
}
// needed to send event that permanent leaves the battlefield to allow non stack effects to execute
player.moveCards(toOutside, Zone.OUTSIDE, null, this);
// triggered abilities that don't use the stack have to be executed
List<TriggeredAbility> abilities = state.getTriggered(player.getId());
for (Iterator<TriggeredAbility> it = abilities.iterator(); it.hasNext();) {
TriggeredAbility triggeredAbility = it.next();
if (!triggeredAbility.isUsesStack()) {
state.removeTriggeredAbility(triggeredAbility);
player.triggerAbility(triggeredAbility, this);
it.remove();
}
}
// Then, if that player controlled any objects on the stack not represented by cards, those objects cease to exist.
this.getState().getContinuousEffects().removeInactiveEffects(this);
getStack().removeIf(object -> object.getControllerId().equals(playerId));