From b531ef092e08963a2e52e79e661326257eb635c1 Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Fri, 15 Jan 2021 16:52:15 -0600 Subject: [PATCH] [KHM] Implemented Fall of the Impostor (#7398) --- .../src/mage/cards/f/FallOfTheImpostor.java | 109 ++++++++++++++++++ Mage.Sets/src/mage/sets/Kaldheim.java | 1 + Utils/mtg-cards-data.txt | 2 +- 3 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/cards/f/FallOfTheImpostor.java diff --git a/Mage.Sets/src/mage/cards/f/FallOfTheImpostor.java b/Mage.Sets/src/mage/cards/f/FallOfTheImpostor.java new file mode 100644 index 0000000000..d71c41ec4a --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FallOfTheImpostor.java @@ -0,0 +1,109 @@ +package mage.cards.f; + +import java.util.List; +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.common.SagaAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.constants.*; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.PowerPredicate; +import mage.filter.predicate.permanent.ControllerIdPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; +import mage.target.common.TargetOpponent; + +/** + * + * @author weirddan455 + */ +public final class FallOfTheImpostor extends CardImpl { + + public FallOfTheImpostor(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}{W}"); + + this.subtype.add(SubType.SAGA); + + // (As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.) + SagaAbility sagaAbility = new SagaAbility(this, SagaChapter.CHAPTER_III); + + // I, II — Put a +1/+1 counter on up to one target creature. + sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_I, SagaChapter.CHAPTER_II, + new AddCountersTargetEffect(CounterType.P1P1.createInstance()), + new TargetCreaturePermanent(0, 1) + ); + + // III — Exile a creature with the greatest power among creatures target opponent controls. + sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_III, SagaChapter.CHAPTER_III, + new FallOfTheImpostorEffect(), new TargetOpponent() + ); + this.addAbility(sagaAbility); + } + + private FallOfTheImpostor(final FallOfTheImpostor card) { + super(card); + } + + @Override + public FallOfTheImpostor copy() { + return new FallOfTheImpostor(this); + } +} + +class FallOfTheImpostorEffect extends OneShotEffect { + + public FallOfTheImpostorEffect() { + super(Outcome.Exile); + staticText = "Exile a creature with the greatest power among creatures target opponent controls"; + } + + private FallOfTheImpostorEffect(final FallOfTheImpostorEffect effect) { + super(effect); + } + + @Override + public FallOfTheImpostorEffect copy() { + return new FallOfTheImpostorEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Player opponent = game.getPlayer(source.getFirstTarget()); + if (controller != null && opponent != null) { + List permanents = game.getBattlefield().getAllActivePermanents( + StaticFilters.FILTER_PERMANENT_CREATURE, opponent.getId(), game + ); + Integer maxPower = null; + for (Permanent permanent : permanents) { + if (permanent != null) { + int power = permanent.getPower().getValue(); + if (maxPower == null || power > maxPower) { + maxPower = power; + } + } + } + if (maxPower != null) { + FilterCreaturePermanent filter = new FilterCreaturePermanent(); + filter.add(new ControllerIdPredicate(opponent.getId())); + filter.add(new PowerPredicate(ComparisonType.EQUAL_TO, maxPower)); + TargetCreaturePermanent target = new TargetCreaturePermanent(1, 1, filter, true); + controller.chooseTarget(outcome, target, source, game); + Permanent permanent = game.getPermanent(target.getFirstTarget()); + if (permanent != null) { + controller.moveCardsToExile(permanent, source, game, true, null, null); + return true; + } + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index 5fc423ca59..43c33dd6eb 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -110,6 +110,7 @@ public final class Kaldheim extends ExpansionSet { cards.add(new SetCardInfo("Esika's Chariot", 169, Rarity.RARE, mage.cards.e.EsikasChariot.class)); cards.add(new SetCardInfo("Esika, God of the Tree", 168, Rarity.MYTHIC, mage.cards.e.EsikaGodOfTheTree.class)); cards.add(new SetCardInfo("Faceless Haven", 255, Rarity.RARE, mage.cards.f.FacelessHaven.class)); + cards.add(new SetCardInfo("Fall of the Impostor", 208, Rarity.UNCOMMON, mage.cards.f.FallOfTheImpostor.class)); cards.add(new SetCardInfo("Fearless Liberator", 135, Rarity.UNCOMMON, mage.cards.f.FearlessLiberator.class)); cards.add(new SetCardInfo("Feed the Serpent", 95, Rarity.COMMON, mage.cards.f.FeedTheSerpent.class)); cards.add(new SetCardInfo("Fire Giant's Fury", 389, Rarity.UNCOMMON, mage.cards.f.FireGiantsFury.class)); diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index 3fb2b8be4b..2150178c14 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -40163,7 +40163,7 @@ Battle for Bretagard|Kaldheim|203|R|{1}{G}{W}|Enchantment - Saga|||(As this Saga Battle of Frost and Fire|Kaldheim|204|R|{3}{U}{R}|Enchantment - Saga|||(As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.)$I — Battle of Frost and Fire deals 4 damage to each non-Giant creature and each planeswalker.$II — Scry 3.$III — Whenever you cast a spell with converted mana cost 5 or greater this turn, draw two cards, then discard a card.| The Bears of Littjara|Kaldheim|205|R|{1}{G}{U}|Enchantment - Saga|||(As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.)$I — Create a 2/2 blue Shapeshifter creature token with changeling.$II — Any number of target Shapeshifter creatures you control have base power and toughness 4/4.$III — Choose up to one target creature or planeswalker. Each creature you control with power 4 or greater deals damage equal to its power to that permanent.| Binding the Old Gods|Kaldheim|206|U|{2}{B}{G}|Enchantment - Saga|||(As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.)$I — Destroy target nonland permanent an opponent controls.$II — Search your library for a Forest card, put it onto the battlefield tapped, then shuffle your library.$III — Creatures you control gain deathtouch until end of turn.| -Fall of the Impostor|Kaldheim|208|U|{1}{G}{W}|Saga - Enchantment|||(As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.)$I, II — Put a +1/+1 counter on up to one target creature.$III — Exile a creature with the greatest power among creatures target opponent controls.| +Fall of the Impostor|Kaldheim|208|U|{1}{G}{W}|Enchantment - Saga|||(As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.)$I, II — Put a +1/+1 counter on up to one target creature.$III — Exile a creature with the greatest power among creatures target opponent controls.| Firja, Judge of Valor|Kaldheim|209|U|{2}{W}{B}{B}|Legendary Creature - Angel Cleric|2|4|Flying, lifelink$Whenever you cast your second spell each turn, look at the top three cards of your library. Put one of them into your hand and the rest into your graveyard.| Firja's Retribution|Kaldheim|210|R|{1}{W}{W}{B}|Enchantment - Saga|||(As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.)$I — Create a 4/4 white Angel Warrior creature token with flying and vigilance.$II — Until end of turn, Angels you control gain "{T}: Destroy target creature with less power than this creature."$III — Angels you control gain double strike until end of turn.| Forging the Tyrite Sword|Kaldheim|211|U|{1}{R}{W}|Enchantment - Saga|||(As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.)$I, II — Create a Treasure token.$III — Search your library for a card named Halvar, God of Battle or an Equipment card, reveal it, put it into your hand, then shuffle your library.|