From e2673cd13eef4dcc8e7c900f0363751b80201446 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 24 Jun 2019 08:26:22 -0400 Subject: [PATCH] Implemented Embodiment of Agonies --- .../src/mage/cards/e/EmbodimentOfAgonies.java | 89 +++++++++++++++++++ Mage.Sets/src/mage/sets/CoreSet2020.java | 1 + 2 files changed, 90 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/e/EmbodimentOfAgonies.java diff --git a/Mage.Sets/src/mage/cards/e/EmbodimentOfAgonies.java b/Mage.Sets/src/mage/cards/e/EmbodimentOfAgonies.java new file mode 100644 index 00000000000..7420ba45077 --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EmbodimentOfAgonies.java @@ -0,0 +1,89 @@ +package mage.cards.e; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.DeathtouchAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.game.Game; +import mage.players.Player; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class EmbodimentOfAgonies extends CardImpl { + + public EmbodimentOfAgonies(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{B}"); + + this.subtype.add(SubType.DEMON); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Deathtouch + this.addAbility(DeathtouchAbility.getInstance()); + + // Embodiment of Agonies enters the battlefield with a +1/+1 counter on it for each different mana cost among nonland cards in your graveyard. + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect( + CounterType.P1P1.createInstance(), EmbodimentOfAgoniesValue.instance, false + ), "with a +1/+1 counter on it for each different mana cost among nonland cards in your graveyard")); + } + + private EmbodimentOfAgonies(final EmbodimentOfAgonies card) { + super(card); + } + + @Override + public EmbodimentOfAgonies copy() { + return new EmbodimentOfAgonies(this); + } +} + +enum EmbodimentOfAgoniesValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Player player = game.getPlayer(sourceAbility.getControllerId()); + if (player == null) { + return 0; + } + Set stringSet = new HashSet(); + player.getGraveyard() + .getCards(game) + .stream() + .filter(card -> !card.isLand()) + .forEach(card -> card + .getManaCost() + .stream() + .forEach(manaCost -> stringSet.add(manaCost.getText())) + ); + stringSet.removeIf(s -> s == null || s.equals("")); + return stringSet.size(); + } + + @Override + public DynamicValue copy() { + return instance; + } + + @Override + public String getMessage() { + return ""; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/CoreSet2020.java b/Mage.Sets/src/mage/sets/CoreSet2020.java index 15f23d3e410..0a9684e663c 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2020.java +++ b/Mage.Sets/src/mage/sets/CoreSet2020.java @@ -92,6 +92,7 @@ public final class CoreSet2020 extends ExpansionSet { cards.add(new SetCardInfo("Dungeon Geists", 57, Rarity.RARE, mage.cards.d.DungeonGeists.class)); cards.add(new SetCardInfo("Elvish Reclaimer", 169, Rarity.RARE, mage.cards.e.ElvishReclaimer.class)); cards.add(new SetCardInfo("Ember Hauler", 137, Rarity.UNCOMMON, mage.cards.e.EmberHauler.class)); + cards.add(new SetCardInfo("Embodiment of Agonies", 98, Rarity.RARE, mage.cards.e.EmbodimentOfAgonies.class)); cards.add(new SetCardInfo("Empyrean Eagle", 208, Rarity.UNCOMMON, mage.cards.e.EmpyreanEagle.class)); cards.add(new SetCardInfo("Eternal Isolation", 15, Rarity.UNCOMMON, mage.cards.e.EternalIsolation.class)); cards.add(new SetCardInfo("Evolving Wilds", 246, Rarity.COMMON, mage.cards.e.EvolvingWilds.class));