From 0e4126b23738e88f395baaf5f2f6c01b6a90438b Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 14 Apr 2022 22:55:36 -0400 Subject: [PATCH] [SNC] Implemented Soul of Emancipation --- .../src/mage/cards/s/SoulOfEmancipation.java | 105 ++++++++++++++++++ .../src/mage/sets/StreetsOfNewCapenna.java | 1 + 2 files changed, 106 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/SoulOfEmancipation.java diff --git a/Mage.Sets/src/mage/cards/s/SoulOfEmancipation.java b/Mage.Sets/src/mage/cards/s/SoulOfEmancipation.java new file mode 100644 index 0000000000..3eb4a782d0 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SoulOfEmancipation.java @@ -0,0 +1,105 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.MageItem; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterNonlandPermanent; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.Angel33Token; +import mage.target.TargetPermanent; + +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * @author TheElk801 + */ +public final class SoulOfEmancipation extends CardImpl { + + private static final FilterPermanent filter = new FilterNonlandPermanent("other nonland permanents"); + + static { + filter.add(AnotherPredicate.instance); + } + + public SoulOfEmancipation(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{W}{U}"); + + this.subtype.add(SubType.AVATAR); + this.power = new MageInt(5); + this.toughness = new MageInt(7); + + // When Soul of Emancipation enters the battlefield, destroy up to three other target nonland permanents. For each of those permanents, its controller creates a 3/3 white Angel creature token with flying. + Ability ability = new EntersBattlefieldTriggeredAbility(new SoulOfEmancipationEffect()); + ability.addTarget(new TargetPermanent(0, 3, filter)); + this.addAbility(ability); + } + + private SoulOfEmancipation(final SoulOfEmancipation card) { + super(card); + } + + @Override + public SoulOfEmancipation copy() { + return new SoulOfEmancipation(this); + } +} + +class SoulOfEmancipationEffect extends OneShotEffect { + + SoulOfEmancipationEffect() { + super(Outcome.Benefit); + staticText = "destroy up to three other target nonland permanents. For each of those permanents, " + + "its controller creates a 3/3 white Angel creature token with flying"; + } + + private SoulOfEmancipationEffect(final SoulOfEmancipationEffect effect) { + super(effect); + } + + @Override + public SoulOfEmancipationEffect copy() { + return new SoulOfEmancipationEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + List permanents = this + .getTargetPointer() + .getTargets(game, source) + .stream() + .map(game::getPermanent) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + if (permanents.isEmpty()) { + return false; + } + Map playerMap = permanents + .stream() + .collect(Collectors.toMap( + MageItem::getId, + x -> 1, + Integer::sum + )); + for (Permanent permanent : permanents) { + permanent.destroy(source, game); + } + for (Map.Entry entry : playerMap.entrySet()) { + new Angel33Token().putOntoBattlefield(entry.getValue(), game, source, entry.getKey()); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java index ba2b960eec..66ec1a41ac 100644 --- a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java +++ b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java @@ -162,6 +162,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet { cards.add(new SetCardInfo("Slip Out the Back", 62, Rarity.UNCOMMON, mage.cards.s.SlipOutTheBack.class)); cards.add(new SetCardInfo("Snooping Newsie", 222, Rarity.COMMON, mage.cards.s.SnoopingNewsie.class)); cards.add(new SetCardInfo("Social Climber", 157, Rarity.COMMON, mage.cards.s.SocialClimber.class)); + cards.add(new SetCardInfo("Soul of Emancipation", 223, Rarity.RARE, mage.cards.s.SoulOfEmancipation.class)); cards.add(new SetCardInfo("Spara's Headquarters", 257, Rarity.RARE, mage.cards.s.SparasHeadquarters.class)); cards.add(new SetCardInfo("Stimulus Package", 225, Rarity.UNCOMMON, mage.cards.s.StimulusPackage.class)); cards.add(new SetCardInfo("Strangle", 125, Rarity.COMMON, mage.cards.s.Strangle.class));