Implemented Ghired, Conclave Exile

This commit is contained in:
Evan Kranzler 2019-08-01 20:07:25 -04:00
parent c1cad4488b
commit 607cef0e79
3 changed files with 76 additions and 20 deletions

View file

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

View file

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

View file

@ -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 <i>(Create a token that's a copy of a creature token you control.)</i>";
}
public PopulateEffect(boolean tappedAndAttacking) {
super(Outcome.Copy);
this.tappedAndAttacking = tappedAndAttacking;
this.staticText = "populate. The token enters the battlefield tapped and attacking. " +
"<i>(To populate, create a token that's a copy of a creature token you control.)</i>";
}
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