From 22ef321700d16e3d6a09d40c61711a2e3686eb44 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 12 Apr 2021 18:57:41 -0400 Subject: [PATCH] [C21] Implemented Keen Duelist --- Mage.Sets/src/mage/cards/k/KeenDuelist.java | 86 +++++++++++++++++++ .../src/mage/sets/Commander2021Edition.java | 1 + 2 files changed, 87 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/k/KeenDuelist.java diff --git a/Mage.Sets/src/mage/cards/k/KeenDuelist.java b/Mage.Sets/src/mage/cards/k/KeenDuelist.java new file mode 100644 index 0000000000..bdea133058 --- /dev/null +++ b/Mage.Sets/src/mage/cards/k/KeenDuelist.java @@ -0,0 +1,86 @@ +package mage.cards.k; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.*; +import mage.constants.*; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetOpponent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class KeenDuelist extends CardImpl { + + public KeenDuelist(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // At the beginning of your upkeep, you and target opponent each reveal the top card of your library. You each lose life equal to the mana value of the card revealed by the other player. You each put the card you revealed into your hand. + Ability ability = new BeginningOfUpkeepTriggeredAbility( + new KeenDuelistEffect(), TargetController.YOU, false + ); + ability.addTarget(new TargetOpponent()); + this.addAbility(ability); + } + + private KeenDuelist(final KeenDuelist card) { + super(card); + } + + @Override + public KeenDuelist copy() { + return new KeenDuelist(this); + } +} + +class KeenDuelistEffect extends OneShotEffect { + + KeenDuelistEffect() { + super(Outcome.Benefit); + staticText = "you and target opponent each reveal the top card of your library. " + + "You each lose life equal to the mana value of the card revealed by the other player. " + + "You each put the card you revealed into your hand"; + } + + private KeenDuelistEffect(final KeenDuelistEffect effect) { + super(effect); + } + + @Override + public KeenDuelistEffect copy() { + return new KeenDuelistEffect(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) { + return false; + } + Cards cards = new CardsImpl(); + Card myCard = controller.getLibrary().getFromTop(game); + cards.add(myCard); + Card theirCard = opponent.getLibrary().getFromTop(game); + cards.add(theirCard); + controller.revealCards(source, cards, game); + if (theirCard != null && theirCard.getConvertedManaCost() < 1) { + controller.loseLife(theirCard.getConvertedManaCost(), game, source, false); + } + if (myCard != null && myCard.getConvertedManaCost() < 1) { + opponent.loseLife(myCard.getConvertedManaCost(), game, source, false); + } + controller.moveCards(cards, Zone.HAND, source, game); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2021Edition.java b/Mage.Sets/src/mage/sets/Commander2021Edition.java index 0f4d2d4fb6..b3419e9b79 100644 --- a/Mage.Sets/src/mage/sets/Commander2021Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2021Edition.java @@ -130,6 +130,7 @@ public final class Commander2021Edition extends ExpansionSet { cards.add(new SetCardInfo("Jor Kadeen, the Prevailer", 220, Rarity.RARE, mage.cards.j.JorKadeenThePrevailer.class)); cards.add(new SetCardInfo("Kaseto, Orochi Archmage", 221, Rarity.MYTHIC, mage.cards.k.KasetoOrochiArchmage.class)); cards.add(new SetCardInfo("Kazandu Tuskcaller", 196, Rarity.RARE, mage.cards.k.KazanduTuskcaller.class)); + cards.add(new SetCardInfo("Keen Duelist", 42, Rarity.RARE, mage.cards.k.KeenDuelist.class)); cards.add(new SetCardInfo("Key to the City", 248, Rarity.RARE, mage.cards.k.KeyToTheCity.class)); cards.add(new SetCardInfo("Knight of the White Orchid", 95, Rarity.RARE, mage.cards.k.KnightOfTheWhiteOrchid.class)); cards.add(new SetCardInfo("Kodama's Reach", 197, Rarity.COMMON, mage.cards.k.KodamasReach.class));