Skip to content

Commit

Permalink
[LTR] Implement Sméagol, Helpful Guide (#10514)
Browse files Browse the repository at this point in the history
  • Loading branch information
Susucre authored Jun 23, 2023
1 parent 0255761 commit cd25bd9
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 0 deletions.
109 changes: 109 additions & 0 deletions Mage.Sets/src/mage/cards/s/SmeagolHelpfulGuide.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
package mage.cards.s;

import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.TheRingTemptsYouTriggeredAbility;
import mage.abilities.condition.common.CreatureDiedControlledCondition;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.keyword.TheRingTemptsYouEffect;
import mage.cards.Card;
import mage.cards.CardsImpl;
import mage.constants.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetOpponent;

/**
*
* @author Susucr
*/
public final class SmeagolHelpfulGuide extends CardImpl {

public SmeagolHelpfulGuide(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{G}");

this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.HALFLING);
this.subtype.add(SubType.HORROR);
this.power = new MageInt(4);
this.toughness = new MageInt(2);

// At the beginning of your end step, if a creature died under your control this turn, the Ring tempts you.
this.addAbility(new BeginningOfEndStepTriggeredAbility(
new TheRingTemptsYouEffect(), TargetController.YOU,
CreatureDiedControlledCondition.instance, false
).addHint(CreatureDiedControlledCondition.getHint()));

// Whenever the Ring tempts you, target opponent reveals cards from the top of their library until they reveal
// a land card. Put that card onto the battlefield tapped under your control and the rest into their graveyard.
Ability ability = new TheRingTemptsYouTriggeredAbility(new SmeagolHelpfulGuideEffect());
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
}

private SmeagolHelpfulGuide(final SmeagolHelpfulGuide card) {
super(card);
}

@Override
public SmeagolHelpfulGuide copy() {
return new SmeagolHelpfulGuide(this);
}
}

class SmeagolHelpfulGuideEffect extends OneShotEffect {

SmeagolHelpfulGuideEffect() {
super(Outcome.PutLandInPlay);
staticText = "target opponent reveals cards from the top of their library until they reveal" +
"a land card. Put that card onto the battlefield tapped under your control " +
"and the rest into their graveyard.";
}

@Override
public boolean apply(Game game, Ability source) {
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
Player controller = game.getPlayer(source.getControllerId());
if (opponent == null || controller == null) {
return false;
}

CardsImpl revealed = new CardsImpl();
Card land = null;
for (Card card : opponent.getLibrary().getCards(game)) {
if (card != null) {
revealed.add(card);
if (card.isLand(game)) {
land = card;
break;
}
}
}

// Every card is revealed, land included.
opponent.revealCards(source, revealed, game);

// If there was a land card, the source's controller puts in on the battlefield.
if(land != null) {
revealed.remove(land);
controller.moveCards(land, Zone.BATTLEFIELD, source, game);
}

// Rest of the revealed cards are put into the opponent's graveyard.
opponent.moveCards(revealed, Zone.GRAVEYARD, source, game);
return true;
}

private SmeagolHelpfulGuideEffect(final SmeagolHelpfulGuideEffect effect) {
super(effect);
}

@Override
public SmeagolHelpfulGuideEffect copy() {
return new SmeagolHelpfulGuideEffect(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ private TheLordOfTheRingsTalesOfMiddleEarth() {
cards.add(new SetCardInfo("Shortcut to Mushrooms", 187, Rarity.UNCOMMON, mage.cards.s.ShortcutToMushrooms.class));
cards.add(new SetCardInfo("Shower of Arrows", 188, Rarity.COMMON, mage.cards.s.ShowerOfArrows.class));
cards.add(new SetCardInfo("Slip On the Ring", 31, Rarity.COMMON, mage.cards.s.SlipOnTheRing.class));
cards.add(new SetCardInfo("Smeagol, Helpful Guide", 231, Rarity.RARE, mage.cards.s.SmeagolHelpfulGuide.class));
cards.add(new SetCardInfo("Smite the Deathless", 148, Rarity.COMMON, mage.cards.s.SmiteTheDeathless.class));
cards.add(new SetCardInfo("Snarling Warg", 109, Rarity.COMMON, mage.cards.s.SnarlingWarg.class));
cards.add(new SetCardInfo("Soldier of the Grey Host", 32, Rarity.COMMON, mage.cards.s.SoldierOfTheGreyHost.class));
Expand Down

0 comments on commit cd25bd9

Please sign in to comment.