From 764fb28fb40ee3ecac44867ddbd3ef15be98c9c0 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 30 Dec 2019 16:58:38 -0500 Subject: [PATCH] Implemented Brine Giant --- Mage.Sets/src/mage/cards/b/BrineGiant.java | 86 +++++++++++++++++++ .../src/mage/sets/TherosBeyondDeath.java | 1 + 2 files changed, 87 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/b/BrineGiant.java diff --git a/Mage.Sets/src/mage/cards/b/BrineGiant.java b/Mage.Sets/src/mage/cards/b/BrineGiant.java new file mode 100644 index 0000000000..3d646c1799 --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BrineGiant.java @@ -0,0 +1,86 @@ +package mage.cards.b; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.common.cost.CostModificationEffectImpl; +import mage.abilities.hint.ValueHint; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.game.Game; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class BrineGiant extends CardImpl { + + private static final DynamicValue xValue + = new PermanentsOnBattlefieldCount(BrineGiantCostReductionEffect.filter); + + public BrineGiant(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{6}{U}"); + + this.subtype.add(SubType.GIANT); + this.power = new MageInt(5); + this.toughness = new MageInt(6); + + // This spell costs {1} less to cast for each enchantment you control. + this.addAbility(new SimpleStaticAbility( + Zone.ALL, new BrineGiantCostReductionEffect() + ).addHint(new ValueHint("Enchantments you control", xValue))); + } + + private BrineGiant(final BrineGiant card) { + super(card); + } + + @Override + public BrineGiant copy() { + return new BrineGiant(this); + } +} + +class BrineGiantCostReductionEffect extends CostModificationEffectImpl { + + static final FilterControlledPermanent filter = new FilterControlledPermanent(); + + static { + filter.add(new CardTypePredicate(CardType.ENCHANTMENT)); + } + + BrineGiantCostReductionEffect() { + super(Duration.WhileOnStack, Outcome.Benefit, CostModificationType.REDUCE_COST); + staticText = "This spell costs {1} less to cast for each artifact you control"; + } + + private BrineGiantCostReductionEffect(final BrineGiantCostReductionEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source, Ability abilityToModify) { + int count = game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game).size(); + if (count > 0) { + CardUtil.reduceCost(abilityToModify, count); + } + return true; + } + + @Override + public boolean applies(Ability abilityToModify, Ability source, Game game) { + return abilityToModify.getSourceId().equals(source.getSourceId()); + } + + @Override + public BrineGiantCostReductionEffect copy() { + return new BrineGiantCostReductionEffect(this); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java index 37c61bf6d8..1da4db7ba0 100644 --- a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java +++ b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java @@ -30,6 +30,7 @@ public final class TherosBeyondDeath extends ExpansionSet { cards.add(new SetCardInfo("Ashiok, Nightmare Muse", 208, Rarity.MYTHIC, mage.cards.a.AshiokNightmareMuse.class)); cards.add(new SetCardInfo("Ashiok, Sculptor of Fears", 274, Rarity.MYTHIC, mage.cards.a.AshiokSculptorOfFears.class)); cards.add(new SetCardInfo("Athreos, Shroud-Veiled", 269, Rarity.MYTHIC, mage.cards.a.AthreosShroudVeiled.class)); + cards.add(new SetCardInfo("Brine Giant", 44, Rarity.COMMON, mage.cards.b.BrineGiant.class)); cards.add(new SetCardInfo("Commanding Presence", 7, Rarity.UNCOMMON, mage.cards.c.CommandingPresence.class)); cards.add(new SetCardInfo("Daxos, Blessed by the Sun", 9, Rarity.UNCOMMON, mage.cards.d.DaxosBlessedByTheSun.class)); cards.add(new SetCardInfo("Deathbellow War Cry", 294, Rarity.RARE, mage.cards.d.DeathbellowWarCry.class));