Implemented General's Enforcer

This commit is contained in:
Evan Kranzler 2020-04-05 09:44:06 -04:00
parent 824dd29e87
commit 1126610243
2 changed files with 97 additions and 0 deletions

View file

@ -0,0 +1,96 @@
package mage.cards.g;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.token.HumanSoldierToken;
import mage.game.permanent.token.Token;
import mage.players.Player;
import mage.target.common.TargetCardInGraveyard;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class GeneralsEnforcer extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent(SubType.HUMAN, "Legendary Humans");
static {
filter.add(SuperType.LEGENDARY.getPredicate());
}
public GeneralsEnforcer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{B}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SOLDIER);
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// Legendary Humans you control have indestructible.
this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect(
IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield, filter
)));
// {2}{W}{B}: Exile target card from a graveyard. If it was a creature card, create a 1/1 white Human Soldier creature token.
Ability ability = new SimpleActivatedAbility(new GeneralsEnforcerEffect(), new ManaCostsImpl("{2}{W}{B}"));
ability.addTarget(new TargetCardInGraveyard());
this.addAbility(ability);
}
private GeneralsEnforcer(final GeneralsEnforcer card) {
super(card);
}
@Override
public GeneralsEnforcer copy() {
return new GeneralsEnforcer(this);
}
}
class GeneralsEnforcerEffect extends OneShotEffect {
private static final Token token = new HumanSoldierToken();
GeneralsEnforcerEffect() {
super(Outcome.Benefit);
staticText = "Exile target card from a graveyard. If it was a creature card, " +
"create a 1/1 white Human Soldier creature token.";
}
private GeneralsEnforcerEffect(final GeneralsEnforcerEffect effect) {
super(effect);
}
@Override
public GeneralsEnforcerEffect copy() {
return new GeneralsEnforcerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Card card = game.getCard(source.getFirstTarget());
if (player == null || card == null) {
return false;
}
boolean isCreature = card.isCreature();
if (player.moveCards(card, Zone.EXILED, source, game) && isCreature) {
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
}
return true;
}
}

View file

@ -45,6 +45,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet {
cards.add(new SetCardInfo("Footfall Crater", 118, Rarity.UNCOMMON, mage.cards.f.FootfallCrater.class)); cards.add(new SetCardInfo("Footfall Crater", 118, Rarity.UNCOMMON, mage.cards.f.FootfallCrater.class));
cards.add(new SetCardInfo("Fully Grown", 154, Rarity.COMMON, mage.cards.f.FullyGrown.class)); cards.add(new SetCardInfo("Fully Grown", 154, Rarity.COMMON, mage.cards.f.FullyGrown.class));
cards.add(new SetCardInfo("Gemrazer", 155, Rarity.RARE, mage.cards.g.Gemrazer.class)); cards.add(new SetCardInfo("Gemrazer", 155, Rarity.RARE, mage.cards.g.Gemrazer.class));
cards.add(new SetCardInfo("General's Enforcer", 188, Rarity.UNCOMMON, mage.cards.g.GeneralsEnforcer.class));
cards.add(new SetCardInfo("Gloom Pangolin", 89, Rarity.COMMON, mage.cards.g.GloomPangolin.class)); cards.add(new SetCardInfo("Gloom Pangolin", 89, Rarity.COMMON, mage.cards.g.GloomPangolin.class));
cards.add(new SetCardInfo("Glowstone Recluse", 156, Rarity.UNCOMMON, mage.cards.g.GlowstoneRecluse.class)); cards.add(new SetCardInfo("Glowstone Recluse", 156, Rarity.UNCOMMON, mage.cards.g.GlowstoneRecluse.class));
cards.add(new SetCardInfo("Grimdancer", 90, Rarity.UNCOMMON, mage.cards.g.Grimdancer.class)); cards.add(new SetCardInfo("Grimdancer", 90, Rarity.UNCOMMON, mage.cards.g.Grimdancer.class));