Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions Mage.Sets/src/mage/cards/t/TurtleTracks.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package mage.cards.t;

import java.util.UUID;

import mage.abilities.effects.common.search.SearchLibraryPutInPlayTargetPlayerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.StaticFilters;
import mage.target.TargetPlayer;
import mage.target.common.TargetCardInLibrary;

/**
*
* @author muz
*/
public final class TurtleTracks extends CardImpl {

public TurtleTracks(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}");

// Any number of target players may each search their library for a basic land card, put it onto the battlefield under their control, then shuffle.
this.getSpellAbility().addEffect(new SearchLibraryPutInPlayTargetPlayerEffect(
new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND), false, false, true
).setText("Any number of target players may each search their library for a basic land card, put it onto the battlefield under their control, then shuffle."));
this.getSpellAbility().addTarget(new TargetPlayer(0, Integer.MAX_VALUE, false));
}

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

@Override
public TurtleTracks copy() {
return new TurtleTracks(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ private TeenageMutantNinjaTurtlesEternal() {
cards.add(new SetCardInfo("Together Forever", 44, Rarity.RARE, mage.cards.t.TogetherForever.class));
cards.add(new SetCardInfo("Tokka & Rahzar, Unsupervised", 28, Rarity.RARE, mage.cards.t.TokkaAndRahzarUnsupervised.class));
cards.add(new SetCardInfo("Triceraton Regenta", 105, Rarity.COMMON, mage.cards.t.TriceratonRegenta.class));
cards.add(new SetCardInfo("Turtle Tracks", 129, Rarity.UNCOMMON, mage.cards.t.TurtleTracks.class));
cards.add(new SetCardInfo("Undergrowth Stadium", 80, Rarity.RARE, mage.cards.u.UndergrowthStadium.class));
cards.add(new SetCardInfo("Utrom Monitor", 113, Rarity.COMMON, mage.cards.u.UtromMonitor.class));
cards.add(new SetCardInfo("Vanquish the Horde", 45, Rarity.RARE, mage.cards.v.VanquishTheHorde.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,31 @@
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;

import java.util.List;
import java.util.UUID;

/**
* @author LevelX2
*/
public class SearchLibraryPutInPlayTargetPlayerEffect extends SearchEffect {

protected boolean tapped;
protected boolean ownerIsController;
protected boolean optional;

public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target, boolean tapped) {
this(target, tapped, false);
}

public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target, boolean tapped, boolean ownerIsController) {
this(target, tapped, ownerIsController, false);
}

public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target, boolean tapped, boolean ownerIsController, boolean optional) {
super(target, Outcome.PutCardInPlay);
this.tapped = tapped;
this.ownerIsController = ownerIsController;
this.optional = optional;
if (target.getDescription().contains("land")) {
this.outcome = Outcome.PutLandInPlay;
} else if (target.getDescription().contains("creature")) {
Expand All @@ -37,6 +46,7 @@ protected SearchLibraryPutInPlayTargetPlayerEffect(final SearchLibraryPutInPlayT
super(effect);
this.tapped = effect.tapped;
this.ownerIsController = effect.ownerIsController;
this.optional = effect.optional;
}

@Override
Expand All @@ -46,19 +56,30 @@ public SearchLibraryPutInPlayTargetPlayerEffect copy() {

@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
if (player != null) {
if (player.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
player.moveCards(new CardsImpl(target.getTargets()).getCards(game),
Zone.BATTLEFIELD, source, game, tapped, false, ownerIsController, null);
List<UUID> targets = getTargetPointer().getTargets(game, source);
if (targets.isEmpty()) {
return false;
}
for (UUID targetId : targets) {
Player player = game.getPlayer(targetId);
if (player == null) {
continue;
}

if (this.optional) {
if (!player.chooseUse(outcome, "Search your library for " + target.getDescription() + '?', source, game)) {
continue;
}
player.shuffleLibrary(source, game);
return true;
}

TargetCardInLibrary targetCopy = target.copy();
if (player.searchLibrary(targetCopy, source, game) && !targetCopy.getTargets().isEmpty()) {
player.moveCards(new CardsImpl(targetCopy.getTargets()).getCards(game),
Zone.BATTLEFIELD, source, game, tapped, false, ownerIsController, null);
}
player.shuffleLibrary(source, game);
}
return false;
return true;
}

@Override
Expand All @@ -67,7 +88,8 @@ public String getText(Mode mode) {
return staticText;
}
return getTargetPointer().describeTargets(mode.getTargets(), "that player")
+ " searches their library for "
+ (optional ? " may search" : " searches")
+ " their library for "
+ target.getDescription()
+ ", "
+ (target.getMaxNumberOfTargets() > 1 ? "puts them onto the battlefield" : "puts it onto the battlefield")
Expand Down
Loading