From aef01f034eb960d2c11ffadeb9f8fc91b96f20ff Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 2 Jun 2022 08:11:40 -0400 Subject: [PATCH] [CLB] Implemented Ambitious Dragonborn --- .../src/mage/cards/a/AmbitiousDragonborn.java | 88 +++++++++++++++++++ .../CommanderLegendsBattleForBaldursGate.java | 1 + 2 files changed, 89 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/AmbitiousDragonborn.java diff --git a/Mage.Sets/src/mage/cards/a/AmbitiousDragonborn.java b/Mage.Sets/src/mage/cards/a/AmbitiousDragonborn.java new file mode 100644 index 00000000000..a306041ae54 --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AmbitiousDragonborn.java @@ -0,0 +1,88 @@ +package mage.cards.a; + +import mage.MageInt; +import mage.MageObject; +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.hint.Hint; +import mage.abilities.hint.ValueHint; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; +import java.util.stream.Stream; + +/** + * @author TheElk801 + */ +public final class AmbitiousDragonborn extends CardImpl { + + private static final Hint hint = new ValueHint( + "Greatest power among creatures you control and in your graveyard", AmbitiousDragonbornValue.instance + ); + + public AmbitiousDragonborn(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}"); + + this.subtype.add(SubType.DRAGON); + this.subtype.add(SubType.BARBARIAN); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Ambitious Dragonborn enters the battlefield with X +1/+1 counters on it, where X is the greatest power among creatures you control and creature cards in your graveyard. + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect( + CounterType.P1P1.createInstance(), AmbitiousDragonbornValue.instance, false + ), "with X +1/+1 counters on it, where X is the greatest power " + + "among creatures you control and creature cards in your graveyard")); + } + + private AmbitiousDragonborn(final AmbitiousDragonborn card) { + super(card); + } + + @Override + public AmbitiousDragonborn copy() { + return new AmbitiousDragonborn(this); + } +} + +enum AmbitiousDragonbornValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Player player = game.getPlayer(sourceAbility.getControllerId()); + if (player == null) { + return 0; + } + return Stream.concat( + player.getGraveyard() + .getCards(StaticFilters.FILTER_CARD_CREATURE, game) + .stream(), + game.getBattlefield() + .getActivePermanents( + StaticFilters.FILTER_CONTROLLED_CREATURE, + sourceAbility.getControllerId(), sourceAbility, game + ).stream() + ).map(MageObject::getPower).mapToInt(MageInt::getValue).max().orElse(0); + } + + @Override + public AmbitiousDragonbornValue copy() { + return this; + } + + @Override + public String getMessage() { + return ""; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index 97536ffb3d1..9d3635a5d6b 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -31,6 +31,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { cards.add(new SetCardInfo("Altar of Bhaal", 109, Rarity.RARE, mage.cards.a.AltarOfBhaal.class)); cards.add(new SetCardInfo("Amber Gristle O'Maul", 159, Rarity.UNCOMMON, mage.cards.a.AmberGristleOMaul.class)); cards.add(new SetCardInfo("Ambition's Cost", 110, Rarity.UNCOMMON, mage.cards.a.AmbitionsCost.class)); + cards.add(new SetCardInfo("Ambitious Dragonborn", 213, Rarity.COMMON, mage.cards.a.AmbitiousDragonborn.class)); cards.add(new SetCardInfo("Amethyst Dragon", 160, Rarity.UNCOMMON, mage.cards.a.AmethystDragon.class)); cards.add(new SetCardInfo("Ancient Brass Dragon", 111, Rarity.MYTHIC, mage.cards.a.AncientBrassDragon.class)); cards.add(new SetCardInfo("Ancient Bronze Dragon", 214, Rarity.MYTHIC, mage.cards.a.AncientBronzeDragon.class));