[LTR] Implement Sméagol, Helpful Guide (#10514)

This commit is contained in:
Susucre 2023-06-23 02:06:35 +02:00 committed by GitHub
parent 0255761d67
commit cd25bd943d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 110 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -225,6 +225,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet {
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));