From b080d831ceeedc5772e7dfefb5f7b0ab5de4013c Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 2 Apr 2021 07:21:59 -0400 Subject: [PATCH] [STX] Implemented Exponential Growth --- .../src/mage/cards/e/ExponentialGrowth.java | 74 +++++++++++++++++++ .../mage/sets/StrixhavenSchoolOfMages.java | 1 + 2 files changed, 75 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/e/ExponentialGrowth.java diff --git a/Mage.Sets/src/mage/cards/e/ExponentialGrowth.java b/Mage.Sets/src/mage/cards/e/ExponentialGrowth.java new file mode 100644 index 0000000000..ef16544f9b --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/ExponentialGrowth.java @@ -0,0 +1,74 @@ +package mage.cards.e; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ExponentialGrowth extends CardImpl { + + public ExponentialGrowth(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{G}{G}"); + + // Until end of turn, double target creature's power X times. + this.getSpellAbility().addEffect(new ExponentialGrowthEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + } + + private ExponentialGrowth(final ExponentialGrowth card) { + super(card); + } + + @Override + public ExponentialGrowth copy() { + return new ExponentialGrowth(this); + } +} + +class ExponentialGrowthEffect extends OneShotEffect { + + ExponentialGrowthEffect() { + super(Outcome.Benefit); + staticText = "until end of turn, double target creature's power X times"; + } + + private ExponentialGrowthEffect(final ExponentialGrowthEffect effect) { + super(effect); + } + + @Override + public ExponentialGrowthEffect copy() { + return new ExponentialGrowthEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (permanent == null) { + return false; + } + int xValue = source.getManaCostsToPay().getX(); + int multiplier = 1; + for (int i = 0; i < xValue; i++) { + multiplier = CardUtil.overflowMultiply(multiplier, 2); + } + multiplier = CardUtil.overflowDec(multiplier, 1); + game.addEffect(new BoostTargetEffect(CardUtil.overflowMultiply( + multiplier, permanent.getPower().getValue() + ), 0, Duration.EndOfTurn), source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java index 12d37ecd57..311e705b9f 100644 --- a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java +++ b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java @@ -62,6 +62,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet { cards.add(new SetCardInfo("Eureka Moment", 184, Rarity.COMMON, mage.cards.e.EurekaMoment.class)); cards.add(new SetCardInfo("Expanded Anatomy", 2, Rarity.COMMON, mage.cards.e.ExpandedAnatomy.class)); cards.add(new SetCardInfo("Expel", 18, Rarity.COMMON, mage.cards.e.Expel.class)); + cards.add(new SetCardInfo("Exponential Growth", 130, Rarity.RARE, mage.cards.e.ExponentialGrowth.class)); cards.add(new SetCardInfo("Field Trip", 131, Rarity.COMMON, mage.cards.f.FieldTrip.class)); cards.add(new SetCardInfo("Forest", 374, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Fortifying Draught", 132, Rarity.UNCOMMON, mage.cards.f.FortifyingDraught.class));