forked from External/mage
updated various cards to improve how they handle exiling with info (#7615)
This commit is contained in:
parent
bb0a995541
commit
bd3777997e
34 changed files with 349 additions and 442 deletions
|
|
@ -1,44 +1,40 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.constants.Outcome;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ExileAllEffect extends OneShotEffect {
|
||||
|
||||
private FilterPermanent filter;
|
||||
private String exileZone = null;
|
||||
private UUID exileId = null;
|
||||
private final FilterPermanent filter;
|
||||
private final boolean forSource;
|
||||
|
||||
public ExileAllEffect(FilterPermanent filter) {
|
||||
this(filter, null, null);
|
||||
this(filter, false);
|
||||
}
|
||||
|
||||
public ExileAllEffect(FilterPermanent filter, UUID exileId, String exileZone) {
|
||||
public ExileAllEffect(FilterPermanent filter, boolean forSource) {
|
||||
super(Outcome.Exile);
|
||||
this.filter = filter;
|
||||
this.exileZone = exileZone;
|
||||
this.exileId = exileId;
|
||||
this.forSource = forSource;
|
||||
setText();
|
||||
}
|
||||
|
||||
public ExileAllEffect(final ExileAllEffect effect) {
|
||||
super(effect);
|
||||
this.filter = effect.filter.copy();
|
||||
this.exileZone = effect.exileZone;
|
||||
this.exileId = effect.exileId;
|
||||
this.forSource = effect.forSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -49,14 +45,18 @@ public class ExileAllEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game);
|
||||
for (Permanent permanent : permanents) {
|
||||
controller.moveCardToExileWithInfo(permanent, exileId, exileZone, source, game, Zone.BATTLEFIELD, true);
|
||||
}
|
||||
return true;
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (controller == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
Cards cards = new CardsImpl();
|
||||
game.getBattlefield().getActivePermanents(
|
||||
filter, source.getControllerId(), source.getSourceId(), game
|
||||
).stream().forEach(cards::add);
|
||||
if (forSource) {
|
||||
return controller.moveCardsToExile(cards.getCards(game), source, game, true, CardUtil.getExileZoneId(game, source), sourceObject.getName());
|
||||
}
|
||||
return controller.moveCards(cards, Zone.EXILED, source, game);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue