From 7373009c943077054c4da174b31317a8afc30751 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 11 Jun 2021 21:47:17 -0400 Subject: [PATCH] [AFR] Implemented Tasha's Hideous Laughter --- .../mage/cards/t/TashasHideousLaughter.java | 76 +++++++++++++++++++ .../sets/AdventuresInTheForgottenRealms.java | 1 + Utils/mtg-cards-data.txt | 1 + 3 files changed, 78 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/TashasHideousLaughter.java diff --git a/Mage.Sets/src/mage/cards/t/TashasHideousLaughter.java b/Mage.Sets/src/mage/cards/t/TashasHideousLaughter.java new file mode 100644 index 0000000000..c662b6bc4f --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TashasHideousLaughter.java @@ -0,0 +1,76 @@ +package mage.cards.t; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.*; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TashasHideousLaughter extends CardImpl { + + public TashasHideousLaughter(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{U}{U}"); + + // Each opponent exiles cards from the top of their library until that player has exiled cards with total mana value 20 or more. + this.getSpellAbility().addEffect(new TashasHideousLaughterEffect()); + } + + private TashasHideousLaughter(final TashasHideousLaughter card) { + super(card); + } + + @Override + public TashasHideousLaughter copy() { + return new TashasHideousLaughter(this); + } +} + +class TashasHideousLaughterEffect extends OneShotEffect { + + TashasHideousLaughterEffect() { + super(Outcome.Benefit); + staticText = "each opponent exiles cards from the top of their library " + + "until that player has exiled cards with total mana value 20 or more"; + } + + private TashasHideousLaughterEffect(final TashasHideousLaughterEffect effect) { + super(effect); + } + + @Override + public TashasHideousLaughterEffect copy() { + return new TashasHideousLaughterEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + Cards cards = new CardsImpl(); + for (UUID playerId : game.getOpponents(source.getControllerId())) { + Player player = game.getPlayer(playerId); + if (player == null) { + continue; + } + int totalMV = 0; + for (Card card : player.getLibrary().getCards(game)) { + cards.add(card); + totalMV += card.getManaValue(); + if (totalMV >= 20) { + break; + } + } + } + return controller.moveCards(cards, Zone.EXILED, source, game); + } +} diff --git a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java index 11acb59188..945ef174f2 100644 --- a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java +++ b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java @@ -34,6 +34,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet { cards.add(new SetCardInfo("Power Word Kill", 114, Rarity.UNCOMMON, mage.cards.p.PowerWordKill.class)); cards.add(new SetCardInfo("Prosperous Innkeeper", 200, Rarity.UNCOMMON, mage.cards.p.ProsperousInnkeeper.class)); cards.add(new SetCardInfo("Swamp", 273, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Tasha's Hideous Laughter", 78, Rarity.RARE, mage.cards.t.TashasHideousLaughter.class)); cards.add(new SetCardInfo("Tiamat", 235, Rarity.MYTHIC, mage.cards.t.Tiamat.class)); cards.add(new SetCardInfo("Vorpal Sword", 124, Rarity.RARE, mage.cards.v.VorpalSword.class)); } diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index 7c3fb6e693..767f94fab9 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -41322,6 +41322,7 @@ Tranquil Thicket|Commander 2021|408|C||Land|||Tranquil Thicket enters the battle Yavimaya Coast|Commander 2021|409|R||Land|||{T}: Add {C}.${T}: Add {G} or {U}. Yavimaya Coast deals 1 damage to you.| Flumph|Adventures in the Forgotten Realms|15|R|{1}{W}|Creature - Jellyfish|0|4|Defender, flying$Whenever Flumph is dealt damage, you and target opponent each draw a card.| Portable Hole|Adventures in the Forgotten Realms|33|U|{W}|Artifact|||When Portable Hole enters the battlefield, exile target nonland permanent an opponent controls with mana value 2 or less until Portable Hole leaves the battlefield.| +Tasha's Hideous Laughter|Adventures in the Forgotten Realms|78|R|{1}{U}{U}|Sorcery|||Each opponent exiles cards from the top of their library until that player has exiled cards with total mana value 20 or more.| Lolth, Spider Queen|Adventures in the Forgotten Realms|112|M|{3}{B}{B}|Legendary Planeswalker - Lolth|4|Whenever a creature you control dies, put a loyalty counter on Lolth, Spider Queen.$0: You draw a card and you lose 1 life.$−3: Create two 2/1 black Spider creature tokens with menace and reach.$−8: You get an emblem with "Whenever an opponent is dealt combat damage by one or more creatures you control, if that player lost less than 8 life this turn, they lose life equal to the difference."| Power Word Kill|Adventures in the Forgotten Realms|114|U|{1}{B}|Instant|||Destroy target non-Angel, non-Demon, non-Devil, non-Dragon creature.| Vorpal Sword|Adventures in the Forgotten Realms|124|R|{B}|Artifact - Equipment|||Equipped creature gets +2/+0 and has deathtouch.${5}{B}{B}{B}: Until end of turn, Vorpal Sword gains "Whenever equipped creature deals combat damage to a player, that player loses the game."$Equip {B}{B}|