From 6e5d891e280acb8e01c81745861722efef02a334 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 18 Apr 2019 08:29:24 -0400 Subject: [PATCH] Implemented Gideon Blackblade --- .../src/mage/cards/g/GideonBlackblade.java | 166 ++++++++++++++++++ Mage.Sets/src/mage/sets/WarOfTheSpark.java | 1 + 2 files changed, 167 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GideonBlackblade.java diff --git a/Mage.Sets/src/mage/cards/g/GideonBlackblade.java b/Mage.Sets/src/mage/cards/g/GideonBlackblade.java new file mode 100644 index 00000000000..74a3ea2dc5b --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GideonBlackblade.java @@ -0,0 +1,166 @@ +package mage.cards.g; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.MyTurnCondition; +import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileTargetEffect; +import mage.abilities.effects.common.PreventAllDamageToSourceEffect; +import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.IndestructibleAbility; +import mage.abilities.keyword.LifelinkAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.choices.Choice; +import mage.choices.ChoiceImpl; +import mage.constants.*; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.TokenImpl; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.target.common.TargetNonlandPermanent; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class GideonBlackblade extends CardImpl { + + private static final FilterPermanent filter = new FilterControlledCreaturePermanent("another other creature you control"); + + static { + filter.add(AnotherPredicate.instance); + } + + public GideonBlackblade(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{1}{W}{W}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.GIDEON); + this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(4)); + + // As long as it's your turn, Gideon Blackblade is a 4/4 Human Soldier creature with indestructible that's still a planeswalker. + this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect( + new BecomesCreatureSourceEffect( + new GideonBlackbladeToken(), "planeswalker", Duration.EndOfTurn + ), MyTurnCondition.instance, "As long as it's your turn, " + + "{this} is a 4/4 Human Soldier creature with indestructible that's still a planeswalker." + ))); + + // Prevent all damage that would be dealt to Gideon Blackblade during your turn. + this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect( + new PreventAllDamageToSourceEffect(Duration.WhileOnBattlefield), + MyTurnCondition.instance, "Prevent all damage that would be dealt to {this} during your turn." + ))); + + // +1: Up to one other target creature you control gains your choice of vigilance, lifelink, or indestructible until end of turn. + Ability ability = new LoyaltyAbility(new GideonBlackbladeEffect(), 1); + ability.addTarget(new TargetPermanent(0, 1, filter, false)); + this.addAbility(ability); + + // -6: Exile target nonland permanent. + ability = new LoyaltyAbility(new ExileTargetEffect(), -6); + ability.addTarget(new TargetNonlandPermanent()); + this.addAbility(ability); + } + + private GideonBlackblade(final GideonBlackblade card) { + super(card); + } + + @Override + public GideonBlackblade copy() { + return new GideonBlackblade(this); + } +} + +class GideonBlackbladeToken extends TokenImpl { + + GideonBlackbladeToken() { + super("", "4/4 Human Soldier creature"); + cardType.add(CardType.CREATURE); + subtype.add(SubType.HUMAN); + subtype.add(SubType.SOLDIER); + power = new MageInt(4); + toughness = new MageInt(4); + addAbility(IndestructibleAbility.getInstance()); + } + + private GideonBlackbladeToken(final GideonBlackbladeToken token) { + super(token); + } + + @Override + public GideonBlackbladeToken copy() { + return new GideonBlackbladeToken(this); + } +} + +class GideonBlackbladeEffect extends OneShotEffect { + private static final Set choices = new HashSet(); + + static { + choices.add("Vigilance"); + choices.add("Lifelink"); + choices.add("Indestructible"); + } + + GideonBlackbladeEffect() { + super(Outcome.Benefit); + staticText = "Up to one other target creature you control gains your choice of " + + "vigilance, lifelink, or indestructible until end of turn."; + } + + private GideonBlackbladeEffect(final GideonBlackbladeEffect effect) { + super(effect); + } + + @Override + public GideonBlackbladeEffect copy() { + return new GideonBlackbladeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (player == null || permanent == null) { + return false; + } + Choice choice = new ChoiceImpl(true); + choice.setMessage("Choose an ability to give to " + permanent.getLogName()); + choice.setChoices(choices); + if (!player.choose(outcome, choice, game)) { + return false; + } + Ability ability = null; + switch (choice.getChoice()) { + case "Vigilance": + ability = VigilanceAbility.getInstance(); + break; + case "Lifelink": + ability = LifelinkAbility.getInstance(); + break; + case "Indestructible": + ability = IndestructibleAbility.getInstance(); + break; + } + if (ability != null) { + game.addEffect(new GainAbilityTargetEffect(ability, Duration.EndOfTurn), source); + } + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/WarOfTheSpark.java b/Mage.Sets/src/mage/sets/WarOfTheSpark.java index d29a073f456..57d5035094d 100644 --- a/Mage.Sets/src/mage/sets/WarOfTheSpark.java +++ b/Mage.Sets/src/mage/sets/WarOfTheSpark.java @@ -100,6 +100,7 @@ public final class WarOfTheSpark extends ExpansionSet { cards.add(new SetCardInfo("Forest", 263, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Forest", 264, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Giant Growth", 162, Rarity.COMMON, mage.cards.g.GiantGrowth.class)); + cards.add(new SetCardInfo("Gideon Blackblade", 13, Rarity.MYTHIC, mage.cards.g.GideonBlackblade.class)); cards.add(new SetCardInfo("Gideon's Battle Cry", 267, Rarity.RARE, mage.cards.g.GideonsBattleCry.class)); cards.add(new SetCardInfo("Gideon's Company", 268, Rarity.UNCOMMON, mage.cards.g.GideonsCompany.class)); cards.add(new SetCardInfo("Gideon's Triumph", 15, Rarity.UNCOMMON, mage.cards.g.GideonsTriumph.class));