diff --git a/Mage.Sets/src/mage/cards/g/GrowthCycle.java b/Mage.Sets/src/mage/cards/g/GrowthCycle.java new file mode 100644 index 00000000000..a8258395e95 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GrowthCycle.java @@ -0,0 +1,75 @@ +package mage.cards.g; + +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * @author TheElk801 + */ +public final class GrowthCycle extends CardImpl { + + public GrowthCycle(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}"); + + // Target creature gets +3/+3 until end of turn. It gets an additional +2/+2 until end of turn for each card named Growth Cycle in your graveyard. + this.getSpellAbility().addEffect(new BoostTargetEffect( + GrowthCycleValue.instance, GrowthCycleValue.instance, + Duration.EndOfTurn, true + ).setText("Target creature gets +3/+3 until end of turn. " + + "It gets an additional +2/+2 until end of turn " + + "for each card named Growth Cycle in your graveyard.") + ); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + } + + private GrowthCycle(final GrowthCycle card) { + super(card); + } + + @Override + public GrowthCycle copy() { + return new GrowthCycle(this); + } +} + +enum GrowthCycleValue 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 player + .getGraveyard() + .getCards(game) + .stream() + .map(Card::getName) + .filter(s -> s.equals("Growth Cycle")) + .collect(Collectors.reducing(0, e -> 1, Integer::sum)); + } + + @Override + public GrowthCycleValue copy() { + return instance; + } + + @Override + public String getMessage() { + return ""; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/CoreSet2020.java b/Mage.Sets/src/mage/sets/CoreSet2020.java index 96e5addbd0a..84c9e4a14fc 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2020.java +++ b/Mage.Sets/src/mage/sets/CoreSet2020.java @@ -52,6 +52,7 @@ public final class CoreSet2020 extends ExpansionSet { cards.add(new SetCardInfo("Flame Sweep", 139, Rarity.UNCOMMON, mage.cards.f.FlameSweep.class)); cards.add(new SetCardInfo("Flood of Tears", 59, Rarity.RARE, mage.cards.f.FloodOfTears.class)); cards.add(new SetCardInfo("Goblin Ringleader", 141, Rarity.UNCOMMON, mage.cards.g.GoblinRingleader.class)); + cards.add(new SetCardInfo("Growth Cycle", 175, Rarity.COMMON, mage.cards.g.GrowthCycle.class)); cards.add(new SetCardInfo("Hanged Executioner", 22, Rarity.RARE, mage.cards.h.HangedExecutioner.class)); cards.add(new SetCardInfo("Infuriate", 145, Rarity.COMMON, mage.cards.i.Infuriate.class)); cards.add(new SetCardInfo("Ironroot Warlord", 209, Rarity.UNCOMMON, mage.cards.i.IronrootWarlord.class));