[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
This commit is contained in:
Daniel Bomar 2022-08-22 10:36:48 -05:00 committed by GitHub
parent e2d3a6581c
commit aea8c82728
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 91 additions and 15 deletions

View file

@ -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);
}
}

View file

@ -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("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("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("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("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("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)); cards.add(new SetCardInfo("Raff, Weatherlight Stalwart", 212, Rarity.UNCOMMON, mage.cards.r.RaffWeatherlightStalwart.class));

View file

@ -24,6 +24,7 @@ public class ReturnSourceFromGraveyardToBattlefieldEffect extends OneShotEffect
protected final boolean tapped; protected final boolean tapped;
protected final boolean ownerControl; protected final boolean ownerControl;
private final boolean haste; private final boolean haste;
private final boolean attacking;
public ReturnSourceFromGraveyardToBattlefieldEffect() { public ReturnSourceFromGraveyardToBattlefieldEffect() {
this(false); this(false);
@ -38,11 +39,16 @@ public class ReturnSourceFromGraveyardToBattlefieldEffect extends OneShotEffect
} }
public ReturnSourceFromGraveyardToBattlefieldEffect(boolean tapped, boolean ownerControl, boolean haste) { 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); super(Outcome.PutCreatureInPlay);
this.tapped = tapped; this.tapped = tapped;
this.ownerControl = ownerControl; this.ownerControl = ownerControl;
this.haste = haste; this.haste = haste;
setText(); this.attacking = attacking;
this.staticText = setText();
} }
public ReturnSourceFromGraveyardToBattlefieldEffect(final ReturnSourceFromGraveyardToBattlefieldEffect effect) { public ReturnSourceFromGraveyardToBattlefieldEffect(final ReturnSourceFromGraveyardToBattlefieldEffect effect) {
@ -50,6 +56,7 @@ public class ReturnSourceFromGraveyardToBattlefieldEffect extends OneShotEffect
this.tapped = effect.tapped; this.tapped = effect.tapped;
this.ownerControl = effect.ownerControl; this.ownerControl = effect.ownerControl;
this.haste = effect.haste; this.haste = effect.haste;
this.attacking = effect.attacking;
} }
@Override @Override
@ -82,19 +89,27 @@ public class ReturnSourceFromGraveyardToBattlefieldEffect extends OneShotEffect
game.addEffect(effect, source); game.addEffect(effect, source);
} }
} }
if (attacking) {
game.getCombat().addAttackingCreature(card.getId(), game);
}
} }
return true; return true;
} }
private void setText() { private String setText() {
StringBuilder sb = new StringBuilder("return {this} from your graveyard to the battlefield"); StringBuilder sb = new StringBuilder("return {this} from your graveyard to the battlefield");
if (tapped) { if (tapped) {
sb.append(" tapped"); sb.append(" tapped");
} }
if (attacking) {
if (tapped) {
sb.append(" and");
}
sb.append(" attacking");
}
if (ownerControl) { if (ownerControl) {
sb.append(" under its owner's control"); sb.append(" under its owner's control");
} }
staticText = sb.toString(); return sb.toString();
} }
} }

View file

@ -18,9 +18,13 @@ public class ReturnSourceFromGraveyardToBattlefieldWithCounterEffect extends Ret
private final Counter counter; private final Counter counter;
public ReturnSourceFromGraveyardToBattlefieldWithCounterEffect(Counter counter, boolean tapped) { 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; this.counter = counter;
setText(); this.staticText = setText();
} }
private ReturnSourceFromGraveyardToBattlefieldWithCounterEffect(final ReturnSourceFromGraveyardToBattlefieldWithCounterEffect effect) { private ReturnSourceFromGraveyardToBattlefieldWithCounterEffect(final ReturnSourceFromGraveyardToBattlefieldWithCounterEffect effect) {
@ -40,14 +44,8 @@ public class ReturnSourceFromGraveyardToBattlefieldWithCounterEffect extends Ret
return super.apply(game, source); return super.apply(game, source);
} }
private void setText() { private String setText() {
StringBuilder sb = new StringBuilder("return it to the battlefield"); StringBuilder sb = new StringBuilder(staticText);
if (tapped) {
sb.append(" tapped");
}
if (ownerControl) {
sb.append(" under its owner's control");
}
sb.append(" with "); sb.append(" with ");
if (counter.getCount() == 1) { if (counter.getCount() == 1) {
sb.append('a'); sb.append('a');
@ -61,7 +59,7 @@ public class ReturnSourceFromGraveyardToBattlefieldWithCounterEffect extends Ret
sb.append('s'); sb.append('s');
} }
sb.append(" on it"); sb.append(" on it");
staticText = sb.toString(); return sb.toString();
} }
} }