From 99c1d0e8a55ebfb01e20c104ba32431084a8dfba Mon Sep 17 00:00:00 2001 From: Susucre <34709007+Susucre@users.noreply.github.com> Date: Mon, 21 Aug 2023 00:35:42 +0200 Subject: [PATCH] [WOE] Implement Korvold and the Noble Thief (#10896) --- .../mage/cards/k/KorvoldAndTheNobleThief.java | 103 ++++++++++++++++++ Mage.Sets/src/mage/sets/WildsOfEldraine.java | 1 + 2 files changed, 104 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/k/KorvoldAndTheNobleThief.java diff --git a/Mage.Sets/src/mage/cards/k/KorvoldAndTheNobleThief.java b/Mage.Sets/src/mage/cards/k/KorvoldAndTheNobleThief.java new file mode 100644 index 00000000000..fc326b78824 --- /dev/null +++ b/Mage.Sets/src/mage/cards/k/KorvoldAndTheNobleThief.java @@ -0,0 +1,103 @@ +package mage.cards.k; + +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.SagaAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.cards.*; +import mage.constants.*; +import mage.game.Game; +import mage.game.permanent.token.TreasureToken; +import mage.players.Player; +import mage.target.common.TargetOpponent; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class KorvoldAndTheNobleThief extends CardImpl { + + public KorvoldAndTheNobleThief(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}"); + + 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); + + // I, II -- Create a Treasure token. + sagaAbility.addChapterEffect( + this, SagaChapter.CHAPTER_I, SagaChapter.CHAPTER_II, + new CreateTokenEffect(new TreasureToken()) + ); + + // III -- Exile the top three cards of target opponent's library. You may play those cards this turn. + sagaAbility.addChapterEffect( + this, SagaChapter.CHAPTER_III, SagaChapter.CHAPTER_III, + new KorvoldAndTheNobleThiefEffect(), + new TargetOpponent() + ); + + this.addAbility(sagaAbility); + } + + private KorvoldAndTheNobleThief(final KorvoldAndTheNobleThief card) { + super(card); + } + + @Override + public KorvoldAndTheNobleThief copy() { + return new KorvoldAndTheNobleThief(this); + } +} + +class KorvoldAndTheNobleThiefEffect extends OneShotEffect { + + KorvoldAndTheNobleThiefEffect() { + super(Outcome.Benefit); + staticText = "exile the top three cards of target opponent's library. You may play those cards this turn"; + } + + private KorvoldAndTheNobleThiefEffect(final KorvoldAndTheNobleThiefEffect effect) { + super(effect); + } + + @Override + public KorvoldAndTheNobleThiefEffect copy() { + return new KorvoldAndTheNobleThiefEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Player opponent = game.getPlayer(source.getFirstTarget()); + MageObject sourceObject = source.getSourceObject(game); + if (player == null || opponent == null || sourceObject == null) { + return false; + } + + Cards cards = new CardsImpl(opponent.getLibrary().getTopCards(game, 3)); + + UUID exileId = CardUtil.getExileZoneId( + player.getId().toString() + + "-" + game.getState().getTurnNum() + + "-" + sourceObject.getIdName(), + game + ); + String exileName = sourceObject.getIdName() + + " — T" + game.getState().getTurnNum() + + " — Player: " + player.getName(); + game.getExile().createZone(exileId, exileName).setCleanupOnEndTurn(true); + + player.moveCardsToExile(cards.getCards(game), source, game, true, exileId, exileName); + cards.retainZone(Zone.EXILED, game); + + for (Card card : cards.getCards(game)) { + CardUtil.makeCardPlayable(game, source, card, Duration.EndOfTurn, false); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/WildsOfEldraine.java b/Mage.Sets/src/mage/sets/WildsOfEldraine.java index 37944aa7cd6..bee0cc7135e 100644 --- a/Mage.Sets/src/mage/sets/WildsOfEldraine.java +++ b/Mage.Sets/src/mage/sets/WildsOfEldraine.java @@ -67,6 +67,7 @@ public final class WildsOfEldraine extends ExpansionSet { cards.add(new SetCardInfo("Johann, Apprentice Sorcerer", 207, Rarity.UNCOMMON, mage.cards.j.JohannApprenticeSorcerer.class)); cards.add(new SetCardInfo("Kellan, the Fae-Blooded", 230, Rarity.MYTHIC, mage.cards.k.KellanTheFaeBlooded.class)); cards.add(new SetCardInfo("Knight of Doves", 19, Rarity.UNCOMMON, mage.cards.k.KnightOfDoves.class)); + cards.add(new SetCardInfo("Korvold and the Noble Thief", 139, Rarity.UNCOMMON, mage.cards.k.KorvoldAndTheNobleThief.class)); cards.add(new SetCardInfo("Lich-Knights' Conquest", 96, Rarity.RARE, mage.cards.l.LichKnightsConquest.class)); cards.add(new SetCardInfo("Likeness Looter", 208, Rarity.RARE, mage.cards.l.LikenessLooter.class)); cards.add(new SetCardInfo("Living Lectern", 59, Rarity.COMMON, mage.cards.l.LivingLectern.class));