From 2dc421c463bec97784d9c239f844c73a89b521c1 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 22 Nov 2022 09:33:51 -0500 Subject: [PATCH] [J22] Implement Towering Gibbon --- .../src/mage/cards/t/ToweringGibbon.java | 86 +++++++++++++++++++ Mage.Sets/src/mage/sets/Jumpstart2022.java | 1 + 2 files changed, 87 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/ToweringGibbon.java diff --git a/Mage.Sets/src/mage/cards/t/ToweringGibbon.java b/Mage.Sets/src/mage/cards/t/ToweringGibbon.java new file mode 100644 index 0000000000..2d26ece348 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/ToweringGibbon.java @@ -0,0 +1,86 @@ +package mage.cards.t; + +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.SetBasePowerSourceEffect; +import mage.abilities.keyword.ReachAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ToweringGibbon extends CardImpl { + + public ToweringGibbon(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}"); + + this.subtype.add(SubType.APE); + this.power = new MageInt(0); + this.toughness = new MageInt(4); + + // Reach + this.addAbility(ReachAbility.getInstance()); + + // Towering Gibbon's power is equal to the greatest mana value among creatures you control. + this.addAbility(new SimpleStaticAbility( + Zone.ALL, + new SetBasePowerSourceEffect( + ToweringGibbonValue.instance, Duration.EndOfGame + ).setText("{this}'s power is equal to the greatest mana value among creatures you control") + )); + } + + private ToweringGibbon(final ToweringGibbon card) { + super(card); + } + + @Override + public ToweringGibbon copy() { + return new ToweringGibbon(this); + } +} + +enum ToweringGibbonValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return game + .getBattlefield() + .getActivePermanents( + StaticFilters.FILTER_CONTROLLED_CREATURE, + sourceAbility.getControllerId(), sourceAbility, game + ).stream() + .mapToInt(MageObject::getManaValue) + .max() + .orElse(0); + } + + @Override + public ToweringGibbonValue copy() { + return this; + } + + @Override + public String getMessage() { + return ""; + } + + @Override + public String toString() { + return "X"; + } +} diff --git a/Mage.Sets/src/mage/sets/Jumpstart2022.java b/Mage.Sets/src/mage/sets/Jumpstart2022.java index 13b1c03c0d..f5e3ad5a49 100644 --- a/Mage.Sets/src/mage/sets/Jumpstart2022.java +++ b/Mage.Sets/src/mage/sets/Jumpstart2022.java @@ -63,6 +63,7 @@ public final class Jumpstart2022 extends ExpansionSet { cards.add(new SetCardInfo("Spectral Sailor", 64, Rarity.UNCOMMON, mage.cards.s.SpectralSailor.class)); cards.add(new SetCardInfo("Spellstutter Sprite", 65, Rarity.COMMON, mage.cards.s.SpellstutterSprite.class)); cards.add(new SetCardInfo("Thrashing Brontodon", 92, Rarity.UNCOMMON, mage.cards.t.ThrashingBrontodon.class)); + cards.add(new SetCardInfo("Towering Gibbon", 46, Rarity.UNCOMMON, mage.cards.t.ToweringGibbon.class)); cards.add(new SetCardInfo("Trove Warden", 259, Rarity.RARE, mage.cards.t.TroveWarden.class)); cards.add(new SetCardInfo("Typhoid Rats", 468, Rarity.COMMON, mage.cards.t.TyphoidRats.class)); cards.add(new SetCardInfo("Uktabi Orangutan", 133, Rarity.UNCOMMON, mage.cards.u.UktabiOrangutan.class));