diff --git a/Mage.Sets/src/mage/cards/c/CavalierOfNight.java b/Mage.Sets/src/mage/cards/c/CavalierOfNight.java index c3303ed410..47437215ba 100644 --- a/Mage.Sets/src/mage/cards/c/CavalierOfNight.java +++ b/Mage.Sets/src/mage/cards/c/CavalierOfNight.java @@ -59,7 +59,7 @@ public final class CavalierOfNight extends CardImpl { this.addAbility(new EntersBattlefieldTriggeredAbility(new DoIfCostPaid( new CavalierOfNightCreateReflexiveTriggerEffect(), new SacrificeTargetCost(new TargetControlledPermanent(filter)) - ))); + ).setText("you may sacrifice another creature. When you do, destroy target creature an opponent controls."))); // When Cavalier of Night dies, return target creature card with converted mana cost 3 or less from your graveyard to the battlefield. Ability ability = new DiesTriggeredAbility(new ReturnFromGraveyardToBattlefieldTargetEffect()); diff --git a/Mage.Sets/src/mage/cards/c/CavalierOfThorns.java b/Mage.Sets/src/mage/cards/c/CavalierOfThorns.java new file mode 100644 index 0000000000..cd7e55cbf4 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CavalierOfThorns.java @@ -0,0 +1,111 @@ +package mage.cards.c; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.costs.common.ExileSourceFromGraveCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DoIfCostPaid; +import mage.abilities.effects.common.PutOnLibraryTargetEffect; +import mage.abilities.keyword.ReachAbility; +import mage.cards.*; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.common.FilterLandCard; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInYourGraveyard; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class CavalierOfThorns extends CardImpl { + + private static final FilterCard filter = new FilterCard("another card from your graveyard"); + + static { + filter.add(AnotherPredicate.instance); + } + + public CavalierOfThorns(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{G}{G}"); + + this.subtype.add(SubType.ELEMENTAL); + this.subtype.add(SubType.KNIGHT); + this.power = new MageInt(5); + this.toughness = new MageInt(6); + + // Reach + this.addAbility(ReachAbility.getInstance()); + + // When Cavalier of Thorns enters the battlefield, reveal the top five cards of your library. You may put a land card from among them onto the battlefield. Put the rest into your graveyard. + this.addAbility(new EntersBattlefieldTriggeredAbility(new CavalierOfThornsEffect())); + + // When Cavalier of Thorns dies, you may exile it. If you do, put another target card from your graveyard on top of your library. + Ability ability = new DiesTriggeredAbility(new DoIfCostPaid( + new PutOnLibraryTargetEffect(true), new ExileSourceFromGraveCost() + ).setText("you may exile it. If you do, put another target card from your graveyard on top of your library.")); + ability.addTarget(new TargetCardInYourGraveyard(filter)); + this.addAbility(ability); + } + + private CavalierOfThorns(final CavalierOfThorns card) { + super(card); + } + + @Override + public CavalierOfThorns copy() { + return new CavalierOfThorns(this); + } +} + +class CavalierOfThornsEffect extends OneShotEffect { + + private static final FilterCard filter = new FilterLandCard("land card to put on the battlefield"); + + CavalierOfThornsEffect() { + super(Outcome.PutCreatureInPlay); + this.staticText = "reveal the top five cards of your library. " + + "You may put a land card from among them onto the battlefield. Put the rest into your graveyard."; + } + + private CavalierOfThornsEffect(final CavalierOfThornsEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 5)); + if (cards.isEmpty()) { + return true; + } + controller.revealCards(source, cards, game); + TargetCard target = new TargetCard(0, 1, Zone.LIBRARY, filter); + if (controller.choose(Outcome.PutCardInPlay, cards, target, game)) { + Card card = cards.get(target.getFirstTarget(), game); + if (card != null) { + cards.remove(card); + controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, true, null); + } + } + controller.moveCards(cards, Zone.GRAVEYARD, source, game); + return true; + } + + @Override + public CavalierOfThornsEffect copy() { + return new CavalierOfThornsEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/CoreSet2020.java b/Mage.Sets/src/mage/sets/CoreSet2020.java index 6fbbfaeb1d..2972666b5a 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2020.java +++ b/Mage.Sets/src/mage/sets/CoreSet2020.java @@ -64,6 +64,7 @@ public final class CoreSet2020 extends ExpansionSet { cards.add(new SetCardInfo("Cavalier of Dawn", 10, Rarity.MYTHIC, mage.cards.c.CavalierOfDawn.class)); cards.add(new SetCardInfo("Cavalier of Flame", 125, Rarity.MYTHIC, mage.cards.c.CavalierOfFlame.class)); cards.add(new SetCardInfo("Cavalier of Night", 94, Rarity.MYTHIC, mage.cards.c.CavalierOfNight.class)); + cards.add(new SetCardInfo("Cavalier of Thorns", 167, Rarity.MYTHIC, mage.cards.c.CavalierOfThorns.class)); cards.add(new SetCardInfo("Cerulean Drake", 53, Rarity.UNCOMMON, mage.cards.c.CeruleanDrake.class)); cards.add(new SetCardInfo("Chandra's Embercat", 129, Rarity.COMMON, mage.cards.c.ChandrasEmbercat.class)); cards.add(new SetCardInfo("Chandra's Spitfire", 132, Rarity.UNCOMMON, mage.cards.c.ChandrasSpitfire.class)); diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/AnotherPredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/AnotherPredicate.java index c8d9671388..b0f42114f2 100644 --- a/Mage/src/main/java/mage/filter/predicate/permanent/AnotherPredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/permanent/AnotherPredicate.java @@ -1,19 +1,19 @@ package mage.filter.predicate.permanent; +import mage.MageObject; import mage.filter.predicate.ObjectSourcePlayer; import mage.filter.predicate.ObjectSourcePlayerPredicate; import mage.game.Game; -import mage.game.permanent.Permanent; /** * @author North */ -public enum AnotherPredicate implements ObjectSourcePlayerPredicate> { +public enum AnotherPredicate implements ObjectSourcePlayerPredicate> { instance; @Override - public boolean apply(ObjectSourcePlayer input, Game game) { + public boolean apply(ObjectSourcePlayer input, Game game) { return !input.getObject().getId().equals(input.getSourceId()); }