From 9f4ead9201a92afe7c4c076744ef6bb01d1cdd11 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Wed, 3 May 2023 08:25:25 -0400 Subject: [PATCH] [MAT] Implement Kiora, Sovereign of the Deep --- .../mage/cards/k/KioraSovereignOfTheDeep.java | 107 ++++++++++++++++++ .../sets/MarchOfTheMachineTheAftermath.java | 1 + 2 files changed, 108 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/k/KioraSovereignOfTheDeep.java diff --git a/Mage.Sets/src/mage/cards/k/KioraSovereignOfTheDeep.java b/Mage.Sets/src/mage/cards/k/KioraSovereignOfTheDeep.java new file mode 100644 index 0000000000..6211efbedf --- /dev/null +++ b/Mage.Sets/src/mage/cards/k/KioraSovereignOfTheDeep.java @@ -0,0 +1,107 @@ +package mage.cards.k; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.VigilanceAbility; +import mage.abilities.keyword.WardAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.FilterSpell; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ManaValuePredicate; +import mage.game.Game; +import mage.game.stack.Spell; +import mage.players.Player; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class KioraSovereignOfTheDeep extends CardImpl { + + private static final FilterSpell filter = new FilterSpell(""); + + static { + filter.add(Predicates.or( + SubType.KRAKEN.getPredicate(), + SubType.LEVIATHAN.getPredicate(), + SubType.OCTOPUS.getPredicate(), + SubType.SERPENT.getPredicate() + )); + } + + public KioraSovereignOfTheDeep(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{U}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.MERFOLK); + this.subtype.add(SubType.NOBLE); + this.power = new MageInt(4); + this.toughness = new MageInt(5); + + // Vigilance + this.addAbility(VigilanceAbility.getInstance()); + + // Ward {3} + this.addAbility(new WardAbility(new ManaCostsImpl<>("{3}"))); + + // Whenever you cast a Kraken, Leviathan, Octopus, or Serpent spell from your hand, look at the top X cards of your library, where X is that spell's mana value. You may cast a spell with mana value less than X from among them without paying its mana cost. Put the rest on the bottom of your library in a random order. + this.addAbility(new SpellCastControllerTriggeredAbility( + new KioraSovereignOfTheDeepEffect(), filter, false, Zone.HAND + )); + } + + private KioraSovereignOfTheDeep(final KioraSovereignOfTheDeep card) { + super(card); + } + + @Override + public KioraSovereignOfTheDeep copy() { + return new KioraSovereignOfTheDeep(this); + } +} + +class KioraSovereignOfTheDeepEffect extends OneShotEffect { + + KioraSovereignOfTheDeepEffect() { + super(Outcome.Benefit); + staticText = "look at the top X cards of your library, where X is that spell's mana value. " + + "You may cast a spell with mana value less than X from among them without " + + "paying its mana cost. Put the rest on the bottom of your library in a random order"; + } + + private KioraSovereignOfTheDeepEffect(final KioraSovereignOfTheDeepEffect effect) { + super(effect); + } + + @Override + public KioraSovereignOfTheDeepEffect copy() { + return new KioraSovereignOfTheDeepEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Spell spell = (Spell) getValue("spellCast"); + if (player == null || spell == null || spell.getManaValue() < 1) { + return false; + } + int xValue = spell.getManaValue(); + Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, xValue)); + FilterCard filter = new FilterCard(); + filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, xValue)); + CardUtil.castSpellWithAttributesForFree(player, source, game, cards, filter); + cards.retainZone(Zone.LIBRARY, game); + player.putCardsOnBottomOfLibrary(cards, game, source, false); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java b/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java index f20a6f2dd4..0065078ea3 100644 --- a/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java +++ b/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java @@ -28,6 +28,7 @@ public final class MarchOfTheMachineTheAftermath extends ExpansionSet { cards.add(new SetCardInfo("Gold-Forged Thopteryx", 31, Rarity.UNCOMMON, mage.cards.g.GoldForgedThopteryx.class)); cards.add(new SetCardInfo("Harnessed Snubhorn", 3, Rarity.UNCOMMON, mage.cards.h.HarnessedSnubhorn.class)); cards.add(new SetCardInfo("Jolrael, Voice of Zhalfir", 33, Rarity.RARE, mage.cards.j.JolraelVoiceOfZhalfir.class)); + cards.add(new SetCardInfo("Kiora, Sovereign of the Deep", 35, Rarity.MYTHIC, mage.cards.k.KioraSovereignOfTheDeep.class)); cards.add(new SetCardInfo("Kolaghan Warmonger", 17, Rarity.UNCOMMON, mage.cards.k.KolaghanWarmonger.class)); cards.add(new SetCardInfo("Markov Baron", 14, Rarity.UNCOMMON, mage.cards.m.MarkovBaron.class)); cards.add(new SetCardInfo("Metropolis Reformer", 4, Rarity.RARE, mage.cards.m.MetropolisReformer.class));