diff --git a/Mage.Sets/src/mage/cards/l/LaeliaTheBladeReforged.java b/Mage.Sets/src/mage/cards/l/LaeliaTheBladeReforged.java new file mode 100644 index 0000000000..ea56e9cc2b --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LaeliaTheBladeReforged.java @@ -0,0 +1,114 @@ +package mage.cards.l; + +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.effects.common.ExileTopXMayPlayUntilEndOfTurnEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeGroupEvent; + +import java.util.UUID; + +/** + * @author jmharmon + */ +public final class LaeliaTheBladeReforged extends CardImpl { + + public LaeliaTheBladeReforged(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.SPIRIT); + this.subtype.add(SubType.WARRIOR); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Haste + this.addAbility(HasteAbility.getInstance()); + + // Whenever Laelia, the Blade Reforged attacks, exile the top card of your library. You may play that card this turn. + this.addAbility(new AttacksTriggeredAbility(new ExileTopXMayPlayUntilEndOfTurnEffect(1), false)); + + // Whenever a spell or ability you control exiles one or more cards from your library and/or your graveyard, put a +1/+1 counter on Laelia. + this.addAbility(new LaeliaTheBladeReforgedAddCountersTriggeredAbility()); + } + + private LaeliaTheBladeReforged(final LaeliaTheBladeReforged card) { + super(card); + } + + @Override + public LaeliaTheBladeReforged copy() { + return new LaeliaTheBladeReforged(this); + } +} + +class LaeliaTheBladeReforgedAddCountersTriggeredAbility extends TriggeredAbilityImpl { + + LaeliaTheBladeReforgedAddCountersTriggeredAbility() { + super(Zone.BATTLEFIELD, null, false); + } + + LaeliaTheBladeReforgedAddCountersTriggeredAbility(final LaeliaTheBladeReforgedAddCountersTriggeredAbility ability) { + super(ability); + } + + @Override + public LaeliaTheBladeReforgedAddCountersTriggeredAbility copy() { + return new LaeliaTheBladeReforgedAddCountersTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ZONE_CHANGE_GROUP; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + ZoneChangeGroupEvent zEvent = (ZoneChangeGroupEvent) event; + if (zEvent != null + && Zone.HAND == zEvent.getFromZone() + && Zone.EXILED == zEvent.getToZone() + && zEvent.getCards() != null) { + int cardCount = 0; + cardCount = zEvent.getCards().stream().filter((card) + -> (card != null && card.isOwnedBy(getControllerId()))).map((_item) + -> 1).reduce(cardCount, Integer::sum); + if (cardCount == 0) { + return false; + } + this.getEffects().clear(); + this.getEffects().add(new AddCountersSourceEffect(CounterType.P1P1.createInstance(1))); + return true; + } + + if (zEvent != null + && Zone.LIBRARY == zEvent.getFromZone() + && Zone.EXILED == zEvent.getToZone() + && zEvent.getCards() != null) { + int cardCount = 0; + cardCount = zEvent.getCards().stream().filter((card) + -> (card != null && card.isOwnedBy(getControllerId()))).map((_item) + -> 1).reduce(cardCount, Integer::sum); + if (cardCount == 0) { + return false; + } + this.getEffects().clear(); + this.getEffects().add(new AddCountersSourceEffect(CounterType.P1P1.createInstance(1))); + return true; + } + return false; + } + + @Override + public String getRule() { + return "Whenever a spell or ability you control exiles one or more cards from your library and/or your graveyard, put a +1/+1 counter on Laelia."; + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2021Edition.java b/Mage.Sets/src/mage/sets/Commander2021Edition.java index 34d00e857f..2315a89ed9 100644 --- a/Mage.Sets/src/mage/sets/Commander2021Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2021Edition.java @@ -217,6 +217,7 @@ public final class Commander2021Edition extends ExpansionSet { 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)); cards.add(new SetCardInfo("Krosan Grip", 198, Rarity.UNCOMMON, mage.cards.k.KrosanGrip.class)); + cards.add(new SetCardInfo("Laelia, the Blade Reforged", 53, Rarity.UNCOMMON, mage.cards.l.LaeliaTheBladeReforged.class)); cards.add(new SetCardInfo("Leyline Prowler", 222, Rarity.UNCOMMON, mage.cards.l.LeylineProwler.class)); cards.add(new SetCardInfo("Living Lore", 121, Rarity.UNCOMMON, mage.cards.l.LivingLore.class)); cards.add(new SetCardInfo("Llanowar Reborn", 296, Rarity.UNCOMMON, mage.cards.l.LlanowarReborn.class));