[C21] Implement Laelia, the Blade Reforged (#7831)

* [C21] Implement Laelia, the Blade Reforged

* [C21] Implement Laelia, the Blade Reforged
This commit is contained in:
jmharmon 2021-05-20 18:47:56 -07:00 committed by GitHub
parent a87476bd5b
commit d1a798371c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 115 additions and 0 deletions

View file

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

View file

@ -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("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("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("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("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("Living Lore", 121, Rarity.UNCOMMON, mage.cards.l.LivingLore.class));
cards.add(new SetCardInfo("Llanowar Reborn", 296, Rarity.UNCOMMON, mage.cards.l.LlanowarReborn.class)); cards.add(new SetCardInfo("Llanowar Reborn", 296, Rarity.UNCOMMON, mage.cards.l.LlanowarReborn.class));