From 60768e07e136ce42524cb17aa3a6a1cf26d0f1fa Mon Sep 17 00:00:00 2001 From: theelk801 Date: Sat, 3 Jun 2023 10:32:43 -0400 Subject: [PATCH] [LTR] Implement Legolas, Counter of Kills --- .../mage/cards/l/LegolasCounterOfKills.java | 101 ++++++++++++++++++ .../TheLordOfTheRingsTalesOfMiddleEarth.java | 1 + 2 files changed, 102 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/l/LegolasCounterOfKills.java diff --git a/Mage.Sets/src/mage/cards/l/LegolasCounterOfKills.java b/Mage.Sets/src/mage/cards/l/LegolasCounterOfKills.java new file mode 100644 index 0000000000..a5c58726c5 --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LegolasCounterOfKills.java @@ -0,0 +1,101 @@ +package mage.cards.l; + +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.DiesCreatureTriggeredAbility; +import mage.abilities.effects.common.UntapSourceEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.ReachAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; + +import java.util.Objects; +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class LegolasCounterOfKills extends CardImpl { + + public LegolasCounterOfKills(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{U}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.ELF); + this.subtype.add(SubType.ARCHER); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Reach + this.addAbility(ReachAbility.getInstance()); + + // Whenever you scry, if Legolas, Counter of Kills is tapped, you may untap it. Do this only once each turn. + this.addAbility(new LegolasCounterOfKillsTriggeredAbility()); + + // Whenever a creature an opponent controls dies, put a +1/+1 counter on Legolas. + this.addAbility(new DiesCreatureTriggeredAbility( + new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false, + StaticFilters.FILTER_OPPONENTS_PERMANENT_A_CREATURE + )); + } + + private LegolasCounterOfKills(final LegolasCounterOfKills card) { + super(card); + } + + @Override + public LegolasCounterOfKills copy() { + return new LegolasCounterOfKills(this); + } +} + +class LegolasCounterOfKillsTriggeredAbility extends TriggeredAbilityImpl { + + LegolasCounterOfKillsTriggeredAbility() { + super(Zone.BATTLEFIELD, new UntapSourceEffect(), true); + this.setDoOnlyOnce(true); + } + + private LegolasCounterOfKillsTriggeredAbility(final LegolasCounterOfKillsTriggeredAbility ability) { + super(ability); + } + + @Override + public LegolasCounterOfKillsTriggeredAbility copy() { + return new LegolasCounterOfKillsTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.SCRIED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return isControlledBy(event.getPlayerId()); + } + + @Override + public boolean checkInterveningIfClause(Game game) { + return Optional + .ofNullable(this.getSourcePermanentIfItStillExists(game)) + .filter(Objects::nonNull) + .map(Permanent::isTapped) + .orElse(false); + } + + @Override + public String getRule() { + return "Whenever you scry, if Legolas, Counter of Kills is tapped, you may untap it. Do this only once each turn."; + } +} diff --git a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java index 236c563b6e..236cd5fcf2 100644 --- a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java +++ b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java @@ -61,6 +61,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet { cards.add(new SetCardInfo("Knight of the Keep", 291, Rarity.COMMON, mage.cards.k.KnightOfTheKeep.class)); cards.add(new SetCardInfo("Knights of Dol Amroth", 59, Rarity.COMMON, mage.cards.k.KnightsOfDolAmroth.class)); cards.add(new SetCardInfo("Last March of the Ents", 172, Rarity.MYTHIC, mage.cards.l.LastMarchOfTheEnts.class)); + cards.add(new SetCardInfo("Legolas, Counter of Kills", 212, Rarity.UNCOMMON, mage.cards.l.LegolasCounterOfKills.class)); cards.add(new SetCardInfo("Lobelia Sackville-Baggins", 93, Rarity.RARE, mage.cards.l.LobeliaSackvilleBaggins.class)); cards.add(new SetCardInfo("Long List of the Ents", 174, Rarity.UNCOMMON, mage.cards.l.LongListOfTheEnts.class)); cards.add(new SetCardInfo("Lotho, Corrupt Shirriff", 213, Rarity.RARE, mage.cards.l.LothoCorruptShirriff.class));