This commit is contained in:
Jeff Wadsworth 2022-03-31 14:43:18 -05:00
parent 6ca93d1936
commit cf931cb0b1

View file

@ -1,4 +1,3 @@
package mage.cards.l; package mage.cards.l;
import java.util.ArrayList; import java.util.ArrayList;
@ -17,6 +16,7 @@ import mage.constants.Outcome;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
@ -28,12 +28,12 @@ import mage.target.TargetPlayer;
* @author North * @author North
*/ */
public final class LilianaOfTheVeil extends CardImpl { public final class LilianaOfTheVeil extends CardImpl {
public LilianaOfTheVeil(UUID ownerId, CardSetInfo setInfo) { public LilianaOfTheVeil(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{1}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{1}{B}{B}");
this.addSuperType(SuperType.LEGENDARY); this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.LILIANA); this.subtype.add(SubType.LILIANA);
this.setStartingLoyalty(3); this.setStartingLoyalty(3);
// +1: Each player discards a card. // +1: Each player discards a card.
@ -49,11 +49,11 @@ public final class LilianaOfTheVeil extends CardImpl {
ability.addTarget(new TargetPlayer()); ability.addTarget(new TargetPlayer());
this.addAbility(ability); this.addAbility(ability);
} }
private LilianaOfTheVeil(final LilianaOfTheVeil card) { private LilianaOfTheVeil(final LilianaOfTheVeil card) {
super(card); super(card);
} }
@Override @Override
public LilianaOfTheVeil copy() { public LilianaOfTheVeil copy() {
return new LilianaOfTheVeil(this); return new LilianaOfTheVeil(this);
@ -61,28 +61,30 @@ public final class LilianaOfTheVeil extends CardImpl {
} }
class LilianaOfTheVeilEffect extends OneShotEffect { class LilianaOfTheVeilEffect extends OneShotEffect {
public LilianaOfTheVeilEffect() { public LilianaOfTheVeilEffect() {
super(Outcome.Sacrifice); super(Outcome.Sacrifice);
this.staticText = "Separate all permanents target player controls into two piles. That player sacrifices all permanents in the pile of their choice"; this.staticText = "Separate all permanents target player controls into two piles. That player sacrifices all permanents in the pile of their choice";
} }
public LilianaOfTheVeilEffect(final LilianaOfTheVeilEffect effect) { public LilianaOfTheVeilEffect(final LilianaOfTheVeilEffect effect) {
super(effect); super(effect);
} }
@Override @Override
public LilianaOfTheVeilEffect copy() { public LilianaOfTheVeilEffect copy() {
return new LilianaOfTheVeilEffect(this); return new LilianaOfTheVeilEffect(this);
} }
@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());
Player targetPlayer = game.getPlayer(source.getFirstTarget()); Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (player != null && targetPlayer != null) { if (player != null && targetPlayer != null) {
int count = game.getBattlefield().countAll(new FilterPermanent(), targetPlayer.getId(), game); int count = game.getBattlefield().countAll(new FilterPermanent(), targetPlayer.getId(), game);
TargetPermanent target = new TargetPermanent(0, count, new FilterPermanent("permanents to put in the first pile"), true); FilterPermanent filter = new FilterPermanent("permanents to put in the first pile");
filter.add(new ControllerIdPredicate(targetPlayer.getId()));
TargetPermanent target = new TargetPermanent(0, count, filter, true);
List<Permanent> pile1 = new ArrayList<>(); List<Permanent> pile1 = new ArrayList<>();
target.setRequired(false); target.setRequired(false);
if (player.choose(Outcome.Neutral, target, source, game)) { if (player.choose(Outcome.Neutral, target, source, game)) {
@ -100,20 +102,20 @@ class LilianaOfTheVeilEffect extends OneShotEffect {
pile2.add(p); pile2.add(p);
} }
} }
boolean choice = targetPlayer.choosePile(Outcome.DestroyPermanent, "Choose a pile to sacrifice.", pile1, pile2, game); boolean choice = targetPlayer.choosePile(Outcome.DestroyPermanent, "Choose a pile to sacrifice.", pile1, pile2, game);
if (choice) { if (choice) {
sacrificePermanents(pile1, game, source); sacrificePermanents(pile1, game, source);
} else { } else {
sacrificePermanents(pile2, game, source); sacrificePermanents(pile2, game, source);
} }
return true; return true;
} }
return false; return false;
} }
private void sacrificePermanents(List<Permanent> pile, Game game, Ability source) { private void sacrificePermanents(List<Permanent> pile, Game game, Ability source) {
for (Permanent permanent : pile) { for (Permanent permanent : pile) {
if (permanent != null) { if (permanent != null) {