From ad4bfc711f2b535bc6c23165a152cc0fa72f56e8 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 22 Jun 2019 11:31:09 -0400 Subject: [PATCH] Implemented Ajani, Inspiring Leader --- .../mage/cards/a/AjaniInspiringLeader.java | 97 +++++++++++++++++++ Mage.Sets/src/mage/sets/CoreSet2020.java | 1 + 2 files changed, 98 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/AjaniInspiringLeader.java diff --git a/Mage.Sets/src/mage/cards/a/AjaniInspiringLeader.java b/Mage.Sets/src/mage/cards/a/AjaniInspiringLeader.java new file mode 100644 index 0000000000..2378d2f78d --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AjaniInspiringLeader.java @@ -0,0 +1,97 @@ +package mage.cards.a; + +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class AjaniInspiringLeader extends CardImpl { + + public AjaniInspiringLeader(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{4}{W}{W}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.AJANI); + this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(5)); + + // +2: You gain 2 life. Put two +1/+1 counters on up to one target creature. + Ability ability = new LoyaltyAbility(new GainLifeEffect(2).setText("You gain 2 life."), 2); + ability.addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance(2))); + ability.addTarget(new TargetCreaturePermanent(0, 1)); + this.addAbility(ability); + + // −3: Exile target creature. Its controller gains 2 life. + ability = new LoyaltyAbility(new AjaniInspiringLeaderEffect(), -3); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + + // −10: Creatures you control gain flying and double strike until end of turn. + ability = new LoyaltyAbility(new GainAbilityControlledEffect( + FlyingAbility.getInstance(), Duration.EndOfTurn, + StaticFilters.FILTER_PERMANENT_CREATURE + ).setText("Creatures you control gain flying"), -10); + ability.addEffect(new GainAbilityControlledEffect( + FlyingAbility.getInstance(), Duration.EndOfTurn, + StaticFilters.FILTER_PERMANENT_CREATURE + ).setText("and double strike until end of turn")); + this.addAbility(ability); + } + + private AjaniInspiringLeader(final AjaniInspiringLeader card) { + super(card); + } + + @Override + public AjaniInspiringLeader copy() { + return new AjaniInspiringLeader(this); + } +} + +class AjaniInspiringLeaderEffect extends OneShotEffect { + + AjaniInspiringLeaderEffect() { + super(Outcome.Benefit); + staticText = "Exile target creature. Its controller gains 2 life."; + } + + private AjaniInspiringLeaderEffect(final AjaniInspiringLeaderEffect effect) { + super(effect); + } + + @Override + public AjaniInspiringLeaderEffect copy() { + return new AjaniInspiringLeaderEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (permanent == null) { + return false; + } + Player player = game.getPlayer(permanent.getControllerId()); + if (player == null) { + return false; + } + player.gainLife(2, game, source); + return player.moveCards(permanent, Zone.EXILED, source, game); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/CoreSet2020.java b/Mage.Sets/src/mage/sets/CoreSet2020.java index ae87551620..ac38e17d3d 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2020.java +++ b/Mage.Sets/src/mage/sets/CoreSet2020.java @@ -44,6 +44,7 @@ public final class CoreSet2020 extends ExpansionSet { cards.add(new SetCardInfo("Aerial Assault", 1, Rarity.COMMON, mage.cards.a.AerialAssault.class)); cards.add(new SetCardInfo("Agent of Treachery", 43, Rarity.RARE, mage.cards.a.AgentOfTreachery.class)); + cards.add(new SetCardInfo("Ajani, Inspiring Leader", 282, Rarity.MYTHIC, mage.cards.a.AjaniInspiringLeader.class)); cards.add(new SetCardInfo("Ajani, Strength of the Pride", 2, Rarity.MYTHIC, mage.cards.a.AjaniStrengthOfThePride.class)); cards.add(new SetCardInfo("Angel of Vitality", 4, Rarity.UNCOMMON, mage.cards.a.AngelOfVitality.class)); cards.add(new SetCardInfo("Atemsis, All-Seeing", 46, Rarity.RARE, mage.cards.a.AtemsisAllSeeing.class));