mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
* 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:
parent
6ebd715e17
commit
7b2ff38225
5 changed files with 78 additions and 6 deletions
|
|
@ -49,6 +49,12 @@ import mage.util.CardUtil;
|
|||
*
|
||||
* Uses no stack
|
||||
*
|
||||
* 11/4/2015: In a multiplayer game, if Grasp of Fate's owner leaves the game,
|
||||
* the exiled cards will return to the battlefield. Because the one-shot effect
|
||||
* that returns the cards isn't an ability that goes on the stack, it won't
|
||||
* cease to exist along with the leaving player's spells and abilities on the
|
||||
* stack.
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class OnLeaveReturnExiledToBattlefieldAbility extends DelayedTriggeredAbility {
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -3461,6 +3461,16 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case OUTSIDE:
|
||||
for (Card card : cards) {
|
||||
if (card instanceof Permanent) {
|
||||
game.getBattlefield().removePermanent(((Permanent) card).getId());
|
||||
ZoneChangeEvent event = new ZoneChangeEvent(card.getId(), (source == null ? null : source.getSourceId()),
|
||||
byOwner ? card.getOwnerId() : getId(), Zone.BATTLEFIELD, Zone.OUTSIDE, appliedEffects);
|
||||
game.fireEvent(event);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedOperationException("to Zone" + toZone.toString() + " not supported yet");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue