[C21] Implemented Keen Duelist

This commit is contained in:
Evan Kranzler 2021-04-12 18:57:41 -04:00
parent f67c8e9e74
commit 22ef321700
2 changed files with 87 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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));