From d8718a5fb58096f7fca4e2565436e482db45b3d5 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 28 Oct 2021 20:29:15 -0400 Subject: [PATCH] [VOW] Implemented Apprentice Sharpshooter --- .../mage/cards/a/ApprenticeSharpshooter.java | 41 +++++++++++++ .../src/mage/sets/InnistradCrimsonVow.java | 1 + .../abilities/keyword/TrainingAbility.java | 60 +++++++++++++++++++ Utils/keywords.txt | 1 + Utils/mtg-cards-data.txt | 1 + 5 files changed, 104 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/ApprenticeSharpshooter.java create mode 100644 Mage/src/main/java/mage/abilities/keyword/TrainingAbility.java diff --git a/Mage.Sets/src/mage/cards/a/ApprenticeSharpshooter.java b/Mage.Sets/src/mage/cards/a/ApprenticeSharpshooter.java new file mode 100644 index 00000000000..ba400721286 --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/ApprenticeSharpshooter.java @@ -0,0 +1,41 @@ +package mage.cards.a; + +import java.util.UUID; +import mage.MageInt; +import mage.constants.SubType; +import mage.abilities.keyword.ReachAbility; +import mage.abilities.keyword.TrainingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; + +/** + * + * @author TheElk801 + */ +public final class ApprenticeSharpshooter extends CardImpl { + + public ApprenticeSharpshooter(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.ARCHER); + this.power = new MageInt(1); + this.toughness = new MageInt(4); + + // Reach + this.addAbility(ReachAbility.getInstance()); + + // Training + this.addAbility(new TrainingAbility()); + } + + private ApprenticeSharpshooter(final ApprenticeSharpshooter card) { + super(card); + } + + @Override + public ApprenticeSharpshooter copy() { + return new ApprenticeSharpshooter(this); + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java index 23d1452509d..e0004732a22 100644 --- a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java +++ b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java @@ -31,6 +31,7 @@ public final class InnistradCrimsonVow extends ExpansionSet { this.ratioBoosterMythic = 8; this.numBoosterDoubleFaced = 1; + cards.add(new SetCardInfo("Apprentice Sharpshooter", 185, Rarity.COMMON, mage.cards.a.ApprenticeSharpshooter.class)); cards.add(new SetCardInfo("Dig Up", 197, Rarity.RARE, mage.cards.d.DigUp.class)); cards.add(new SetCardInfo("Forest", 276, Rarity.LAND, mage.cards.basiclands.Forest.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Gluttonous Guest", 114, Rarity.COMMON, mage.cards.g.GluttonousGuest.class)); diff --git a/Mage/src/main/java/mage/abilities/keyword/TrainingAbility.java b/Mage/src/main/java/mage/abilities/keyword/TrainingAbility.java new file mode 100644 index 00000000000..46e6f0fadeb --- /dev/null +++ b/Mage/src/main/java/mage/abilities/keyword/TrainingAbility.java @@ -0,0 +1,60 @@ +package mage.abilities.keyword; + +import mage.MageInt; +import mage.MageObject; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; + +import java.util.Objects; + +/** + * @author TheElk801 + */ +public class TrainingAbility extends TriggeredAbilityImpl { + + public TrainingAbility() { + super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance())); + } + + private TrainingAbility(final TrainingAbility ability) { + super(ability); + } + + @Override + public TrainingAbility copy() { + return new TrainingAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (!game.getCombat().getAttackers().contains(this.getSourceId())) { + return false; + } + Permanent permanent = getSourcePermanentIfItStillExists(game); + return permanent != null && game + .getCombat() + .getAttackers() + .stream() + .map(game::getPermanent) + .filter(Objects::nonNull) + .map(MageObject::getPower) + .mapToInt(MageInt::getValue) + .anyMatch(x -> x > permanent.getPower().getValue()); + } + + @Override + public String getRule() { + return "Training (Whenever this creature attacks with another creature " + + "with greater power, put a +1/+1 counter on this creature.)"; + } +} diff --git a/Utils/keywords.txt b/Utils/keywords.txt index e284069feb9..326fc0790fa 100644 --- a/Utils/keywords.txt +++ b/Utils/keywords.txt @@ -104,6 +104,7 @@ Suspend|number, cost, card| Swampcycling|cost| Swampwalk|new| Totem armor|new| +Training|new| Trample|instance| Tribute|number| Unblockable|new| diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index eb0c286e5dd..1af1da6d4b6 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -43022,6 +43022,7 @@ Gluttonous Guest|Innistrad: Crimson Vow|114|C|{2}{B}|Creature - Vampire|1|4|When Sorin the Mirthless|Innistrad: Crimson Vow|131|M|{2}{B}{B}|Legendary Planeswalker - Sorin|4|+1: Look at the top card of your library. You may reveal that card and put it into your hand. If you do, you lose life equal to its mana value.$−2: Create a 2/3 black Vampire creature token with flying and lifelink.$−7: Sorin the Mirthless deals 13 damage to any target. You gain 13 life.| Voldaren Bloodcaster|Innistrad: Crimson Vow|137|R|{1}{B}|Creature - Vampire Wizard|2|1|Flying$Whenever or another nontoken creature you control dies, create a Blood token.$Whenever you create a Blood token, if you control five or more Blood tokens, transform Voldaren Bloodcaster.| Bloodbat Summoner|Innistrad: Crimson Vow|137|R||Creature - Vampire Wizard|3|3|Flying$At the beginning of combat on your turn, up to one target Blood token you control becomes a 2/2 black Bat creature with flying and haste in addition to its other types.| +Apprentice Sharpshooter|Innistrad: Crimson Vow|185|C|{2}{G}|Creature - Human Archer|1|4|Reach$Training| Dig Up|Innistrad: Crimson Vow|197|R|{G}|Sorcery|||Cleave {1}{B}{B}{G}$Search your library for a [basic land] card, [reveal it,] put it into your hand, then shuffle.| Dorothea, Vengeful Victim|Innistrad: Crimson Vow|235|C|{W}{U}|Legendary Creature - Spirit|4|4|Flying$When Dorothea, Vengeful Victim attacks or blocks, sacrifice it at end of combat.$Disturb {1}{W}{U}| Dorothea's Retribution|Innistrad: Crimson Vow|235|C||Enchantment - Aura|||Enchant creature$Enchanted creature has "Whenever this creature attacks, create a 4/4 white Spirit creature token with flying that's tapped and attacking. Sacrifice that token at end of combat."$If Dorothea's Retribution would be put into a graveyard from anywhere, exile it instead.|