Fixed Living Death
package mage.cards.l;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
@@ -65,7 +66,9 @@ class LivingDeathEffect extends OneShotEffect {
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
Map<UUID, Set<Card>> exiledCards = new HashMap<>();
- // move creature cards from graveyard to exile
+
+ // Move creature cards from graveyard to exile
+
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
@@ -77,21 +80,28 @@ class LivingDeathEffect extends OneShotEffect {
}
}
game.applyEffects();
- // sacrifice all creatures
+
+ // Sacrifice all creatures
+
for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) {
permanent.sacrifice(source.getSourceId(), game);
}
game.applyEffects();
- // put exiled cards to battlefield
+
+ // Exiled cards are put onto the battlefield at the same time under their owner's control
+
+ Set<Card> cardsToReturnFromExile = new HashSet<>();
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
Set<Card> cardsPlayer = exiledCards.get(playerId);
- if (cardsPlayer != null && !cardsPlayer.isEmpty()) {
- player.moveCards(cardsPlayer, Zone.BATTLEFIELD, source, game, false, false, false, null);
+ if (cardsPlayer != null
+ && !cardsPlayer.isEmpty()) {
+ cardsToReturnFromExile.addAll(cardsPlayer);
}
}
}
+ controller.moveCards(cardsToReturnFromExile, Zone.BATTLEFIELD, source, game, false, false, true, null);
return true;
}
return false;
