From 5107c4a623ff8176af897052d4f98b16b645002e Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 15 Jan 2021 09:25:28 -0500 Subject: [PATCH] [KHM] Implemented Axgard Armory --- Mage.Sets/src/mage/cards/a/AxgardArmory.java | 100 ++++++++++++++++++ .../src/mage/cards/c/CorpseHarvester.java | 12 +-- Mage.Sets/src/mage/sets/Kaldheim.java | 1 + 3 files changed, 107 insertions(+), 6 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/a/AxgardArmory.java diff --git a/Mage.Sets/src/mage/cards/a/AxgardArmory.java b/Mage.Sets/src/mage/cards/a/AxgardArmory.java new file mode 100644 index 0000000000..7e0b26526d --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AxgardArmory.java @@ -0,0 +1,100 @@ +package mage.cards.a; + +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTappedAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.common.SubTypeAssignment; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.abilities.mana.WhiteManaAbility; +import mage.cards.*; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.filter.FilterCard; +import mage.filter.predicate.Predicates; +import mage.game.Game; +import mage.target.common.TargetCardInLibrary; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class AxgardArmory extends CardImpl { + + public AxgardArmory(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.LAND}, ""); + + + // Axgard Armory enters the battlefield tapped. + this.addAbility(new EntersBattlefieldTappedAbility()); + + // {T}: Add {W}. + this.addAbility(new WhiteManaAbility()); + + // {1}{R}{R}{W}, {T}: Sacrifice Axgard Armory: Search your library for an Aura card and/or Equipment card, reveal them, put them into your hand, then shuffle your library. + Ability ability = new SimpleActivatedAbility(new SearchLibraryPutInHandEffect( + new AxgardArmoryTarget()), new ManaCostsImpl("{1}{R}{R}{W}") + ); + ability.addCost(new TapSourceCost()); + ability.addCost(new SacrificeSourceCost()); + this.addAbility(ability); + } + + private AxgardArmory(final AxgardArmory card) { + super(card); + } + + @Override + public AxgardArmory copy() { + return new AxgardArmory(this); + } +} + +class AxgardArmoryTarget extends TargetCardInLibrary { + + private static final FilterCard filter + = new FilterCard("an Aura card and/or an Equipment card"); + + static { + filter.add(Predicates.or( + SubType.AURA.getPredicate(), + SubType.EQUIPMENT.getPredicate() + )); + } + + private static final SubTypeAssignment subTypeAssigner + = new SubTypeAssignment(SubType.AURA, SubType.EQUIPMENT); + + AxgardArmoryTarget() { + super(0, 2, filter); + } + + private AxgardArmoryTarget(final AxgardArmoryTarget target) { + super(target); + } + + @Override + public AxgardArmoryTarget copy() { + return new AxgardArmoryTarget(this); + } + + @Override + public boolean canTarget(UUID playerId, UUID id, Ability source, Game game) { + if (!super.canTarget(playerId, id, source, game)) { + return false; + } + Card card = game.getCard(id); + if (card == null) { + return false; + } + if (this.getTargets().isEmpty()) { + return true; + } + Cards cards = new CardsImpl(this.getTargets()); + cards.add(card); + return subTypeAssigner.getRoleCount(cards, game) >= cards.size(); + } +} diff --git a/Mage.Sets/src/mage/cards/c/CorpseHarvester.java b/Mage.Sets/src/mage/cards/c/CorpseHarvester.java index 55d9260b7d..a07e82188f 100644 --- a/Mage.Sets/src/mage/cards/c/CorpseHarvester.java +++ b/Mage.Sets/src/mage/cards/c/CorpseHarvester.java @@ -36,7 +36,7 @@ public final class CorpseHarvester extends CardImpl { // {1}{B}, {tap}, Sacrifice a creature: Search your library for a Zombie card and a Swamp card, reveal them, and put them into your hand. Then shuffle your library. Ability ability = new SimpleActivatedAbility(new SearchLibraryPutInHandEffect( - new KrosanVergeTarget(), true + new CorpseHarvesterTarget(), true ), new ManaCostsImpl("{1}{B}")); ability.addCost(new TapSourceCost()); ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT))); @@ -53,7 +53,7 @@ public final class CorpseHarvester extends CardImpl { } } -class KrosanVergeTarget extends TargetCardInLibrary { +class CorpseHarvesterTarget extends TargetCardInLibrary { private static final FilterCard filter = new FilterCard("a Zombie card and a Swamp card"); @@ -68,17 +68,17 @@ class KrosanVergeTarget extends TargetCardInLibrary { private static final SubTypeAssignment subTypeAssigner = new SubTypeAssignment(SubType.ZOMBIE, SubType.SWAMP); - KrosanVergeTarget() { + CorpseHarvesterTarget() { super(0, 2, filter); } - private KrosanVergeTarget(final KrosanVergeTarget target) { + private CorpseHarvesterTarget(final CorpseHarvesterTarget target) { super(target); } @Override - public KrosanVergeTarget copy() { - return new KrosanVergeTarget(this); + public CorpseHarvesterTarget copy() { + return new CorpseHarvesterTarget(this); } @Override diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index db0d606f4d..41ff33f6ac 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -67,6 +67,7 @@ public final class Kaldheim extends ExpansionSet { cards.add(new SetCardInfo("Arctic Treeline", 249, Rarity.COMMON, mage.cards.a.ArcticTreeline.class)); cards.add(new SetCardInfo("Armed and Armored", 379, Rarity.UNCOMMON, mage.cards.a.ArmedAndArmored.class)); cards.add(new SetCardInfo("Augury Raven", 44, Rarity.COMMON, mage.cards.a.AuguryRaven.class)); + cards.add(new SetCardInfo("Axgard Armory", 250, Rarity.UNCOMMON, mage.cards.a.AxgardArmory.class)); cards.add(new SetCardInfo("Axgard Braggart", 1, Rarity.COMMON, mage.cards.a.AxgardBraggart.class)); cards.add(new SetCardInfo("Axgard Cavalry", 121, Rarity.COMMON, mage.cards.a.AxgardCavalry.class)); cards.add(new SetCardInfo("Barkchannel Pathway", 251, Rarity.RARE, mage.cards.b.BarkchannelPathway.class));