handle delayed triggers not using the stack

This commit is contained in:
Susucre 2024-05-18 19:23:50 +02:00
parent a2344ea781
commit a4eb963838

View file

@ -65,11 +65,16 @@ public abstract class DelayedTriggeredAbility extends TriggeredAbilityImpl {
} }
public boolean isInactive(Game game) { public boolean isInactive(Game game) {
// discard as soon as possible for leaved player // discard on stack
// 800.4d. If an object that would be owned by a player who has left the game would be created in any zone, it isn't created. // 800.4d. If an object that would be owned by a player who has left the game would be created in any zone, it isn't created.
// If a triggered ability that would be controlled by a player who has left the game would be put onto the stack, it isn't put on the stack. // If a triggered ability that would be controlled by a player who has left the game would be put onto the stack, it isn't put on the stack.
Player player = game.getPlayer(getControllerId()); Player player = game.getPlayer(getControllerId());
boolean canDelete = player == null || !player.isInGame(); if (player != null && player.isInGame()) {
return canDelete; return false;
}
// If using the stack, discard as soon as possible for leaved player
// If not using the stack (for instance return of "exile target player until {this} leaves the battlefield"),
// we wait till the player would have played a next turn to make sure they are debounced after the player leaves.
return usesStack || player.hasReachedNextTurnAfterLeaving();
} }
} }