From e71aea90e8bb850eb574c7b80c93d3496869b811 Mon Sep 17 00:00:00 2001 From: miesma Date: Wed, 19 Apr 2023 15:30:45 +0200 Subject: [PATCH] Implement Kethek, Crucible Goliath (#10108) --- .../mage/cards/k/KethekCrucibleGoliath.java | 103 ++++++++++++++++++ .../src/mage/sets/PhyrexiaAllWillBeOne.java | 2 + 2 files changed, 105 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/k/KethekCrucibleGoliath.java diff --git a/Mage.Sets/src/mage/cards/k/KethekCrucibleGoliath.java b/Mage.Sets/src/mage/cards/k/KethekCrucibleGoliath.java new file mode 100644 index 0000000000..7131b173a6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/k/KethekCrucibleGoliath.java @@ -0,0 +1,103 @@ +package mage.cards.k; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.filter.common.FilterCreatureCard; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ManaValuePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.target.common.TargetControlledPermanent; + +import java.util.UUID; + +/** + * @author miesma + */ +public final class KethekCrucibleGoliath extends CardImpl { + + public KethekCrucibleGoliath(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{R}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.PHYREXIAN); + this.subtype.add(SubType.BEAST); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // At the beginning of your end step, you may sacrifice another creature. + // If you do, reveal cards from the top of your library + // until you reveal a nonlegendary creature card with lesser mana value, put it onto the battlefield, + // then put the rest on the bottom of your library in a random order. + this.addAbility(new BeginningOfEndStepTriggeredAbility( + new KethekCrucibleGoliathEffect(), TargetController.YOU, false + )); + } + + private KethekCrucibleGoliath(final KethekCrucibleGoliath card) { + super(card); + } + + @Override + public KethekCrucibleGoliath copy() { + return new KethekCrucibleGoliath(this); + } +} + +class KethekCrucibleGoliathEffect extends OneShotEffect { + + KethekCrucibleGoliathEffect() { + super(Outcome.Benefit); + staticText = "you may sacrifice another creature. " + + "If you do, reveal cards from the top of your library" + + "until you reveal a nonlegendary creature card with lesser mana value" + + ", put it onto the battlefield, then put the rest on the bottom of your library in a random order."; + } + + private KethekCrucibleGoliathEffect(final mage.cards.k.KethekCrucibleGoliathEffect effect) { + super(effect); + } + + @Override + public mage.cards.k.KethekCrucibleGoliathEffect copy() { + return new mage.cards.k.KethekCrucibleGoliathEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + // May sacrifice another creature + TargetPermanent target = (TargetPermanent) new TargetControlledPermanent( + 0, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, true + ).withChooseHint("to sacrifice"); + player.choose(Outcome.Sacrifice, target, source, game); + Permanent permanent = game.getPermanent(target.getFirstTarget()); + if (permanent == null || !permanent.sacrifice(source, game)) { + return false; + } + // If you do, reveal cards from the top of your library (IF = No second trigger on the Stack) + // until you reveal a nonlegendary creature card with lesser mana value + int xValue = permanent.getManaValue(); + FilterCreatureCard filterCreatureCard = new FilterCreatureCard("nonlegendary creature card with lesser mana value"); + // Nonlegendary + filterCreatureCard.add(Predicates.not(SuperType.LEGENDARY.getPredicate())); + // Lesser Mana Value + filterCreatureCard.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, xValue)); + //put it onto the battlefield, then put the rest on the bottom of your library in a random order. + RevealCardsFromLibraryUntilEffect effect = new RevealCardsFromLibraryUntilEffect(filterCreatureCard, Zone.BATTLEFIELD, Zone.LIBRARY); + effect.apply(game,source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java b/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java index 8edf45e3bd..da1abd1b03 100644 --- a/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java +++ b/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java @@ -128,6 +128,8 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet { cards.add(new SetCardInfo("Karumonix, the Rat King", 98, Rarity.RARE, mage.cards.k.KarumonixTheRatKing.class)); cards.add(new SetCardInfo("Kaya, Intangible Slayer", 205, Rarity.RARE, mage.cards.k.KayaIntangibleSlayer.class)); cards.add(new SetCardInfo("Kemba, Kha Enduring", 19, Rarity.RARE, mage.cards.k.KembaKhaEnduring.class)); + cards.add(new SetCardInfo("Kethek, Crucible Goliath", 206, Rarity.RARE, mage.cards.k.KethekCrucibleGoliath.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Kethek, Crucible Goliath", 319, Rarity.RARE, mage.cards.k.KethekCrucibleGoliath.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Koth, Fire of Resistance", 138, Rarity.RARE, mage.cards.k.KothFireOfResistance.class)); cards.add(new SetCardInfo("Kuldotha Cackler", 139, Rarity.COMMON, mage.cards.k.KuldothaCackler.class)); cards.add(new SetCardInfo("Lattice-Blade Mantis", 173, Rarity.COMMON, mage.cards.l.LatticeBladeMantis.class));