From f7ab073d5e0ec395c5d9730a552005e4970ee2c3 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Tue, 29 Oct 2024 22:06:22 -0400 Subject: [PATCH] [FDN] Implement Alesha, Who Laughs at Fate --- .../mage/cards/a/AleshaWhoLaughsAtFate.java | 90 +++++++++++++++++++ Mage.Sets/src/mage/sets/Foundations.java | 1 + 2 files changed, 91 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/AleshaWhoLaughsAtFate.java diff --git a/Mage.Sets/src/mage/cards/a/AleshaWhoLaughsAtFate.java b/Mage.Sets/src/mage/cards/a/AleshaWhoLaughsAtFate.java new file mode 100644 index 00000000000..9f5b8e5735b --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AleshaWhoLaughsAtFate.java @@ -0,0 +1,90 @@ +package mage.cards.a; + +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.condition.common.RaidCondition; +import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.hint.common.RaidHint; +import mage.abilities.keyword.FirstStrikeAbility; +import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.AbilityWord; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.counters.CounterType; +import mage.filter.FilterCard; +import mage.filter.common.FilterCreatureCard; +import mage.filter.predicate.ObjectSourcePlayer; +import mage.filter.predicate.ObjectSourcePlayerPredicate; +import mage.game.Game; +import mage.target.common.TargetCardInYourGraveyard; +import mage.watchers.common.PlayerAttackedWatcher; + +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class AleshaWhoLaughsAtFate extends CardImpl { + + private static final FilterCard filter = new FilterCreatureCard( + "creature card with mana value less than or equal to {this}'s power from your graveyard" + ); + + static { + filter.add(AleshaWhoLaughsAtFatePredicate.instance); + } + + public AleshaWhoLaughsAtFate(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{R}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WARRIOR); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // First strike + this.addAbility(FirstStrikeAbility.getInstance()); + + // Whenever Alesha attacks, put a +1/+1 counter on it. + this.addAbility(new AttacksTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()))); + + // Raid -- At the beginning of your end step, if you attacked this turn, return target creature card with mana value less than or equal to Alesha's power from your graveyard to the battlefield. + Ability ability = new BeginningOfEndStepTriggeredAbility( + new ReturnFromGraveyardToBattlefieldTargetEffect() + ).withInterveningIf(RaidCondition.instance); + ability.addTarget(new TargetCardInYourGraveyard(filter)); + this.addAbility(ability.setAbilityWord(AbilityWord.RAID).addHint(RaidHint.instance), new PlayerAttackedWatcher()); + } + + private AleshaWhoLaughsAtFate(final AleshaWhoLaughsAtFate card) { + super(card); + } + + @Override + public AleshaWhoLaughsAtFate copy() { + return new AleshaWhoLaughsAtFate(this); + } +} + +enum AleshaWhoLaughsAtFatePredicate implements ObjectSourcePlayerPredicate { + instance; + + @Override + public boolean apply(ObjectSourcePlayer input, Game game) { + return Optional + .ofNullable(input.getSource().getSourcePermanentOrLKI(game)) + .map(MageObject::getPower) + .map(MageInt::getValue) + .map(p -> input.getObject().getPower().getValue() <= p) + .orElse(false); + } +} diff --git a/Mage.Sets/src/mage/sets/Foundations.java b/Mage.Sets/src/mage/sets/Foundations.java index 72ef83b9eef..bf1704b9ff0 100644 --- a/Mage.Sets/src/mage/sets/Foundations.java +++ b/Mage.Sets/src/mage/sets/Foundations.java @@ -26,6 +26,7 @@ public final class Foundations extends ExpansionSet { cards.add(new SetCardInfo("Aetherize", 151, Rarity.UNCOMMON, mage.cards.a.Aetherize.class)); cards.add(new SetCardInfo("Ajani's Pridemate", 135, Rarity.UNCOMMON, mage.cards.a.AjanisPridemate.class)); cards.add(new SetCardInfo("Ajani, Caller of the Pride", 134, Rarity.MYTHIC, mage.cards.a.AjaniCallerOfThePride.class)); + cards.add(new SetCardInfo("Alesha, Who Laughs at Fate", 115, Rarity.RARE, mage.cards.a.AleshaWhoLaughsAtFate.class)); cards.add(new SetCardInfo("An Offer You Can't Refuse", 160, Rarity.UNCOMMON, mage.cards.a.AnOfferYouCantRefuse.class)); cards.add(new SetCardInfo("Angel of Finality", 136, Rarity.RARE, mage.cards.a.AngelOfFinality.class)); cards.add(new SetCardInfo("Angel of Vitality", 706, Rarity.UNCOMMON, mage.cards.a.AngelOfVitality.class));