mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Implemented Cavalier of Thorns
This commit is contained in:
parent
72839bcebf
commit
189aed29b5
4 changed files with 116 additions and 4 deletions
|
@ -59,7 +59,7 @@ public final class CavalierOfNight extends CardImpl {
|
||||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new DoIfCostPaid(
|
this.addAbility(new EntersBattlefieldTriggeredAbility(new DoIfCostPaid(
|
||||||
new CavalierOfNightCreateReflexiveTriggerEffect(),
|
new CavalierOfNightCreateReflexiveTriggerEffect(),
|
||||||
new SacrificeTargetCost(new TargetControlledPermanent(filter))
|
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.
|
// 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());
|
Ability ability = new DiesTriggeredAbility(new ReturnFromGraveyardToBattlefieldTargetEffect());
|
||||||
|
|
111
Mage.Sets/src/mage/cards/c/CavalierOfThorns.java
Normal file
111
Mage.Sets/src/mage/cards/c/CavalierOfThorns.java
Normal file
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 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 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 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("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 Embercat", 129, Rarity.COMMON, mage.cards.c.ChandrasEmbercat.class));
|
||||||
cards.add(new SetCardInfo("Chandra's Spitfire", 132, Rarity.UNCOMMON, mage.cards.c.ChandrasSpitfire.class));
|
cards.add(new SetCardInfo("Chandra's Spitfire", 132, Rarity.UNCOMMON, mage.cards.c.ChandrasSpitfire.class));
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
|
|
||||||
package mage.filter.predicate.permanent;
|
package mage.filter.predicate.permanent;
|
||||||
|
|
||||||
|
import mage.MageObject;
|
||||||
import mage.filter.predicate.ObjectSourcePlayer;
|
import mage.filter.predicate.ObjectSourcePlayer;
|
||||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author North
|
* @author North
|
||||||
*/
|
*/
|
||||||
public enum AnotherPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {
|
public enum AnotherPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<MageObject>> {
|
||||||
instance;
|
instance;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
public boolean apply(ObjectSourcePlayer<MageObject> input, Game game) {
|
||||||
return !input.getObject().getId().equals(input.getSourceId());
|
return !input.getObject().getId().equals(input.getSourceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue