mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Removed redundant Living End effect. Fixes #6385
This commit is contained in:
parent
7ad7d5f03d
commit
ddf007e6f1
3 changed files with 80 additions and 143 deletions
|
@ -1,23 +1,11 @@
|
|||
package mage.cards.l;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
|
||||
import mage.abilities.effects.common.LivingDeathEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -41,64 +29,3 @@ public final class LivingDeath extends CardImpl {
|
|||
return new LivingDeath(this);
|
||||
}
|
||||
}
|
||||
|
||||
class LivingDeathEffect extends OneShotEffect {
|
||||
|
||||
public LivingDeathEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "Each player exiles all creature cards from their graveyard, then sacrifices all creatures they control, then puts all cards they exiled this way onto the battlefield";
|
||||
}
|
||||
|
||||
public LivingDeathEffect(final LivingDeathEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LivingDeathEffect copy() {
|
||||
return new LivingDeathEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
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
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
Set<Card> cardsPlayer = player.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game);
|
||||
if (!cardsPlayer.isEmpty()) {
|
||||
exiledCards.put(player.getId(), cardsPlayer);
|
||||
player.moveCards(cardsPlayer, Zone.EXILED, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
game.getState().processAction(game);
|
||||
|
||||
// Sacrifice all creatures
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) {
|
||||
permanent.sacrifice(source.getSourceId(), game);
|
||||
}
|
||||
game.getState().processAction(game);
|
||||
|
||||
// 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()) {
|
||||
cardsToReturnFromExile.addAll(cardsPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
controller.moveCards(cardsToReturnFromExile, Zone.BATTLEFIELD, source, game, false, false, true, null);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,12 @@
|
|||
package mage.cards.l;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.LivingDeathEffect;
|
||||
import mage.abilities.keyword.SuspendAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -35,8 +23,7 @@ public final class LivingEnd extends CardImpl {
|
|||
this.addAbility(new SuspendAbility(3, new ManaCostsImpl("{2}{B}{B}"), this));
|
||||
// Each player exiles all creature cards from their graveyard, then sacrifices all creatures
|
||||
// they control, then puts all cards they exiled this way onto the battlefield.
|
||||
this.getSpellAbility().addEffect(new LivingEndEffect());
|
||||
|
||||
this.getSpellAbility().addEffect(new LivingDeathEffect());
|
||||
}
|
||||
|
||||
public LivingEnd(final LivingEnd card) {
|
||||
|
@ -48,56 +35,3 @@ public final class LivingEnd extends CardImpl {
|
|||
return new LivingEnd(this);
|
||||
}
|
||||
}
|
||||
|
||||
class LivingEndEffect extends OneShotEffect {
|
||||
|
||||
public LivingEndEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "Each player exiles all creature cards from their graveyard, then sacrifices all creatures they control, then puts all cards they exiled this way onto the battlefield";
|
||||
}
|
||||
|
||||
public LivingEndEffect(final LivingEndEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LivingEndEffect copy() {
|
||||
return new LivingEndEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
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
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
Set<Card> cardsPlayer = player.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game);
|
||||
if (!cardsPlayer.isEmpty()) {
|
||||
exiledCards.put(player.getId(), cardsPlayer);
|
||||
player.moveCards(cardsPlayer, Zone.EXILED, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
// sacrifice all creatures
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) {
|
||||
permanent.sacrifice(source.getSourceId(), game);
|
||||
}
|
||||
// put exiled cards to battlefield
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class LivingDeathEffect extends OneShotEffect {
|
||||
|
||||
public LivingDeathEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "Each player exiles all creature cards from their graveyard, then sacrifices all creatures they control, then puts all cards they exiled this way onto the battlefield";
|
||||
}
|
||||
|
||||
public LivingDeathEffect(final LivingDeathEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LivingDeathEffect copy() {
|
||||
return new LivingDeathEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
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
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
Set<Card> cardsPlayer = player.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game);
|
||||
if (!cardsPlayer.isEmpty()) {
|
||||
exiledCards.put(player.getId(), cardsPlayer);
|
||||
player.moveCards(cardsPlayer, Zone.EXILED, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
game.getState().processAction(game);
|
||||
|
||||
// Sacrifice all creatures
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) {
|
||||
permanent.sacrifice(source.getSourceId(), game);
|
||||
}
|
||||
|
||||
game.getState().processAction(game);
|
||||
|
||||
// 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()) {
|
||||
cardsToReturnFromExile.addAll(cardsPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
controller.moveCards(cardsToReturnFromExile, Zone.BATTLEFIELD, source, game, false, false, true, null);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue