[DGM] fixed Legion's Initiative not returning exiled creatures (fixes #8761)

This commit is contained in:
Evan Kranzler 2022-03-12 11:21:01 -05:00
parent 7f4e691685
commit a5e21b8c9e
2 changed files with 7 additions and 3 deletions

View file

@ -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. // {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( ability.addEffect(new CreateDelayedTriggeredAbilityEffect(
new AtTheBeginOfCombatDelayedTriggeredAbility(new LegionsInitiativeReturnFromExileEffect()) new AtTheBeginOfCombatDelayedTriggeredAbility(new LegionsInitiativeReturnFromExileEffect())
)); ));
@ -136,7 +136,7 @@ class LegionsInitiativeReturnFromExileEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); 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()) { if (player == null || exile == null || exile.isEmpty()) {
return false; return false;
} }

View file

@ -597,7 +597,11 @@ public final class CardUtil {
} }
public static UUID getExileZoneId(Game game, Ability source) { 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) { public static UUID getExileZoneId(Game game, UUID objectId, int zoneChangeCounter) {