From 00a82cda054886a61e5cf9cba0d3afe2427ee299 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 25 May 2022 07:11:39 -0400 Subject: [PATCH] [CLB] Implemented Earthquake Dragon --- .../src/mage/cards/e/EarthquakeDragon.java | 105 ++++++++++++++++++ .../CommanderLegendsBattleForBaldursGate.java | 1 + 2 files changed, 106 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/e/EarthquakeDragon.java diff --git a/Mage.Sets/src/mage/cards/e/EarthquakeDragon.java b/Mage.Sets/src/mage/cards/e/EarthquakeDragon.java new file mode 100644 index 00000000000..cea82d6ff94 --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EarthquakeDragon.java @@ -0,0 +1,105 @@ +package mage.cards.e; + +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.DevotionCount; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.ReturnSourceFromGraveyardToHandEffect; +import mage.abilities.effects.common.cost.SpellCostReductionSourceEffect; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; +import mage.filter.common.FilterControlledPermanent; +import mage.game.Game; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class EarthquakeDragon extends CardImpl { + + private static final Hint hint = new ValueHint( + "Total mana value of Dragons you control", EarthquakeDragonValue.instance + ); + + public EarthquakeDragon(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{14}{G}"); + + this.subtype.add(SubType.ELEMENTAL); + this.subtype.add(SubType.DRAGON); + this.power = new MageInt(10); + this.toughness = new MageInt(10); + + // This spell costs {X} less to cast, where X is the total mana value of Dragons you control. + this.addAbility(new SimpleStaticAbility( + Zone.ALL, new SpellCostReductionSourceEffect(EarthquakeDragonValue.instance) + ).addHint(DevotionCount.W.getHint()).setRuleAtTheTop(true)); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // {2}{G}, Sacrifice a land: Return Earthquake Dragon from your graveyard to your hand. + Ability ability = new SimpleActivatedAbility( + Zone.GRAVEYARD, new ReturnSourceFromGraveyardToHandEffect(), new ManaCostsImpl<>("{2}{G}") + ); + ability.addCost(new SacrificeTargetCost(StaticFilters.FILTER_CONTROLLED_LAND_SHORT_TEXT)); + this.addAbility(ability); + } + + private EarthquakeDragon(final EarthquakeDragon card) { + super(card); + } + + @Override + public EarthquakeDragon copy() { + return new EarthquakeDragon(this); + } +} + +enum EarthquakeDragonValue implements DynamicValue { + instance; + private static final FilterPermanent filter = new FilterControlledPermanent(SubType.DRAGON); + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return game + .getBattlefield() + .getActivePermanents(filter, sourceAbility.getControllerId(), sourceAbility, game) + .stream() + .mapToInt(MageObject::getManaValue) + .sum(); + } + + @Override + public EarthquakeDragonValue copy() { + return this; + } + + @Override + public String getMessage() { + return "the total mana value of Dragons you control"; + } + + @Override + public String toString() { + return "X"; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index c1ac92e570a..d4e233e057e 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -64,6 +64,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { cards.add(new SetCardInfo("Duke Ulder Ravengard", 272, Rarity.RARE, mage.cards.d.DukeUlderRavengard.class)); cards.add(new SetCardInfo("Dungeon Delver", 67, Rarity.UNCOMMON, mage.cards.d.DungeonDelver.class)); cards.add(new SetCardInfo("Dungeoneer's Pack", 312, Rarity.UNCOMMON, mage.cards.d.DungeoneersPack.class)); + cards.add(new SetCardInfo("Earthquake Dragon", 228, Rarity.RARE, mage.cards.e.EarthquakeDragon.class)); cards.add(new SetCardInfo("Elder Brain", 125, Rarity.RARE, mage.cards.e.ElderBrain.class)); cards.add(new SetCardInfo("Ellyn Harbreeze, Busybody", 16, Rarity.UNCOMMON, mage.cards.e.EllynHarbreezeBusybody.class)); cards.add(new SetCardInfo("Elminster", 274, Rarity.MYTHIC, mage.cards.e.Elminster.class));