From aea8c8272895a1b353078a08cec697137405f110 Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Mon, 22 Aug 2022 10:36:48 -0500 Subject: [PATCH] [DMU] Implemented Phoenix Chick (#9397) * [DMU] Implemented Phoenix Chick * ReturnSourceFromGraveyardToBattlefieldWithCounterEffect - Fix constructor * Revert back to using setText() to set staticText * Make setText() return a String --- Mage.Sets/src/mage/cards/p/PhoenixChick.java | 62 +++++++++++++++++++ Mage.Sets/src/mage/sets/DominariaUnited.java | 1 + ...ourceFromGraveyardToBattlefieldEffect.java | 23 +++++-- ...aveyardToBattlefieldWithCounterEffect.java | 20 +++--- 4 files changed, 91 insertions(+), 15 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/p/PhoenixChick.java diff --git a/Mage.Sets/src/mage/cards/p/PhoenixChick.java b/Mage.Sets/src/mage/cards/p/PhoenixChick.java new file mode 100644 index 00000000000..a75b5fcf73f --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PhoenixChick.java @@ -0,0 +1,62 @@ +package mage.cards.p; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.AttacksWithCreaturesTriggeredAbility; +import mage.abilities.common.CantBlockAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.DoIfCostPaid; +import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldWithCounterEffect; +import mage.constants.SubType; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.StaticFilters; + +/** + * + * @author weirddan455 + */ +public final class PhoenixChick extends CardImpl { + + public PhoenixChick(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}"); + + this.subtype.add(SubType.PHOENIX); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Haste + this.addAbility(HasteAbility.getInstance()); + + // Phoenix Chick can't block. + this.addAbility(new CantBlockAbility()); + + // Whenever you attack with three or more creatures, you may pay {R}{R}. If you do, return Phoenix Chick from your graveyard to the battlefield tapped and attacking with a +1/+1 counter on it. + this.addAbility(new AttacksWithCreaturesTriggeredAbility( + Zone.GRAVEYARD, + new DoIfCostPaid( + new ReturnSourceFromGraveyardToBattlefieldWithCounterEffect(CounterType.P1P1.createInstance(), true, false, false, true), + new ManaCostsImpl<>("{R}{R}") + ), + 3, + StaticFilters.FILTER_PERMANENT_CREATURES + )); + } + + private PhoenixChick(final PhoenixChick card) { + super(card); + } + + @Override + public PhoenixChick copy() { + return new PhoenixChick(this); + } +} diff --git a/Mage.Sets/src/mage/sets/DominariaUnited.java b/Mage.Sets/src/mage/sets/DominariaUnited.java index 9593c64fdd5..aad2a4cdcbb 100644 --- a/Mage.Sets/src/mage/sets/DominariaUnited.java +++ b/Mage.Sets/src/mage/sets/DominariaUnited.java @@ -65,6 +65,7 @@ public final class DominariaUnited extends ExpansionSet { cards.add(new SetCardInfo("Monstrous War-Leech", 98, Rarity.UNCOMMON, mage.cards.m.MonstrousWarLeech.class)); cards.add(new SetCardInfo("Mountain", 271, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Nishoba Brawler", 174, Rarity.UNCOMMON, mage.cards.n.NishobaBrawler.class)); + cards.add(new SetCardInfo("Phoenix Chick", 140, Rarity.UNCOMMON, mage.cards.p.PhoenixChick.class)); cards.add(new SetCardInfo("Plains", 262, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Protect the Negotiators", 62, Rarity.UNCOMMON, mage.cards.p.ProtectTheNegotiators.class)); cards.add(new SetCardInfo("Raff, Weatherlight Stalwart", 212, Rarity.UNCOMMON, mage.cards.r.RaffWeatherlightStalwart.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldEffect.java index cf1c379e523..667d725e2a9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldEffect.java @@ -24,6 +24,7 @@ public class ReturnSourceFromGraveyardToBattlefieldEffect extends OneShotEffect protected final boolean tapped; protected final boolean ownerControl; private final boolean haste; + private final boolean attacking; public ReturnSourceFromGraveyardToBattlefieldEffect() { this(false); @@ -38,11 +39,16 @@ public class ReturnSourceFromGraveyardToBattlefieldEffect extends OneShotEffect } public ReturnSourceFromGraveyardToBattlefieldEffect(boolean tapped, boolean ownerControl, boolean haste) { + this(tapped, ownerControl, haste, false); + } + + public ReturnSourceFromGraveyardToBattlefieldEffect(boolean tapped, boolean ownerControl, boolean haste, boolean attacking) { super(Outcome.PutCreatureInPlay); this.tapped = tapped; this.ownerControl = ownerControl; this.haste = haste; - setText(); + this.attacking = attacking; + this.staticText = setText(); } public ReturnSourceFromGraveyardToBattlefieldEffect(final ReturnSourceFromGraveyardToBattlefieldEffect effect) { @@ -50,6 +56,7 @@ public class ReturnSourceFromGraveyardToBattlefieldEffect extends OneShotEffect this.tapped = effect.tapped; this.ownerControl = effect.ownerControl; this.haste = effect.haste; + this.attacking = effect.attacking; } @Override @@ -82,19 +89,27 @@ public class ReturnSourceFromGraveyardToBattlefieldEffect extends OneShotEffect game.addEffect(effect, source); } } + if (attacking) { + game.getCombat().addAttackingCreature(card.getId(), game); + } } return true; } - private void setText() { + private String setText() { StringBuilder sb = new StringBuilder("return {this} from your graveyard to the battlefield"); if (tapped) { sb.append(" tapped"); } + if (attacking) { + if (tapped) { + sb.append(" and"); + } + sb.append(" attacking"); + } if (ownerControl) { sb.append(" under its owner's control"); } - staticText = sb.toString(); + return sb.toString(); } - } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldWithCounterEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldWithCounterEffect.java index 6676868722b..1b5d0cbe9bc 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldWithCounterEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldWithCounterEffect.java @@ -18,9 +18,13 @@ public class ReturnSourceFromGraveyardToBattlefieldWithCounterEffect extends Ret private final Counter counter; public ReturnSourceFromGraveyardToBattlefieldWithCounterEffect(Counter counter, boolean tapped) { - super(tapped); + this(counter, tapped, true, false, false); + } + + public ReturnSourceFromGraveyardToBattlefieldWithCounterEffect(Counter counter, boolean tapped, boolean ownerControl, boolean haste, boolean attacking) { + super(tapped, ownerControl, haste, attacking); this.counter = counter; - setText(); + this.staticText = setText(); } private ReturnSourceFromGraveyardToBattlefieldWithCounterEffect(final ReturnSourceFromGraveyardToBattlefieldWithCounterEffect effect) { @@ -40,14 +44,8 @@ public class ReturnSourceFromGraveyardToBattlefieldWithCounterEffect extends Ret return super.apply(game, source); } - private void setText() { - StringBuilder sb = new StringBuilder("return it to the battlefield"); - if (tapped) { - sb.append(" tapped"); - } - if (ownerControl) { - sb.append(" under its owner's control"); - } + private String setText() { + StringBuilder sb = new StringBuilder(staticText); sb.append(" with "); if (counter.getCount() == 1) { sb.append('a'); @@ -61,7 +59,7 @@ public class ReturnSourceFromGraveyardToBattlefieldWithCounterEffect extends Ret sb.append('s'); } sb.append(" on it"); - staticText = sb.toString(); + return sb.toString(); } }