[C21] updated Laelia, the Blade Reforged to match errata

This commit is contained in:
Evan Kranzler 2021-06-12 13:53:00 -04:00
parent c3f4e3cc1b
commit ff2d96fcb2

View file

@ -6,14 +6,19 @@ import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.common.ExileTopXMayPlayUntilEndOfTurnEffect; import mage.abilities.effects.common.ExileTopXMayPlayUntilEndOfTurnEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeGroupEvent; import mage.game.events.ZoneChangeGroupEvent;
import java.util.Objects;
import java.util.UUID; import java.util.UUID;
/** /**
@ -53,7 +58,7 @@ public final class LaeliaTheBladeReforged extends CardImpl {
class LaeliaTheBladeReforgedAddCountersTriggeredAbility extends TriggeredAbilityImpl { class LaeliaTheBladeReforgedAddCountersTriggeredAbility extends TriggeredAbilityImpl {
LaeliaTheBladeReforgedAddCountersTriggeredAbility() { LaeliaTheBladeReforgedAddCountersTriggeredAbility() {
super(Zone.BATTLEFIELD, null, false); super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false);
} }
LaeliaTheBladeReforgedAddCountersTriggeredAbility(final LaeliaTheBladeReforgedAddCountersTriggeredAbility ability) { LaeliaTheBladeReforgedAddCountersTriggeredAbility(final LaeliaTheBladeReforgedAddCountersTriggeredAbility ability) {
@ -73,42 +78,19 @@ class LaeliaTheBladeReforgedAddCountersTriggeredAbility extends TriggeredAbility
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeGroupEvent zEvent = (ZoneChangeGroupEvent) event; ZoneChangeGroupEvent zEvent = (ZoneChangeGroupEvent) event;
if (zEvent != null return zEvent.getToZone() == Zone.EXILED
&& Zone.HAND == zEvent.getFromZone() && (zEvent.getFromZone() == Zone.LIBRARY || zEvent.getFromZone() == Zone.GRAVEYARD)
&& Zone.EXILED == zEvent.getToZone() && game
&& zEvent.getCards() != null) { .getCards()
int cardCount = 0; .stream()
cardCount = zEvent.getCards().stream().filter((card) .filter(Objects::nonNull)
-> (card != null && card.isOwnedBy(getControllerId()))).map((_item) .map(Card::getOwnerId)
-> 1).reduce(cardCount, Integer::sum); .anyMatch(this::isControlledBy);
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 @Override
public String getRule() { 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."; return "Whenever one or more cards are put into exile from your library " +
"and/or your graveyard, put a +1/+1 counter on {this}.";
} }
} }