From 6ea50d8de17a0c03bf87ac1cc3e6d5d79611a117 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 26 Apr 2022 20:21:19 -0400 Subject: [PATCH] [NCC] Implemented Perrie, the Pulverizer --- .../src/mage/cards/p/PerrieThePulverizer.java | 104 ++++++++++++++++++ .../src/mage/sets/NewCapennaCommander.java | 1 + 2 files changed, 105 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/p/PerrieThePulverizer.java diff --git a/Mage.Sets/src/mage/cards/p/PerrieThePulverizer.java b/Mage.Sets/src/mage/cards/p/PerrieThePulverizer.java new file mode 100644 index 00000000000..20daff0fec7 --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PerrieThePulverizer.java @@ -0,0 +1,104 @@ +package mage.cards.p; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.Collection; +import java.util.HashMap; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class PerrieThePulverizer extends CardImpl { + + private static final Hint hint = new ValueHint( + "Different kinds of counters among permanents you control", PerrieThePulverizerValue.instance + ); + + public PerrieThePulverizer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{U}{W}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.RHINO); + this.subtype.add(SubType.SOLDIER); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // When Perrie enters the battlefield, put a shield counter on target creature. + Ability ability = new EntersBattlefieldTriggeredAbility( + new AddCountersTargetEffect(CounterType.SHIELD.createInstance()) + ); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + + // Whenever Perrie attacks, target creature you control gains trample and gets +X/+X, where X is the number of different kinds of counters among permanents you control. + ability = new AttacksTriggeredAbility(new GainAbilityTargetEffect(TrampleAbility.getInstance()) + .setText("target creature you control gains trample")); + ability.addEffect(new BoostTargetEffect( + PerrieThePulverizerValue.instance, PerrieThePulverizerValue.instance, Duration.EndOfTurn + ).setText("and gets +X/+X, where X is the number of different kinds of counters among permanents you control")); + ability.addTarget(new TargetControlledCreaturePermanent()); + this.addAbility(ability); + } + + private PerrieThePulverizer(final PerrieThePulverizer card) { + super(card); + } + + @Override + public PerrieThePulverizer copy() { + return new PerrieThePulverizer(this); + } +} + +enum PerrieThePulverizerValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return game + .getBattlefield() + .getActivePermanents( + StaticFilters.FILTER_CONTROLLED_PERMANENT, + sourceAbility.getControllerId(), sourceAbility, game + ).stream() + .map(p -> p.getCounters(game)) + .map(HashMap::keySet) + .flatMap(Collection::stream) + .distinct() + .mapToInt(x -> 1) + .sum(); + } + + @Override + public PerrieThePulverizerValue copy() { + return this; + } + + @Override + public String getMessage() { + return ""; + } +} diff --git a/Mage.Sets/src/mage/sets/NewCapennaCommander.java b/Mage.Sets/src/mage/sets/NewCapennaCommander.java index 89add88bb4d..8662ac25441 100644 --- a/Mage.Sets/src/mage/sets/NewCapennaCommander.java +++ b/Mage.Sets/src/mage/sets/NewCapennaCommander.java @@ -207,6 +207,7 @@ public final class NewCapennaCommander extends ExpansionSet { cards.add(new SetCardInfo("Park Heights Maverick", 63, Rarity.RARE, mage.cards.p.ParkHeightsMaverick.class)); cards.add(new SetCardInfo("Path of Ancestry", 419, Rarity.COMMON, mage.cards.p.PathOfAncestry.class)); cards.add(new SetCardInfo("Path to Exile", 208, Rarity.UNCOMMON, mage.cards.p.PathToExile.class)); + cards.add(new SetCardInfo("Perrie, the Pulverizer", 5, Rarity.MYTHIC, mage.cards.p.PerrieThePulverizer.class)); cards.add(new SetCardInfo("Planar Outburst", 209, Rarity.RARE, mage.cards.p.PlanarOutburst.class)); cards.add(new SetCardInfo("Ponder", 229, Rarity.COMMON, mage.cards.p.Ponder.class)); cards.add(new SetCardInfo("Port Town", 420, Rarity.RARE, mage.cards.p.PortTown.class));