From 96cb6b86736456a070e3f0d6ccd170078ddcfefb Mon Sep 17 00:00:00 2001 From: Susucre <34709007+Susucre@users.noreply.github.com> Date: Tue, 18 Jul 2023 02:02:31 +0200 Subject: [PATCH] [LTR] Implement Gollum, Scheming Guide (#10618) --- .../src/mage/cards/g/GollumSchemingGuide.java | 134 ++++++++++++++++++ .../TheLordOfTheRingsTalesOfMiddleEarth.java | 1 + 2 files changed, 135 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GollumSchemingGuide.java diff --git a/Mage.Sets/src/mage/cards/g/GollumSchemingGuide.java b/Mage.Sets/src/mage/cards/g/GollumSchemingGuide.java new file mode 100644 index 00000000000..20f46e878f2 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GollumSchemingGuide.java @@ -0,0 +1,134 @@ +package mage.cards.g; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect; +import mage.cards.*; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetOpponent; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class GollumSchemingGuide extends CardImpl { + + public GollumSchemingGuide(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.HALFLING); + this.subtype.add(SubType.HORROR); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Whenever Gollum, Scheming Guide attacks, look at the top two cards of your library, put them back in any order, then choose land or nonland. An opponent guesses whether the top card of your library is the chosen kind. Reveal that card. If they guessed right, remove Gollum from combat. Otherwise, you draw a card and Gollum can't be blocked this turn. + this.addAbility(new AttacksTriggeredAbility(new GollumSchemingGuideEffect())); + } + + private GollumSchemingGuide(final GollumSchemingGuide card) { + super(card); + } + + @Override + public GollumSchemingGuide copy() { + return new GollumSchemingGuide(this); + } +} + +class GollumSchemingGuideEffect extends OneShotEffect { + + GollumSchemingGuideEffect() { + super(Outcome.Benefit); + this.staticText = "look at the top two cards of your library, " + + "put them back in any order, then choose land or nonland. " + + "An opponent guesses whether the top card of your library " + + "is the chosen kind. Reveal that card. If they guessed right, " + + "remove {this} from combat. Otherwise, you draw a card and {this} " + + "can't be blocked this turn"; + } + + private GollumSchemingGuideEffect(final GollumSchemingGuideEffect effect) { + super(effect); + } + + @Override + public GollumSchemingGuideEffect copy() { + return new GollumSchemingGuideEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + + Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 2)); + // look at the top two cards of your library, + player.lookAtCards(source, null, cards, game); + // put them back in any order + PutCards.TOP_ANY.moveCards(player, cards, source, game); + + // then choose land or nonland. + boolean guessLand = player.chooseUse(Outcome.Neutral, + "Choose land or nonland (opponent must then guess)", + "", "land", "nonland", source, game); + + // choose an opponent. + TargetOpponent targetOpponent = new TargetOpponent(true); + if (!player.choose(Outcome.Neutral, targetOpponent, source, game)) { + return false; + } + + Player opponent = game.getPlayer(targetOpponent.getFirstTarget()); + if (opponent == null) { + return false; + } + + String textGuess = guessLand ? "land" : "nonland"; + + FilterCard filter = guessLand + ? StaticFilters.FILTER_CARD_LAND + : StaticFilters.FILTER_CARD_NON_LAND; + + // An opponent guesses whether the top card of your library is the chosen kind. + boolean guessOpp = opponent.chooseUse(Outcome.Neutral, + "Is the top card of " + player.getLogName() + "'s library a " + textGuess + " card?", source, game); + + // End of the choices, last check on whether the player still exist. + Card card = player.getLibrary().getFromTop(game); + player.revealCards(source, new CardsImpl(card), game); + + if (card != null && (filter.match(card, player.getId(), source, game) == guessOpp)) { + game.informPlayers(opponent.getLogName() + " guessed right."); + + // remove Gollum from combat. + Permanent gollum = source.getSourcePermanentIfItStillExists(game); + if (gollum != null) { + gollum.removeFromCombat(game); + } + } else { + game.informPlayers(opponent.getLogName() + " guessed wrong."); + + // you draw a card + player.drawCards(1, source, game); + + // and Gollum can't be blocked this turn + Permanent gollum = source.getSourcePermanentIfItStillExists(game); + if (gollum != null) { + game.addEffect(new CantBeBlockedSourceEffect(Duration.EndOfTurn), source); + } + } + + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java index 4b7d278633f..bd84ac9aba5 100644 --- a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java +++ b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java @@ -127,6 +127,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet { cards.add(new SetCardInfo("Goblin Fireleaper", 133, Rarity.UNCOMMON, mage.cards.g.GoblinFireleaper.class)); cards.add(new SetCardInfo("Gollum's Bite", 85, Rarity.UNCOMMON, mage.cards.g.GollumsBite.class)); cards.add(new SetCardInfo("Gollum, Patient Plotter", 84, Rarity.UNCOMMON, mage.cards.g.GollumPatientPlotter.class)); + cards.add(new SetCardInfo("Gollum, Scheming Guide", 292, Rarity.RARE, mage.cards.g.GollumSchemingGuide.class)); cards.add(new SetCardInfo("Gorbag of Minas Morgul", 86, Rarity.UNCOMMON, mage.cards.g.GorbagOfMinasMorgul.class)); cards.add(new SetCardInfo("Gothmog, Morgul Lieutenant", 87, Rarity.UNCOMMON, mage.cards.g.GothmogMorgulLieutenant.class)); cards.add(new SetCardInfo("Great Hall of the Citadel", 254, Rarity.COMMON, mage.cards.g.GreatHallOfTheCitadel.class));