From 611d6d6a45e00231425b37b097698682d2b15bb5 Mon Sep 17 00:00:00 2001 From: PurpleCrowbar <26198472+PurpleCrowbar@users.noreply.github.com> Date: Sat, 5 Nov 2022 03:06:12 +0000 Subject: [PATCH] [BRO] Implement Liberator, Urza's Battlethopter (#9732) * [BRO] Implement Liberator, Urza's Battlethopter * Removed instantiation of totalPaid variable (only used once) * Applied requested changes to Liberator --- .../cards/l/LiberatorUrzasBattlethopter.java | 100 ++++++++++++++++++ Mage.Sets/src/mage/sets/TheBrothersWar.java | 2 + 2 files changed, 102 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/l/LiberatorUrzasBattlethopter.java diff --git a/Mage.Sets/src/mage/cards/l/LiberatorUrzasBattlethopter.java b/Mage.Sets/src/mage/cards/l/LiberatorUrzasBattlethopter.java new file mode 100644 index 0000000000..020d68cee8 --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LiberatorUrzasBattlethopter.java @@ -0,0 +1,100 @@ +package mage.cards.l; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; +import mage.abilities.effects.Effects; +import mage.abilities.effects.common.continuous.CastAsThoughItHadFlashAllEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.FlashAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ColorlessPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.stack.Spell; +import mage.watchers.common.ManaPaidSourceWatcher; + +import java.util.UUID; + +/** + * @author PurpleCrowbar + */ +public final class LiberatorUrzasBattlethopter extends CardImpl { + + private static final FilterCard filter = new FilterCard("colorless spells and artifact spells"); + + static { + filter.add(Predicates.or( + ColorlessPredicate.instance, + CardType.ARTIFACT.getPredicate() + )); + } + + public LiberatorUrzasBattlethopter(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}"); + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.THOPTER); + this.power = new MageInt(1); + this.toughness = new MageInt(2); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // You may cast colorless spells and artifact spells as though they had flash. + this.addAbility(new SimpleStaticAbility( + new CastAsThoughItHadFlashAllEffect(Duration.WhileOnBattlefield, filter) + )); + + // Whenever you cast a spell, if the amount of mana spent to cast that spell is greater + // than Liberator, Urza's Battlethopter's power, put a +1/+1 counter on Liberator. + this.addAbility(new ConditionalInterveningIfTriggeredAbility( + new SpellCastControllerTriggeredAbility( + new AddCountersSourceEffect(CounterType.P1P1.createInstance()), StaticFilters.FILTER_SPELL_A, false, true + ), LiberatorUrzasBattlethopterCondition.instance, "Whenever you cast a spell, if the amount of mana spent to cast " + + "that spell is greater than {this}'s power, put a +1/+1 counter on {this}" + )); + } + + private LiberatorUrzasBattlethopter(final LiberatorUrzasBattlethopter card) { + super(card); + } + + @Override + public LiberatorUrzasBattlethopter copy() { + return new LiberatorUrzasBattlethopter(this); + } +} + +enum LiberatorUrzasBattlethopterCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = source.getSourcePermanentIfItStillExists(game); + if (permanent == null) { + return false; + } + Effects effects = source.getEffects(); + if (effects.isEmpty()) { + return false; + } + Object spell = effects.get(0).getValue("spellCast"); + if (spell instanceof Spell) { + return (ManaPaidSourceWatcher.getTotalPaid(((Spell) spell).getId(), game) > permanent.getPower().getValue()); + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/TheBrothersWar.java b/Mage.Sets/src/mage/sets/TheBrothersWar.java index 98065621fe..d846b1725b 100644 --- a/Mage.Sets/src/mage/sets/TheBrothersWar.java +++ b/Mage.Sets/src/mage/sets/TheBrothersWar.java @@ -135,6 +135,8 @@ public final class TheBrothersWar extends ExpansionSet { cards.add(new SetCardInfo("Koilos Roc", 55, Rarity.COMMON, mage.cards.k.KoilosRoc.class)); cards.add(new SetCardInfo("Lat-Nam Adept", 56, Rarity.COMMON, mage.cards.l.LatNamAdept.class)); cards.add(new SetCardInfo("Levitating Statue", 236, Rarity.UNCOMMON, mage.cards.l.LevitatingStatue.class)); + cards.add(new SetCardInfo("Liberator, Urza's Battlethopter", 237, Rarity.RARE, mage.cards.l.LiberatorUrzasBattlethopter.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Liberator, Urza's Battlethopter", 364, Rarity.RARE, mage.cards.l.LiberatorUrzasBattlethopter.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Llanowar Wastes", 264, Rarity.RARE, mage.cards.l.LlanowarWastes.class)); cards.add(new SetCardInfo("Loran of the Third Path", 12, Rarity.RARE, mage.cards.l.LoranOfTheThirdPath.class)); cards.add(new SetCardInfo("Loran's Escape", 14, Rarity.COMMON, mage.cards.l.LoransEscape.class));