diff --git a/Mage.Sets/src/mage/cards/c/ColfenorTheLastYew.java b/Mage.Sets/src/mage/cards/c/ColfenorTheLastYew.java new file mode 100644 index 0000000000..277fb449e1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/ColfenorTheLastYew.java @@ -0,0 +1,102 @@ +package mage.cards.c; + +import mage.MageInt; +import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility; +import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect; +import mage.abilities.keyword.ReachAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.common.FilterCreatureCard; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.CardIdPredicate; +import mage.filter.predicate.mageobject.ToughnessPredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCardInYourGraveyard; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ColfenorTheLastYew extends CardImpl { + + public ColfenorTheLastYew(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}{B}{G}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.TREEFOLK); + this.subtype.add(SubType.SHAMAN); + this.power = new MageInt(3); + this.toughness = new MageInt(7); + + // Vigilance + this.addAbility(VigilanceAbility.getInstance()); + + // Reach + this.addAbility(ReachAbility.getInstance()); + + // Whenever Colfenor, the Last Yew or another creature you control dies, return up to one other target creature card with lesser toughness from your graveyard to your hand. + this.addAbility(new ColfenorTheLastYewTriggeredAbility()); + } + + private ColfenorTheLastYew(final ColfenorTheLastYew card) { + super(card); + } + + @Override + public ColfenorTheLastYew copy() { + return new ColfenorTheLastYew(this); + } +} + +class ColfenorTheLastYewTriggeredAbility extends DiesThisOrAnotherCreatureTriggeredAbility { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(); + + static { + filter.add(TargetController.YOU.getControllerPredicate()); + } + + public ColfenorTheLastYewTriggeredAbility() { + super(new ReturnFromGraveyardToHandTargetEffect(), false, filter); + } + + private ColfenorTheLastYewTriggeredAbility(final ColfenorTheLastYewTriggeredAbility ability) { + super(ability); + } + + @Override + public DiesThisOrAnotherCreatureTriggeredAbility copy() { + return new ColfenorTheLastYewTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (!super.checkTrigger(event, game)) { + return false; + } + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + Permanent permanent = zEvent.getTarget(); + if (permanent == null) { + return false; + } + FilterCard filterCard = new FilterCreatureCard("creature card with toughness less than " + permanent.getToughness().getValue()); + filterCard.add(new ToughnessPredicate(ComparisonType.FEWER_THAN, permanent.getToughness().getValue())); + filterCard.add(new CardIdPredicate(zEvent.getTarget().getId())); + this.getTargets().clear(); + this.addTarget(new TargetCardInYourGraveyard(0, 1, filterCard)); + return true; + } + + @Override + public String getRule() { + return "Whenever {this} or another creature you control dies, return up to one other target creature card " + + "with lesser toughness from your graveyard to your hand."; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/CommanderLegends.java b/Mage.Sets/src/mage/sets/CommanderLegends.java index b610d3f193..284b6d8e6c 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegends.java +++ b/Mage.Sets/src/mage/sets/CommanderLegends.java @@ -60,6 +60,7 @@ public final class CommanderLegends extends ExpansionSet { cards.add(new SetCardInfo("Charcoal Diamond", 303, Rarity.COMMON, mage.cards.c.CharcoalDiamond.class)); cards.add(new SetCardInfo("Coastline Marauders", 168, Rarity.UNCOMMON, mage.cards.c.CoastlineMarauders.class)); cards.add(new SetCardInfo("Coiling Oracle", 443, Rarity.COMMON, mage.cards.c.CoilingOracle.class)); + cards.add(new SetCardInfo("Colfenor, the Last Yew", 274, Rarity.RARE, mage.cards.c.ColfenorTheLastYew.class)); cards.add(new SetCardInfo("Command Beacon", 349, Rarity.RARE, mage.cards.c.CommandBeacon.class)); cards.add(new SetCardInfo("Command Tower", 350, Rarity.COMMON, mage.cards.c.CommandTower.class)); cards.add(new SetCardInfo("Commander's Sphere", 306, Rarity.COMMON, mage.cards.c.CommandersSphere.class));