From 25a4ef3368214d001f70c7f902e950d5ca894df2 Mon Sep 17 00:00:00 2001 From: PurpleCrowbar <26198472+PurpleCrowbar@users.noreply.github.com> Date: Tue, 9 Apr 2024 17:48:21 +0100 Subject: [PATCH] [PIP] Implement Power Fist --- Mage.Sets/src/mage/cards/p/PowerFist.java | 78 +++++++++++++++++++++++ Mage.Sets/src/mage/sets/Fallout.java | 2 + 2 files changed, 80 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/p/PowerFist.java diff --git a/Mage.Sets/src/mage/cards/p/PowerFist.java b/Mage.Sets/src/mage/cards/p/PowerFist.java new file mode 100644 index 00000000000..fc06c920f9e --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PowerFist.java @@ -0,0 +1,78 @@ +package mage.cards.p; + +import mage.abilities.Ability; +import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; +import mage.abilities.keyword.EquipAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author PurpleCrowbar + */ +public final class PowerFist extends CardImpl { + + public PowerFist(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}{G}"); + + this.subtype.add(SubType.EQUIPMENT); + + // Equipped creature has trample and "Whenever this creature deals combat damage to a player, put that many +1/+1 counters on it." + Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(TrampleAbility.getInstance(), AttachmentType.EQUIPMENT)); + ability.addEffect(new GainAbilityAttachedEffect( + new DealsCombatDamageToAPlayerTriggeredAbility(new PowerFistEffect(), false, true), AttachmentType.EQUIPMENT + ).setText("and \"Whenever this creature deals combat damage to a player, put that many +1/+1 counters on it.\"")); + this.addAbility(ability); + + // Equip {2} + this.addAbility(new EquipAbility(2, false)); + } + + private PowerFist(final PowerFist card) { + super(card); + } + + @Override + public PowerFist copy() { + return new PowerFist(this); + } +} + +class PowerFistEffect extends OneShotEffect { + + PowerFistEffect() { + super(Outcome.Benefit); + staticText = "put that many +1/+1 counters on it"; + } + + private PowerFistEffect(final PowerFistEffect effect) { + super(effect); + } + + @Override + public PowerFistEffect copy() { + return new PowerFistEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = source.getSourcePermanentIfItStillExists(game); + int damage = (Integer) getValue("damage"); + if (permanent == null || damage < 1) { + return false; + } + return permanent.addCounters( + CounterType.P1P1.createInstance(damage), + source.getControllerId(), source, game + ); + } +} diff --git a/Mage.Sets/src/mage/sets/Fallout.java b/Mage.Sets/src/mage/sets/Fallout.java index 2170544c68f..bc8e91beaa3 100644 --- a/Mage.Sets/src/mage/sets/Fallout.java +++ b/Mage.Sets/src/mage/sets/Fallout.java @@ -226,6 +226,8 @@ public final class Fallout extends ExpansionSet { cards.add(new SetCardInfo("Pitiless Plunderer", 187, Rarity.UNCOMMON, mage.cards.p.PitilessPlunderer.class)); cards.add(new SetCardInfo("Plains", 317, Rarity.LAND, mage.cards.basiclands.Plains.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Powder Ganger", 65, Rarity.RARE, mage.cards.p.PowderGanger.class)); + cards.add(new SetCardInfo("Power Fist", 81, Rarity.RARE, mage.cards.p.PowerFist.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Power Fist", 400, Rarity.RARE, mage.cards.p.PowerFist.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Prairie Stream", 280, Rarity.RARE, mage.cards.p.PrairieStream.class)); cards.add(new SetCardInfo("Pre-War Formalwear", 21, Rarity.RARE, mage.cards.p.PreWarFormalwear.class)); cards.add(new SetCardInfo("Puresteel Paladin", 170, Rarity.RARE, mage.cards.p.PuresteelPaladin.class));