diff --git a/Mage.Sets/src/mage/cards/b/BattleAtTheHelvault.java b/Mage.Sets/src/mage/cards/b/BattleAtTheHelvault.java new file mode 100644 index 00000000000..8cf9d484ecd --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BattleAtTheHelvault.java @@ -0,0 +1,90 @@ +package mage.cards.b; + +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.SagaAbility; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.ExileUntilSourceLeavesEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SagaChapter; +import mage.constants.SubType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterNonlandPermanent; +import mage.filter.predicate.Predicate; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.permanent.ControllerIdPredicate; +import mage.game.Game; +import mage.game.permanent.token.AvacynToken; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.target.targetadjustment.TargetAdjuster; +import mage.target.targetpointer.EachTargetPointer; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class BattleAtTheHelvault extends CardImpl { + + public BattleAtTheHelvault(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{W}{W}"); + + this.subtype.add(SubType.SAGA); + + // (As this Saga enters and after your draw step, add a lore counter.) + SagaAbility sagaAbility = new SagaAbility(this); + + // I, II -- For each player, exile up to one target non-Saga, nonland permanent that player controls until Battle at the Helvault leaves the battlefield. + sagaAbility.addChapterEffect( + this, SagaChapter.CHAPTER_I, SagaChapter.CHAPTER_II, + (ability) -> { + ability.addEffect(new ExileUntilSourceLeavesEffect() + .setText("for each player, exile up to one target non-Saga, " + + "nonland permanent that player controls until {this} leaves the battlefield") + .setTargetPointer(new EachTargetPointer())); + ability.setTargetAdjuster(BattleAtTheHelvaultAdjuster.instance); + }); + + // III -- Create Avacyn, a legendary 8/8 white Angel creature token with flying, vigilance, and indestructible. + sagaAbility.addChapterEffect( + this, SagaChapter.CHAPTER_III, + new CreateTokenEffect(new AvacynToken()) + ); + this.addAbility(sagaAbility); + } + + private BattleAtTheHelvault(final BattleAtTheHelvault card) { + super(card); + } + + @Override + public BattleAtTheHelvault copy() { + return new BattleAtTheHelvault(this); + } +} + +enum BattleAtTheHelvaultAdjuster implements TargetAdjuster { + instance; + private static final Predicate predicate = Predicates.not(SubType.SAGA.getPredicate()); + + @Override + public void adjustTargets(Ability ability, Game game) { + ability.getTargets().clear(); + for (UUID playerId : game.getState().getPlayersInRange(ability.getControllerId(), game)) { + Player player = game.getPlayer(playerId); + if (player == null) { + continue; + } + FilterPermanent filter = new FilterNonlandPermanent( + "non-Saga, nonland permanent " + + (ability.isControlledBy(playerId) ? "you control" : "controlled by " + player.getName()) + ); + filter.add(predicate); + filter.add(new ControllerIdPredicate(playerId)); + ability.addTarget(new TargetPermanent(0, 1, filter)); + } + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/CommanderMasters.java b/Mage.Sets/src/mage/sets/CommanderMasters.java index eeb0e01b9f7..f82033d3849 100644 --- a/Mage.Sets/src/mage/sets/CommanderMasters.java +++ b/Mage.Sets/src/mage/sets/CommanderMasters.java @@ -64,6 +64,7 @@ public final class CommanderMasters extends ExpansionSet { cards.add(new SetCardInfo("Bane of Bala Ged", 802, Rarity.UNCOMMON, mage.cards.b.BaneOfBalaGed.class)); cards.add(new SetCardInfo("Bastion of Remembrance", 138, Rarity.UNCOMMON, mage.cards.b.BastionOfRemembrance.class)); cards.add(new SetCardInfo("Battle Screech", 17, Rarity.COMMON, mage.cards.b.BattleScreech.class)); + cards.add(new SetCardInfo("Battle at the Helvault", 719, Rarity.RARE, mage.cards.b.BattleAtTheHelvault.class)); cards.add(new SetCardInfo("Battle for Bretagard", 916, Rarity.RARE, mage.cards.b.BattleForBretagard.class)); cards.add(new SetCardInfo("Beanstalk Giant", 275, Rarity.UNCOMMON, mage.cards.b.BeanstalkGiant.class)); cards.add(new SetCardInfo("Binding the Old Gods", 917, Rarity.UNCOMMON, mage.cards.b.BindingTheOldGods.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/AvacynToken.java b/Mage/src/main/java/mage/game/permanent/token/AvacynToken.java new file mode 100644 index 00000000000..f31bae598a5 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/AvacynToken.java @@ -0,0 +1,37 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.IndestructibleAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; + +/** + * @author TheElk801 + */ +public final class AvacynToken extends TokenImpl { + + public AvacynToken() { + super("Avacyn", "Avacyn, a legendary 8/8 white Angel creature token with flying, vigilance, and indestructible"); + supertype.add(SuperType.LEGENDARY); + cardType.add(CardType.CREATURE); + color.setWhite(true); + subtype.add(SubType.ANGEL); + power = new MageInt(8); + toughness = new MageInt(8); + + this.addAbility(FlyingAbility.getInstance()); + this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(VigilanceAbility.getInstance()); + } + + public AvacynToken(final AvacynToken token) { + super(token); + } + + public AvacynToken copy() { + return new AvacynToken(this); + } +}