From 4b0b30f47128c980d417d4b093de331ce5c81b7d Mon Sep 17 00:00:00 2001 From: theelk801 Date: Wed, 3 May 2023 10:02:23 -0400 Subject: [PATCH] [MAT] Implement Ayara's Oathsworn --- .../src/mage/cards/a/AyarasOathsworn.java | 63 +++++++++++++++++++ .../sets/MarchOfTheMachineTheAftermath.java | 1 + 2 files changed, 64 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/AyarasOathsworn.java diff --git a/Mage.Sets/src/mage/cards/a/AyarasOathsworn.java b/Mage.Sets/src/mage/cards/a/AyarasOathsworn.java new file mode 100644 index 0000000000..d64ee91bc8 --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AyarasOathsworn.java @@ -0,0 +1,63 @@ +package mage.cards.a; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; +import mage.abilities.condition.Condition; +import mage.abilities.condition.common.SourceHasCounterCondition; +import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.abilities.keyword.MenaceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.target.common.TargetCardInLibrary; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class AyarasOathsworn extends CardImpl { + + private static final Condition condition1 = new SourceHasCounterCondition(CounterType.P1P1, 0, 3); + private static final Condition condition2 = new SourceHasCounterCondition(CounterType.P1P1, 4, 4); + + public AyarasOathsworn(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.KNIGHT); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Menace + this.addAbility(new MenaceAbility()); + + // Whenever Ayara's Oathsworn deals combat damage to a player, if it has fewer than four +1/+1 counters on it, put a +1/+1 counter on it. Then if it has exactly four +1/+1 counters on it, search your library for a card, put it into your hand, then shuffle. + Ability ability = new ConditionalInterveningIfTriggeredAbility( + new DealsCombatDamageToAPlayerTriggeredAbility( + new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false + ), condition1, "Whenever {this} deals combat damage to a player, if it has fewer than four " + + "+1/+1 counters on it, put a +1/+1 counter on it. Then if it has exactly four +1/+1 counters on it, " + + "search your library for a card, put it into your hand, then shuffle." + ); + ability.addEffect(new ConditionalOneShotEffect( + new SearchLibraryPutInHandEffect(new TargetCardInLibrary()), condition2 + )); + this.addAbility(ability); + } + + private AyarasOathsworn(final AyarasOathsworn card) { + super(card); + } + + @Override + public AyarasOathsworn copy() { + return new AyarasOathsworn(this); + } +} diff --git a/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java b/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java index 77e0d26d52..abe72068e8 100644 --- a/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java +++ b/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java @@ -21,6 +21,7 @@ public final class MarchOfTheMachineTheAftermath extends ExpansionSet { this.hasBasicLands = false; this.hasBoosters = false; // temporary + cards.add(new SetCardInfo("Ayara's Oathsworn", 11, Rarity.RARE, mage.cards.a.AyarasOathsworn.class)); cards.add(new SetCardInfo("Campus Renovation", 27, Rarity.UNCOMMON, mage.cards.c.CampusRenovation.class)); cards.add(new SetCardInfo("Coppercoat Vanguard", 1, Rarity.UNCOMMON, mage.cards.c.CoppercoatVanguard.class)); cards.add(new SetCardInfo("Cosmic Rebirth", 28, Rarity.UNCOMMON, mage.cards.c.CosmicRebirth.class));