From a5e21b8c9eb9a44383bfa7081a3118605e7ed170 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 12 Mar 2022 11:21:01 -0500 Subject: [PATCH] [DGM] fixed Legion's Initiative not returning exiled creatures (fixes #8761) --- Mage.Sets/src/mage/cards/l/LegionsInitiative.java | 4 ++-- Mage/src/main/java/mage/util/CardUtil.java | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/cards/l/LegionsInitiative.java b/Mage.Sets/src/mage/cards/l/LegionsInitiative.java index 59f63017d1..f1080766ac 100644 --- a/Mage.Sets/src/mage/cards/l/LegionsInitiative.java +++ b/Mage.Sets/src/mage/cards/l/LegionsInitiative.java @@ -64,7 +64,7 @@ public final class LegionsInitiative extends CardImpl { ))); // {R}{W}, Exile Legion's Initiative: Exile all creatures you control. At the beginning of the next combat, return those cards to the battlefield under their owner's control and those creatures gain haste until end of turn. - Ability ability = new SimpleActivatedAbility(new LegionsInitiativeExileEffect(), new ManaCostsImpl("{R}{W}")); + Ability ability = new SimpleActivatedAbility(new LegionsInitiativeExileEffect(), new ManaCostsImpl<>("{R}{W}")); ability.addEffect(new CreateDelayedTriggeredAbilityEffect( new AtTheBeginOfCombatDelayedTriggeredAbility(new LegionsInitiativeReturnFromExileEffect()) )); @@ -136,7 +136,7 @@ class LegionsInitiativeReturnFromExileEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); - ExileZone exile = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source)); + ExileZone exile = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source, -1)); if (player == null || exile == null || exile.isEmpty()) { return false; } diff --git a/Mage/src/main/java/mage/util/CardUtil.java b/Mage/src/main/java/mage/util/CardUtil.java index f12bcab21e..9af3ac25ff 100644 --- a/Mage/src/main/java/mage/util/CardUtil.java +++ b/Mage/src/main/java/mage/util/CardUtil.java @@ -597,7 +597,11 @@ public final class CardUtil { } public static UUID getExileZoneId(Game game, Ability source) { - return getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + return getExileZoneId(game, source, 0); + } + + public static UUID getExileZoneId(Game game, Ability source, int offset) { + return getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter() + offset); } public static UUID getExileZoneId(Game game, UUID objectId, int zoneChangeCounter) {