From 19eeadffda29c71440f3bee89617f35f2abd5650 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 3 Oct 2022 22:25:15 -0400 Subject: [PATCH] [40K] Implemented Tomb Fortress --- Mage.Sets/src/mage/cards/t/TombFortress.java | 93 ++++++++++++++++++++ Mage.Sets/src/mage/sets/Warhammer40000.java | 1 + 2 files changed, 94 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/TombFortress.java diff --git a/Mage.Sets/src/mage/cards/t/TombFortress.java b/Mage.Sets/src/mage/cards/t/TombFortress.java new file mode 100644 index 00000000000..f8124f47672 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TombFortress.java @@ -0,0 +1,93 @@ +package mage.cards.t; + +import mage.abilities.Ability; +import mage.abilities.common.ActivateAsSorceryActivatedAbility; +import mage.abilities.common.EntersBattlefieldTappedAbility; +import mage.abilities.costs.common.ExileSourceCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.mana.BlackManaAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInYourGraveyard; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TombFortress extends CardImpl { + + public TombFortress(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.LAND}, ""); + + // Tomb Fortress enters the battlefield tapped. + this.addAbility(new EntersBattlefieldTappedAbility()); + + // {T}: Add {B}. + this.addAbility(new BlackManaAbility()); + + // {2}{B}{B}{B}, {T}, Exile Tomb Fortress: Mill four cards, then return a creature card from your graveyard to the battlefield. Activate only as a sorcery. + Ability ability = new ActivateAsSorceryActivatedAbility( + new TombFortressEffect(), new ManaCostsImpl<>("{2}{B}{B}{B}") + ); + ability.addCost(new TapSourceCost()); + ability.addCost(new ExileSourceCost()); + this.addAbility(ability); + } + + private TombFortress(final TombFortress card) { + super(card); + } + + @Override + public TombFortress copy() { + return new TombFortress(this); + } +} + +class TombFortressEffect extends OneShotEffect { + + TombFortressEffect() { + super(Outcome.Benefit); + staticText = "mill four cards, then return a creature card from your graveyard to the battlefield"; + } + + private TombFortressEffect(final TombFortressEffect effect) { + super(effect); + } + + @Override + public TombFortressEffect copy() { + return new TombFortressEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + player.millCards(4, source, game); + TargetCard target = new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD); + target.setNotTarget(true); + if (!target.canChoose(source.getControllerId(), source, game)) { + return true; + } + player.choose(outcome, target, source, game); + Card card = game.getCard(target.getFirstTarget()); + if (card != null) { + player.moveCards(card, Zone.BATTLEFIELD, source, game); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Warhammer40000.java b/Mage.Sets/src/mage/sets/Warhammer40000.java index 6e4271038ac..941770755d9 100644 --- a/Mage.Sets/src/mage/sets/Warhammer40000.java +++ b/Mage.Sets/src/mage/sets/Warhammer40000.java @@ -212,6 +212,7 @@ public final class Warhammer40000 extends ExpansionSet { cards.add(new SetCardInfo("Thought Vessel", 259, Rarity.COMMON, mage.cards.t.ThoughtVessel.class)); cards.add(new SetCardInfo("Thunderhawk Gunship", 167, Rarity.RARE, mage.cards.t.ThunderhawkGunship.class)); cards.add(new SetCardInfo("Thunderwolf Cavalry", 16, Rarity.UNCOMMON, mage.cards.t.ThunderwolfCavalry.class)); + cards.add(new SetCardInfo("Tomb Fortress", 168, Rarity.RARE, mage.cards.t.TombFortress.class)); cards.add(new SetCardInfo("Tranquil Cove", 303, Rarity.COMMON, mage.cards.t.TranquilCove.class)); cards.add(new SetCardInfo("Triarch Praetorian", 66, Rarity.UNCOMMON, mage.cards.t.TriarchPraetorian.class)); cards.add(new SetCardInfo("Trygon Prime", 143, Rarity.UNCOMMON, mage.cards.t.TrygonPrime.class));