From 607cef0e791dabd7e11099e1a5c1bee22ffbb988 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 1 Aug 2019 20:07:25 -0400 Subject: [PATCH] Implemented Ghired, Conclave Exile --- .../src/mage/cards/g/GhiredConclaveExile.java | 46 +++++++++++++++++ .../src/mage/sets/Commander2019Edition.java | 1 + .../effects/common/PopulateEffect.java | 49 +++++++++++-------- 3 files changed, 76 insertions(+), 20 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/g/GhiredConclaveExile.java diff --git a/Mage.Sets/src/mage/cards/g/GhiredConclaveExile.java b/Mage.Sets/src/mage/cards/g/GhiredConclaveExile.java new file mode 100644 index 00000000000..f7da1e0108d --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GhiredConclaveExile.java @@ -0,0 +1,46 @@ +package mage.cards.g; + +import mage.MageInt; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.PopulateEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.game.permanent.token.RhinoToken; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class GhiredConclaveExile extends CardImpl { + + public GhiredConclaveExile(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{G}{W}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.SHAMAN); + this.power = new MageInt(2); + this.toughness = new MageInt(5); + + // When Ghired, Conclave Exile enters the battlefield, create a 4/4 green Rhino creature token with trample. + this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new RhinoToken()))); + + // Whenever Ghired attacks, populate. The token enters the battlefield tapped and attacking. + this.addAbility(new AttacksTriggeredAbility(new PopulateEffect(true), false)); + } + + private GhiredConclaveExile(final GhiredConclaveExile card) { + super(card); + } + + @Override + public GhiredConclaveExile copy() { + return new GhiredConclaveExile(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2019Edition.java b/Mage.Sets/src/mage/sets/Commander2019Edition.java index 4a348103afc..157231cacc1 100644 --- a/Mage.Sets/src/mage/sets/Commander2019Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2019Edition.java @@ -19,6 +19,7 @@ public final class Commander2019Edition extends ExpansionSet { super("Commander 2019 Edition", "C19", ExpansionSet.buildDate(2019, 8, 23), SetType.SUPPLEMENTAL); this.blockName = "Command Zone"; + cards.add(new SetCardInfo("Ghired, Conclave Exile", 42, Rarity.MYTHIC, mage.cards.g.GhiredConclaveExile.class)); cards.add(new SetCardInfo("Seedborn Muse", 179, Rarity.RARE, mage.cards.s.SeedbornMuse.class)); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/PopulateEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PopulateEffect.java index 59b4cbdf407..36f670f80bd 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PopulateEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PopulateEffect.java @@ -1,11 +1,11 @@ package mage.abilities.effects.common; -import mage.constants.Outcome; -import mage.constants.TargetController; import mage.abilities.Ability; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; +import mage.constants.TargetController; import mage.filter.FilterPermanent; import mage.filter.predicate.permanent.ControllerPredicate; import mage.filter.predicate.permanent.TokenPredicate; @@ -17,7 +17,6 @@ import mage.target.TargetPermanent; import mage.target.targetpointer.FixedTarget; /** - * * @author LevelX2 */ // @@ -31,6 +30,7 @@ import mage.target.targetpointer.FixedTarget; // public class PopulateEffect extends OneShotEffect { + private final boolean tappedAndAttacking; private static final FilterPermanent filter = new FilterPermanent("token for populate"); static { @@ -43,35 +43,44 @@ public class PopulateEffect extends OneShotEffect { } public PopulateEffect(String prefixText) { - super(Outcome.Copy); + this(false); this.staticText = (!prefixText.isEmpty() ? prefixText + " p" : "P") + "opulate (Create a token that's a copy of a creature token you control.)"; } + public PopulateEffect(boolean tappedAndAttacking) { + super(Outcome.Copy); + this.tappedAndAttacking = tappedAndAttacking; + this.staticText = "populate. The token enters the battlefield tapped and attacking. " + + "(To populate, create a token that's a copy of a creature token you control.)"; + } + public PopulateEffect(final PopulateEffect effect) { super(effect); + this.tappedAndAttacking = effect.tappedAndAttacking; } @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); - if (player != null) { - Target target = new TargetPermanent(filter); - target.setNotTarget(true); - if (target.canChoose(source.getControllerId(), game)) { - player.choose(Outcome.Copy, target, source.getSourceId(), game); - Permanent tokenToCopy = game.getPermanent(target.getFirstTarget()); - if (tokenToCopy != null) { - if (!game.isSimulation()) { - game.informPlayers("Token selected for populate: " + tokenToCopy.getLogName()); - } - Effect effect = new CreateTokenCopyTargetEffect(); - effect.setTargetPointer(new FixedTarget(target.getFirstTarget())); - return effect.apply(game, source); - } - } + if (player == null) { + return false; + } + Target target = new TargetPermanent(filter); + target.setNotTarget(true); + if (!target.canChoose(source.getControllerId(), game)) { return true; } - return false; + player.choose(Outcome.Copy, target, source.getSourceId(), game); + Permanent tokenToCopy = game.getPermanent(target.getFirstTarget()); + if (tokenToCopy == null) { + return true; + } + game.informPlayers("Token selected for populate: " + tokenToCopy.getLogName()); + Effect effect = new CreateTokenCopyTargetEffect( + null, null, false, 1, tappedAndAttacking, tappedAndAttacking + ); + effect.setTargetPointer(new FixedTarget(target.getFirstTarget())); + return effect.apply(game, source); } @Override