From 4201f0a2606ed27ca383bdeb9787aa19d3181f41 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 8 Jan 2019 12:29:08 -0500 Subject: [PATCH] Implemented Unbreakable Formation --- .../mage/cards/u/UnbreakableFormation.java | 79 +++++++++++++++++++ .../src/mage/sets/RavnicaAllegiance.java | 1 + 2 files changed, 80 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/u/UnbreakableFormation.java diff --git a/Mage.Sets/src/mage/cards/u/UnbreakableFormation.java b/Mage.Sets/src/mage/cards/u/UnbreakableFormation.java new file mode 100644 index 0000000000..2c53b53b4a --- /dev/null +++ b/Mage.Sets/src/mage/cards/u/UnbreakableFormation.java @@ -0,0 +1,79 @@ +package mage.cards.u; + +import mage.abilities.Ability; +import mage.abilities.condition.common.AddendumCondition; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; +import mage.abilities.effects.common.counter.AddCountersAllEffect; +import mage.abilities.keyword.IndestructibleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.game.Game; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class UnbreakableFormation extends CardImpl { + + public UnbreakableFormation(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}"); + + // Creatures you control gain indestructible until end of turn. + this.getSpellAbility().addEffect(new GainAbilityControlledEffect( + IndestructibleAbility.getInstance(), Duration.EndOfTurn, + StaticFilters.FILTER_PERMANENT_CREATURE + )); + + // Addendum — If you cast this spell during your main phase, put a +1/+1 counter on each of those creatures, and they also gain vigilance until end of turn. + this.getSpellAbility().addEffect(new UnbreakableFormationEffect()); + } + + private UnbreakableFormation(final UnbreakableFormation card) { + super(card); + } + + @Override + public UnbreakableFormation copy() { + return new UnbreakableFormation(this); + } +} + +class UnbreakableFormationEffect extends OneShotEffect { + + UnbreakableFormationEffect() { + super(Outcome.Benefit); + staticText = "
Addendum — If you cast this spell during your main phase, " + + "put a +1/+1 counter on each of those creatures, and they also gain vigilance until end of turn."; + } + + private UnbreakableFormationEffect(final UnbreakableFormationEffect effect) { + super(effect); + } + + @Override + public UnbreakableFormationEffect copy() { + return new UnbreakableFormationEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + if (!AddendumCondition.instance.apply(game, source)) { + return false; + } + game.addEffect(new GainAbilityControlledEffect( + IndestructibleAbility.getInstance(), Duration.EndOfTurn, + StaticFilters.FILTER_PERMANENT_CREATURE + ), source); + return new AddCountersAllEffect( + CounterType.P1P1.createInstance(), + StaticFilters.FILTER_CONTROLLED_CREATURE + ).apply(game, source); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java index 68c6b8692b..cd845434ad 100644 --- a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java +++ b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java @@ -142,6 +142,7 @@ public final class RavnicaAllegiance extends ExpansionSet { cards.add(new SetCardInfo("Titanic Brawl", 146, Rarity.COMMON, mage.cards.t.TitanicBrawl.class)); cards.add(new SetCardInfo("Tithe Taker", 27, Rarity.RARE, mage.cards.t.TitheTaker.class)); cards.add(new SetCardInfo("Trollbred Guardian", 148, Rarity.UNCOMMON, mage.cards.t.TrollbredGuardian.class)); + cards.add(new SetCardInfo("Unbreakable Formation", 29, Rarity.RARE, mage.cards.u.UnbreakableFormation.class)); cards.add(new SetCardInfo("Verity Circle", 58, Rarity.RARE, mage.cards.v.VerityCircle.class)); cards.add(new SetCardInfo("Warrant // Warden", 230, Rarity.RARE, mage.cards.w.WarrantWarden.class)); cards.add(new SetCardInfo("Wilderness Reclamation", 149, Rarity.UNCOMMON, mage.cards.w.WildernessReclamation.class));