From 2efa8e43566336897e00be4a5794d34c25ccb994 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 19 Jan 2021 09:30:04 -0500 Subject: [PATCH] [KHM] Implemented Svella, Ice Shaper --- .../src/mage/cards/s/SvellaIceShaper.java | 109 ++++++++++++++++++ Mage.Sets/src/mage/sets/Kaldheim.java | 1 + .../permanent/token/IcyManalithToken.java | 26 +++++ 3 files changed, 136 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/SvellaIceShaper.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/IcyManalithToken.java diff --git a/Mage.Sets/src/mage/cards/s/SvellaIceShaper.java b/Mage.Sets/src/mage/cards/s/SvellaIceShaper.java new file mode 100644 index 00000000000..8b7437056d1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SvellaIceShaper.java @@ -0,0 +1,109 @@ +package mage.cards.s; + +import mage.ApprovingObject; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.cards.*; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.filter.common.FilterNonlandCard; +import mage.game.Game; +import mage.game.permanent.token.IcyManalithToken; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInLibrary; + +import java.util.Set; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SvellaIceShaper extends CardImpl { + + public SvellaIceShaper(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{G}"); + + this.addSuperType(SuperType.LEGENDARY); + this.addSuperType(SuperType.SNOW); + this.subtype.add(SubType.TROLL); + this.subtype.add(SubType.WARRIOR); + this.power = new MageInt(2); + this.toughness = new MageInt(4); + + // {3}, {T}: Create a colorless snow artifact token named Icy Manalith with "{T}: Add one mana of any color." + Ability ability = new SimpleActivatedAbility( + new CreateTokenEffect(new IcyManalithToken()), new GenericManaCost(3) + ); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + + // {6}{R}{G}, {T}: Look at the top four cards of your library. You may cast a spell from among them without paying its mana cost. Put the rest on the bottom of your library in a random order. + ability = new SimpleActivatedAbility(new SvellaIceShaperEffect(), new ManaCostsImpl("{6}{R}{G}")); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + } + + private SvellaIceShaper(final SvellaIceShaper card) { + super(card); + } + + @Override + public SvellaIceShaper copy() { + return new SvellaIceShaper(this); + } +} + +class SvellaIceShaperEffect extends OneShotEffect { + + SvellaIceShaperEffect() { + super(Outcome.Benefit); + staticText = "Look at the top four cards of your library." + + " You may cast a spell from among them without paying its mana cost. " + + "Put the rest on the bottom of your library in a random order."; + } + + private SvellaIceShaperEffect(final SvellaIceShaperEffect effect) { + super(effect); + } + + @Override + public SvellaIceShaperEffect copy() { + return new SvellaIceShaperEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + Set cardsSet = controller.getLibrary().getTopCards(game, 4); + Cards cards = new CardsImpl(cardsSet); + TargetCard target = new TargetCardInLibrary(0, 1, + new FilterNonlandCard("card to cast without paying its mana cost")); + controller.choose(Outcome.PlayForFree, cards, target, game); + Card card = controller.getLibrary().getCard(target.getFirstTarget(), game); + if (card == null) { + controller.putCardsOnBottomOfLibrary(cards, game, source, false); + return true; + } + game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE); + Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true), + game, true, new ApprovingObject(source, game)); + game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null); + if (cardWasCast) { + cards.remove(card); + } + controller.putCardsOnBottomOfLibrary(cards, game, source, false); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index 5955b92e9b3..5507aa8ab5d 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -283,6 +283,7 @@ public final class Kaldheim extends ExpansionSet { cards.add(new SetCardInfo("Surtland Elementalist", 375, Rarity.RARE, mage.cards.s.SurtlandElementalist.class)); cards.add(new SetCardInfo("Surtland Flinger", 377, Rarity.RARE, mage.cards.s.SurtlandFlinger.class)); cards.add(new SetCardInfo("Surtland Frostpyre", 271, Rarity.UNCOMMON, mage.cards.s.SurtlandFrostpyre.class)); + cards.add(new SetCardInfo("Svella, Ice Shaper", 230, Rarity.UNCOMMON, mage.cards.s.SvellaIceShaper.class)); cards.add(new SetCardInfo("Swamp", 396, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Tergrid's Shadow", 113, Rarity.UNCOMMON, mage.cards.t.TergridsShadow.class)); cards.add(new SetCardInfo("The Bloodsky Massacre", 207, Rarity.RARE, mage.cards.t.TheBloodskyMassacre.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/IcyManalithToken.java b/Mage/src/main/java/mage/game/permanent/token/IcyManalithToken.java new file mode 100644 index 00000000000..7a4810942a2 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/IcyManalithToken.java @@ -0,0 +1,26 @@ +package mage.game.permanent.token; + +import mage.abilities.mana.AnyColorManaAbility; +import mage.constants.CardType; +import mage.constants.SuperType; + +/** + * @author TheElk801 + */ +public final class IcyManalithToken extends TokenImpl { + + public IcyManalithToken() { + super("Icy Manalith", "colorless snow artifact token named Icy Manalith with \"{T}: Add one mana of any color.\""); + this.addSuperType(SuperType.LEGENDARY); + cardType.add(CardType.ARTIFACT); + this.addAbility(new AnyColorManaAbility()); + } + + private IcyManalithToken(final IcyManalithToken token) { + super(token); + } + + public IcyManalithToken copy() { + return new IcyManalithToken(this); + } +}