diff --git a/Mage.Sets/src/mage/cards/a/AngelicAberration.java b/Mage.Sets/src/mage/cards/a/AngelicAberration.java new file mode 100644 index 00000000000..465c3af5888 --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AngelicAberration.java @@ -0,0 +1,112 @@ +package mage.cards.a; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.keyword.DevoidAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.ComparisonType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.PowerPredicate; +import mage.filter.predicate.mageobject.ToughnessPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.EldraziAngelToken; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetSacrifice; + +import java.util.UUID; + +/** + * @author PurpleCrowbar + */ +public final class AngelicAberration extends CardImpl { + + public AngelicAberration(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{W}"); + + this.subtype.add(SubType.ELDRAZI, SubType.ANGEL); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Devoid + this.addAbility(new DevoidAbility(this.color)); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Vigilance + this.addAbility(VigilanceAbility.getInstance()); + + // When Angelic Aberration enters the battlefield, sacrifice any number of creatures each with base power or toughness 1 or less. + // Create that many 4/4 colorless Eldrazi Angel creature tokens with flying and vigilance. + this.addAbility(new EntersBattlefieldTriggeredAbility(new AngelicAberrationEffect())); + } + + private AngelicAberration(final AngelicAberration card) { + super(card); + } + + @Override + public AngelicAberration copy() { + return new AngelicAberration(this); + } +} + +class AngelicAberrationEffect extends OneShotEffect { + + private static final FilterPermanent filter = new FilterControlledCreaturePermanent("creatures with base power or toughness 1 or less"); + + static { + filter.add(Predicates.or( + new PowerPredicate(ComparisonType.OR_LESS, 1), + new ToughnessPredicate(ComparisonType.OR_LESS, 1) + )); + } + + AngelicAberrationEffect() { + super(Outcome.Benefit); + staticText = "sacrifice any number of creatures each with base power or toughness 1 or less. " + + "Create that many 4/4 colorless Eldrazi Angel creature tokens with flying and vigilance"; + } + + private AngelicAberrationEffect(final AngelicAberrationEffect effect) { + super(effect); + } + + @Override + public AngelicAberrationEffect copy() { + return new AngelicAberrationEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Target target = new TargetSacrifice(0, Integer.MAX_VALUE, filter); + if (!player.choose(outcome, target, source, game)) { + return false; + } + int counter = 0; + for (UUID permanentId : target.getTargets()) { + Permanent permanent = game.getPermanent(permanentId); + if (permanent != null && permanent.sacrifice(source, game)) { + counter++; + } + } + return new CreateTokenEffect(new EldraziAngelToken(), counter).apply(game, source); + } +} diff --git a/Mage.Sets/src/mage/sets/ModernHorizons3Commander.java b/Mage.Sets/src/mage/sets/ModernHorizons3Commander.java index 7adef294c85..f73f65d4ea6 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons3Commander.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons3Commander.java @@ -32,6 +32,7 @@ public final class ModernHorizons3Commander extends ExpansionSet { cards.add(new SetCardInfo("All Is Dust", 152, Rarity.MYTHIC, mage.cards.a.AllIsDust.class)); cards.add(new SetCardInfo("Altar of the Goyf", 282, Rarity.UNCOMMON, mage.cards.a.AltarOfTheGoyf.class)); cards.add(new SetCardInfo("Ancient Stirrings", 219, Rarity.COMMON, mage.cards.a.AncientStirrings.class)); + cards.add(new SetCardInfo("Angelic Aberration", 39, Rarity.RARE, mage.cards.a.AngelicAberration.class)); cards.add(new SetCardInfo("Angel of Invention", 166, Rarity.MYTHIC, mage.cards.a.AngelOfInvention.class)); cards.add(new SetCardInfo("Anger", 208, Rarity.UNCOMMON, mage.cards.a.Anger.class)); cards.add(new SetCardInfo("Apex Devastator", 220, Rarity.MYTHIC, mage.cards.a.ApexDevastator.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/EldraziAngelToken.java b/Mage/src/main/java/mage/game/permanent/token/EldraziAngelToken.java new file mode 100644 index 00000000000..b788d9028f0 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/EldraziAngelToken.java @@ -0,0 +1,36 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * @author PurpleCrowbar + */ +public final class EldraziAngelToken extends TokenImpl { + + public EldraziAngelToken() { + super("Eldrazi Angel", "4/4 colorless Eldrazi Angel creature token with flying and vigilance"); + cardType.add(CardType.CREATURE); + subtype.add(SubType.ELDRAZI, SubType.ANGEL); + power = new MageInt(4); + toughness = new MageInt(4); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Vigilance + this.addAbility(VigilanceAbility.getInstance()); + } + + private EldraziAngelToken(final EldraziAngelToken token) { + super(token); + } + + @Override + public EldraziAngelToken copy() { + return new EldraziAngelToken(this); + } +}