Implemented Ashiok, Dream Render

This commit is contained in:
Evan Kranzler 2019-04-15 14:10:06 -04:00
parent bea26691a8
commit 254972be77
170 changed files with 294 additions and 212 deletions

View file

@ -81,7 +81,7 @@ class AchHansRunEffect extends OneShotEffect {
FilterCard nameFilter = new FilterCard();
nameFilter.add(new NamePredicate(cardName));
TargetCardInLibrary target = new TargetCardInLibrary(1, 1, nameFilter);
if (!controller.searchLibrary(target, game)) {
if (!controller.searchLibrary(target, source, game)) {
return false;
}
Card card = controller.getLibrary().remove(target.getFirstTarget(), game);

View file

@ -63,7 +63,7 @@ class AcquireEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (opponent != null && controller != null) {
TargetCardInLibrary target = new TargetCardInLibrary(filter);
controller.searchLibrary(target, game, opponent.getId());
controller.searchLibrary(target, source, game, opponent.getId());
Card targetCard = game.getCard(target.getFirstTarget());
if (targetCard != null) {
controller.moveCards(targetCard, Zone.BATTLEFIELD, source, game);

View file

@ -106,7 +106,7 @@ class ArachnusSpinnerEffect extends OneShotEffect {
}
if (card == null) {
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
card = game.getCard(target.getFirstTarget());
}
controller.shuffleLibrary(source, game);

View file

@ -111,7 +111,7 @@ class ArchmageAscensionReplacementEffect extends ReplacementEffectImpl {
Player player = game.getPlayer(event.getPlayerId());
if (player != null) {
TargetCardInLibrary target = new TargetCardInLibrary();
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);

View file

@ -90,7 +90,7 @@ class ArcumDagssonEffect extends OneShotEffect {
artifactCreature.sacrifice(source.getSourceId(), game);
if (player.chooseUse(Outcome.PutCardInPlay, "Search your library for a noncreature artifact card?", source, game)) {
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
player.moveCards(card, Zone.BATTLEFIELD, source, game);

View file

@ -0,0 +1,95 @@
package mage.cards.a;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.common.ExileGraveyardAllPlayersEffect;
import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class AshiokDreamRender extends CardImpl {
public AshiokDreamRender(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{1}{U/B}{U/B}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.ASHIOK);
this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(5));
// Spells and abilities your opponents control can't cause their controller to search their library.
this.addAbility(new SimpleStaticAbility(new AshiokDreamRenderEffect()));
// -1: Target player puts the top four cards of their library into their graveyard. Then exile each opponent's graveyard.
Ability ability = new LoyaltyAbility(new PutTopCardOfLibraryIntoGraveTargetEffect(2), -1);
ability.addEffect(new ExileGraveyardAllPlayersEffect(StaticFilters.FILTER_CARD, TargetController.OPPONENT).setText("Then exile each opponent's graveyard."));
this.addAbility(ability);
}
private AshiokDreamRender(final AshiokDreamRender card) {
super(card);
}
@Override
public AshiokDreamRender copy() {
return new AshiokDreamRender(this);
}
}
class AshiokDreamRenderEffect extends ContinuousRuleModifyingEffectImpl {
AshiokDreamRenderEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, true, false);
staticText = "Spells and abilities your opponents control can't cause their controller to search their library.";
}
private AshiokDreamRenderEffect(final AshiokDreamRenderEffect effect) {
super(effect);
}
@Override
public AshiokDreamRenderEffect copy() {
return new AshiokDreamRenderEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public String getInfoMessage(Ability source, GameEvent event, Game game) {
MageObject mageObject = game.getObject(source.getSourceId());
if (mageObject != null) {
return "You can't search libraries (" + mageObject.getLogName() + " in play).";
}
return null;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return GameEvent.EventType.SEARCH_LIBRARY == event.getType();
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
return controller != null
&& event.getPlayerId().equals(game.getControllerId(event.getSourceId()))
&& event.getTargetId().equals(game.getControllerId(event.getSourceId()))
&& controller.hasOpponent(game.getControllerId(event.getSourceId()), game);
}
}

View file

@ -77,7 +77,7 @@ class AssassinsTrophyEffect extends OneShotEffect {
if (controller != null) {
if (controller.chooseUse(Outcome.PutLandInPlay, "Do you wish to search for a basic land, put it onto the battlefield and then shuffle your library?", source, game)) {
TargetCardInLibrary target = new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);

View file

@ -69,7 +69,7 @@ class AuratouchedMageEffect extends OneShotEffect {
filter.add(new AuraCardCanAttachToLKIPermanentId(source.getSourceId()));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
target.setNotTarget(true);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
if (target.getFirstTarget() != null) {
Card aura = game.getCard(target.getFirstTarget());
Permanent auratouchedMage = source.getSourcePermanentIfItStillExists(game);

View file

@ -78,7 +78,7 @@ class AvatarOfGrowthSearchEffect extends OneShotEffect {
Player player = game.getPlayer(playerId);
if (player != null) {
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, StaticFilters.FILTER_CARD_BASIC_LAND);
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
player.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game);
}

View file

@ -91,7 +91,7 @@ class BirthingPodEffect extends OneShotEffect {
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, newConvertedCost));
filter.add(new CardTypePredicate(CardType.CREATURE));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}

View file

@ -66,7 +66,7 @@ class BitterOrdealEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && targetPlayer != null) {
TargetCardInLibrary target = new TargetCardInLibrary();
if (controller.searchLibrary(target, game, targetPlayer.getId())) {
if (controller.searchLibrary(target, source, game, targetPlayer.getId())) {
Card card = targetPlayer.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
controller.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.LIBRARY, true);

View file

@ -76,7 +76,7 @@ class BitterheartWitchEffect extends OneShotEffect {
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (controller != null && targetPlayer != null) {
TargetCardInLibrary targetCard = new TargetCardInLibrary(filter);
if (controller.searchLibrary(targetCard, game)) {
if (controller.searchLibrary(targetCard, source, game)) {
Card card = game.getCard(targetCard.getFirstTarget());
if (card != null) {
game.getState().setValue("attachTo:" + card.getId(), targetPlayer.getId());

View file

@ -73,7 +73,7 @@ class BoldwyrHeavyweightsEffect extends OneShotEffect {
Player opponent = game.getPlayer(opponentId);
if (opponent != null && opponent.chooseUse(Outcome.PutCreatureInPlay, "Search your library for a creature card and put it onto the battlefield?", source, game)) {
TargetCardInLibrary target = new TargetCardInLibrary(new FilterCreatureCard());
if (opponent.searchLibrary(target, game)) {
if (opponent.searchLibrary(target, source, game)) {
Card targetCard = opponent.getLibrary().getCard(target.getFirstTarget(), game);
if (targetCard != null) {
opponent.moveCards(targetCard, Zone.BATTLEFIELD, source, game);

View file

@ -101,7 +101,7 @@ class BoonweaverGiantEffect extends OneShotEffect {
}
if (card == null) {
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
card = game.getCard(target.getFirstTarget());
if (card != null) {
zone = Zone.LIBRARY;

View file

@ -108,7 +108,7 @@ class BorderlandExplorerEffect extends OneShotEffect {
Cards cardsPlayer = cardsToDiscard.get(playerId);
if (cardsPlayer != null && !cardsPlayer.isEmpty()) {
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD_BASIC_LAND);
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
Cards cards = new CardsImpl(target.getTargets());
cards.addAll(target.getTargets());

View file

@ -114,7 +114,7 @@ class BoreasChargerEffect extends OneShotEffect {
TargetCardInLibrary target2
= new TargetCardInLibrary(0, landDifference, filter2);
Cards cardsToHand = new CardsImpl();
if (controller.searchLibrary(target2, game)) {
if (controller.searchLibrary(target2, source, game)) {
for (UUID cardId : target2.getTargets()) {
Card card = game.getCard(cardId);
if (card != null) {

View file

@ -70,7 +70,7 @@ class BoundlessRealmsEffect extends OneShotEffect {
int amount = new PermanentsOnBattlefieldCount(filter).calculate(game, source, this);
TargetCardInLibrary target = new TargetCardInLibrary(0, amount, StaticFilters.FILTER_CARD_BASIC_LAND);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
controller.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null);
}
controller.shuffleLibrary(source, game);

View file

@ -62,7 +62,7 @@ class BriberyEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && opponent != null) {
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, new FilterCreatureCard("creature card"));
if (controller.searchLibrary(target, game, opponent.getId())) {
if (controller.searchLibrary(target, source, game, opponent.getId())) {
Card card = opponent.getLibrary().getCard(target.getFirstTarget(), game);
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}

View file

@ -74,7 +74,7 @@ class BringToLightEffect extends OneShotEffect {
filter.add(Predicates.or(new CardTypePredicate(CardType.CREATURE), new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY)));
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, numberColors + 1));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
controller.searchLibrary(target, game);
controller.searchLibrary(target, source, game);
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
controller.moveCards(card, Zone.EXILED, source, game);

View file

@ -61,7 +61,7 @@ class BuriedAliveEffect extends SearchEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
controller.moveCards(new CardsImpl(target.getTargets()), Zone.GRAVEYARD, source, game);
}
controller.shuffleLibrary(source, game);

View file

@ -11,7 +11,6 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.filter.common.FilterBasicLandCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
@ -63,7 +62,7 @@ class CaravanVigilEffect extends OneShotEffect {
MageObject sourceObject = source.getSourceObject(game);
if (sourceObject != null && controller != null) {
TargetCardInLibrary target = new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
Cards cards = new CardsImpl(card);

View file

@ -74,7 +74,7 @@ class CitanulFluteSearchEffect extends OneShotEffect {
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, source.getManaCostsToPay().getX() + 1));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
Cards cards = new CardsImpl();

View file

@ -80,7 +80,7 @@ class ClarionUltimatumEffect extends OneShotEffect {
FilterCard filter = new FilterCard("card named " + cardName);
filter.add(new NamePredicate(cardName));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
chosenCards.add(card);

View file

@ -76,7 +76,7 @@ class CollectiveVoyageEffect extends OneShotEffect {
Player player = game.getPlayer(playerId);
if (player != null) {
TargetCardInLibrary target = new TargetCardInLibrary(0, xSum, StaticFilters.FILTER_CARD_BASIC_LAND);
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
player.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game, true, false, true, null);
player.shuffleLibrary(source, game);
}

View file

@ -77,7 +77,7 @@ class ConfluxEffect extends OneShotEffect {
TargetCardInLibrary targetGreen = new TargetCardInLibrary(filterGreen);
if (you != null && you.getLibrary().hasCards()) {
if (you.searchLibrary(targetWhite, game)) {
if (you.searchLibrary(targetWhite, source, game)) {
if (!targetWhite.getTargets().isEmpty()) {
for (UUID cardId : targetWhite.getTargets()) {
Card card = you.getLibrary().remove(cardId, game);
@ -89,7 +89,7 @@ class ConfluxEffect extends OneShotEffect {
}
}
if (you != null && you.getLibrary().hasCards()) {
if (you.searchLibrary(targetBlue, game)) {
if (you.searchLibrary(targetBlue, source, game)) {
if (!targetBlue.getTargets().isEmpty()) {
for (UUID cardId : targetBlue.getTargets()) {
Card card = you.getLibrary().remove(cardId, game);
@ -101,7 +101,7 @@ class ConfluxEffect extends OneShotEffect {
}
}
if (you != null && you.getLibrary().hasCards()) {
if (you.searchLibrary(targetBlack, game)) {
if (you.searchLibrary(targetBlack, source, game)) {
if (!targetBlack.getTargets().isEmpty()) {
for (UUID cardId : targetBlack.getTargets()) {
Card card = you.getLibrary().remove(cardId, game);
@ -113,7 +113,7 @@ class ConfluxEffect extends OneShotEffect {
}
}
if (you != null && you.getLibrary().hasCards()) {
if (you.searchLibrary(targetRed, game)) {
if (you.searchLibrary(targetRed, source, game)) {
if (!targetRed.getTargets().isEmpty()) {
for (UUID cardId : targetRed.getTargets()) {
Card card = you.getLibrary().remove(cardId, game);
@ -125,7 +125,7 @@ class ConfluxEffect extends OneShotEffect {
}
}
if (you != null && you.getLibrary().hasCards()) {
if (you.searchLibrary(targetGreen, game)) {
if (you.searchLibrary(targetGreen, source, game)) {
if (!targetGreen.getTargets().isEmpty()) {
for (UUID cardId : targetGreen.getTargets()) {
Card card = you.getLibrary().remove(cardId, game);

View file

@ -1,7 +1,6 @@
package mage.cards.c;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
@ -64,7 +63,7 @@ class CongregationAtDawnEffect extends OneShotEffect {
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
TargetCardInLibrary target = new TargetCardInLibrary(0, 3, new FilterCreatureCard("creature cards"));
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
Cards revealed = new CardsImpl();
for (UUID cardId : target.getTargets()) {

View file

@ -70,7 +70,7 @@ class SearchLibraryPutInGraveyard extends SearchEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {

View file

@ -82,7 +82,7 @@ class CorpseHarvesterEffect extends OneShotEffect {
FilterCard filter = new FilterCard(subtype);
filter.add(new SubtypePredicate(SubType.byDescription(subtype)));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
Card card = player.getLibrary().remove(target.getFirstTarget(), game);
if (card != null) {
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);

View file

@ -67,7 +67,7 @@ class CultivateEffect extends OneShotEffect {
return false;
}
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, StaticFilters.FILTER_CARD_BASIC_LAND);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
Cards revealed = new CardsImpl(target.getTargets());
controller.revealCards(sourceObject.getIdName(), revealed, game);

View file

@ -87,7 +87,7 @@ class CurseOfMisfortunesEffect extends OneShotEffect {
}
}
TargetCardInLibrary targetCard = new TargetCardInLibrary(filter);
if (player.searchLibrary(targetCard, game)) {
if (player.searchLibrary(targetCard, source, game)) {
Card card = game.getCard(targetCard.getFirstTarget());
if (card != null) {
this.setTargetPointer(new FixedTarget(targetPlayer.getId()));

View file

@ -69,7 +69,7 @@ class DarkDecisionEffect extends OneShotEffect {
if (controller != null && sourceObject != null) {
TargetCardInLibrary target = new TargetCardInLibrary(new FilterNonlandCard());
target.setCardLimit(10);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
UUID targetId = target.getFirstTarget();
Card card = game.getCard(targetId);
if (card != null) {

View file

@ -110,7 +110,7 @@ class DarkSupplicantEffect extends OneShotEffect {
&& controller.chooseUse(Outcome.Benefit, "Do you want to search your library for Scion of Darkness?", source, game)) {
librarySearched = true;
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
selectedCard = game.getCard(target.getFirstTarget());
}

View file

@ -124,7 +124,7 @@ class TransmuteArtifactEffect extends SearchEffect {
sacrifice = permanent.sacrifice(source.getSourceId(), game);
}
}
if (sacrifice && controller.searchLibrary(target, game)) {
if (sacrifice && controller.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
for (UUID cardId : target.getTargets()) {
Card card = controller.getLibrary().getCard(cardId, game);

View file

@ -63,7 +63,7 @@ class DenyingWindEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && player != null) {
TargetCardInLibrary target = new TargetCardInLibrary(0, 7, new FilterCard("cards from player's library to exile"));
if (controller.searchLibrary(target, game, player.getId())) {
if (controller.searchLibrary(target, source, game, player.getId())) {
List<UUID> targets = target.getTargets();
for (UUID targetId : targets) {
Card card = player.getLibrary().remove(targetId, game);

View file

@ -66,7 +66,7 @@ class DiabolicRevelationEffect extends OneShotEffect {
return false;
}
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
for (UUID cardId : target.getTargets()) {
Card card = player.getLibrary().remove(cardId, game);
if (card != null) {

View file

@ -4,21 +4,15 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.SuspendAbility;
import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterNonlandPermanent;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -81,7 +75,7 @@ class DichotomancyEffect extends OneShotEffect {
FilterCard filterCard = new FilterCard("card named \""+name+'"');
filterCard.add(new NamePredicate(name));
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filterCard);
if (controller.searchLibrary(target, game, opponent.getId())) {
if (controller.searchLibrary(target, source, game, opponent.getId())) {
controller.moveCards(opponent.getLibrary().getCard(target.getFirstTarget(), game), Zone.BATTLEFIELD, source, game);
}
}

View file

@ -62,7 +62,7 @@ class DistantMemoriesEffect extends OneShotEffect {
}
TargetCardInLibrary target = new TargetCardInLibrary();
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
Card card = player.getLibrary().remove(target.getFirstTarget(), game);
if (card != null) {
card.moveToZone(Zone.EXILED, source.getSourceId(), game, false);

View file

@ -78,7 +78,7 @@ class DoublingChantEffect extends OneShotEffect {
FilterCreatureCard filter = new FilterCreatureCard("nothing (no valid card available)");
filter.add(new NamePredicate("creatureName"));
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter);
controller.searchLibrary(target, game);
controller.searchLibrary(target, source, game);
}
}
for (Permanent creature : creatures) {
@ -91,7 +91,7 @@ class DoublingChantEffect extends OneShotEffect {
filter.add(Predicates.not(Predicates.or(uuidPredicates)));
}
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
chosenCards.add(card);

View file

@ -79,7 +79,7 @@ class EarwigSquadEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId());
if (player != null && opponent != null) {
TargetCardInLibrary target = new TargetCardInLibrary(0, 3, new FilterCard("cards from opponents library to exile"));
if (player.searchLibrary(target, game, opponent.getId())) {
if (player.searchLibrary(target, source, game, opponent.getId())) {
List<UUID> targets = target.getTargets();
for (UUID targetId : targets) {
Card card = opponent.getLibrary().remove(targetId, game);

View file

@ -83,7 +83,7 @@ class EldritchEvolutionEffect extends OneShotEffect {
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, newConvertedCost+1));
filter.add(new CardTypePredicate(CardType.CREATURE));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}

View file

@ -74,7 +74,7 @@ class EndlessHorizonsEffect extends SearchEffect {
public boolean apply(Game game, Ability source) {
Player you = game.getPlayer(source.getControllerId());
if (you != null) {
if (you.searchLibrary(target, game)) {
if (you.searchLibrary(target, source, game)) {
UUID exileZone = CardUtil.getCardExileZoneId(game, source);
if (!target.getTargets().isEmpty()) {
for (UUID cardId : target.getTargets()) {

View file

@ -68,7 +68,7 @@ class EnduringIdealEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
TargetCardInLibrary target = new TargetCardInLibrary(filter);
controller.searchLibrary(target, game);
controller.searchLibrary(target, source, game);
Card targetCard = game.getCard(target.getFirstTarget());
if (targetCard == null) {
applied = false;

View file

@ -60,7 +60,7 @@ class SearchLibraryPutInGraveyard extends SearchEffect {
if (controller == null) {
return false;
}
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
controller.moveCards(game.getCard(target.getFirstTarget()), Zone.GRAVEYARD, source, game);
}
controller.shuffleLibrary(source, game);

View file

@ -77,7 +77,7 @@ class EternalDominionEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (opponent != null && controller != null) {
TargetCardInLibrary target = new TargetCardInLibrary(FILTER);
controller.searchLibrary(target, game, opponent.getId());
controller.searchLibrary(target, source, game, opponent.getId());
Card targetCard = game.getCard(target.getFirstTarget());
if (targetCard != null) {
applied = controller.moveCards(targetCard, Zone.BATTLEFIELD, source, game);

View file

@ -116,7 +116,7 @@ class ExtirpateEffect extends OneShotEffect {
// search cards in Library
filterNamedCard.setMessage("card named " + chosenCard.getName() + " in the library of " + owner.getName());
TargetCardInLibrary targetCardInLibrary = new TargetCardInLibrary(0, Integer.MAX_VALUE, filterNamedCard);
if (controller.searchLibrary(targetCardInLibrary, game, owner.getId())) {
if (controller.searchLibrary(targetCardInLibrary, source, game, owner.getId())) {
List<UUID> targets = targetCardInLibrary.getTargets();
for (UUID targetId : targets) {
Card targetCard = owner.getLibrary().getCard(targetId, game);

View file

@ -66,7 +66,7 @@ class ExtractEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId());
if (player != null && targetPlayer != null) {
TargetCardInLibrary target = new TargetCardInLibrary(1, 1, filter);
if (player.searchLibrary(target, game, targetPlayer.getId())) {
if (player.searchLibrary(target, source, game, targetPlayer.getId())) {
Card card = targetPlayer.getLibrary().remove(target.getFirstTarget(), game);
if (card != null) {
player.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.LIBRARY, true);

View file

@ -90,7 +90,7 @@ class FieldOfRuinEffect extends OneShotEffect {
Player player = game.getPlayer(playerId);
if (player != null) {
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD_BASIC_LAND);
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
player.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game);
player.shuffleLibrary(source, game);
}

View file

@ -1,7 +1,6 @@
package mage.cards.f;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
@ -66,7 +65,7 @@ class FinalPartingEffect extends OneShotEffect {
if (controller != null) {
// Unlike Jarad's Orders, which this mostly copies, you can't fail to find
TargetCardInLibrary target = new TargetCardInLibrary(2, 2, new FilterCard());
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
Cards searched = new CardsImpl();
for (UUID cardId : target.getTargets()) {

View file

@ -79,7 +79,7 @@ class FiremindsForesightSearchEffect extends OneShotEffect {
cardsCount = cardsInLibrary.count(filter, game);
if (cardsCount > 0) {
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter);
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
for (UUID cardId: target.getTargets()) {
Card card = player.getLibrary().remove(cardId, game);
if (card != null){

View file

@ -74,7 +74,7 @@ class FleshwritherEffect extends OneShotEffect {
FilterCreatureCard filter = new FilterCreatureCard("creature with converted mana cost " + sourceObject.getConvertedManaCost());
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, sourceObject.getConvertedManaCost()));
TargetCardInLibrary target = new TargetCardInLibrary(1, filter);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
Cards chosen = new CardsImpl(target.getTargets());
controller.moveCards(chosen, Zone.BATTLEFIELD, source, game);

View file

@ -63,7 +63,7 @@ class ForesightEffect extends SearchEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null && player.searchLibrary(target, game)) {
if (player != null && player.searchLibrary(target, source, game)) {
for (UUID targetId : getTargets()) {
Card card = player.getLibrary().getCard(targetId, game);
if (card != null) {

View file

@ -66,7 +66,7 @@ class ForkInTheRoadEffect extends OneShotEffect {
return false;
}
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, StaticFilters.FILTER_CARD_BASIC_LAND);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
Cards revealed = new CardsImpl();
for (UUID cardId : target.getTargets()) {

View file

@ -81,7 +81,7 @@ class FromTheAshesEffect extends OneShotEffect {
Player player = game.getPlayer(entry.getKey());
if (player != null && player.chooseUse(outcome, "Search your library for up to " + entry.getValue() + " basic land card(s) to put it onto the battlefield?", source, game)) {
TargetCardInLibrary target = new TargetCardInLibrary(0, entry.getValue(), StaticFilters.FILTER_CARD_BASIC_LAND);
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
player.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game);
}

View file

@ -145,7 +145,7 @@ class GarrukTheVeilCursedEffect extends OneShotEffect {
FilterCreatureCard filter = new FilterCreatureCard();
TargetCardInLibrary targetInLibrary = new TargetCardInLibrary(filter);
Cards cards = new CardsImpl();
if (controller.searchLibrary(targetInLibrary, game)) {
if (controller.searchLibrary(targetInLibrary, source, game)) {
for (UUID cardId : targetInLibrary.getTargets()) {
Card card = controller.getLibrary().remove(cardId, game);
if (card != null) {

View file

@ -123,7 +123,7 @@ class GateToTheAfterlifeEffect extends OneShotEffect {
if (card == null && controller.chooseUse(Outcome.Benefit, "Do you want to search your library for " + cardName + "?", source, game)) {
librarySearched = true;
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
card = game.getCard(target.getFirstTarget());
}
controller.shuffleLibrary(source, game);

View file

@ -85,7 +85,7 @@ class GemOfBecomingEffect extends OneShotEffect {
FilterLandCard filter = new FilterLandCard(subtype);
filter.add(new SubtypePredicate(SubType.byDescription(subtype)));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
Card card = player.getLibrary().remove(target.getFirstTarget(), game);
if (card != null) {
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);

View file

@ -73,7 +73,7 @@ class GhostQuarterEffect extends OneShotEffect {
Player controller = game.getPlayer(permanent.getControllerId());
if (controller != null && controller.chooseUse(Outcome.PutLandInPlay, "Do you wish to search for a basic land, put it onto the battlefield and then shuffle your library?", source, game)) {
TargetCardInLibrary target = new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);

View file

@ -67,7 +67,7 @@ class GiftsUngivenEffect extends OneShotEffect {
return false;
}
GiftsUngivenTarget target = new GiftsUngivenTarget();
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
Cards cards = new CardsImpl();
for (UUID cardId : target.getTargets()) {

View file

@ -113,7 +113,7 @@ class GigantiformEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (controller != null && controller.searchLibrary(target, game)) {
if (controller != null && controller.searchLibrary(target, source, game)) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);

View file

@ -87,7 +87,7 @@ class GrimReminderEffect extends OneShotEffect {
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
TargetCardInLibrary target = new TargetCardInLibrary(StaticFilters.FILTER_CARD_NON_LAND);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
Cards cardsToReveal = new CardsImpl(card);

View file

@ -20,7 +20,6 @@ import mage.game.ExileZone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.turn.Step;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetOpponent;
@ -82,7 +81,7 @@ class GrinningTotemSearchAndExileEffect extends OneShotEffect {
if (you != null && targetOpponent != null && sourceObject != null) {
if (targetOpponent.getLibrary().hasCards()) {
TargetCardInLibrary targetCard = new TargetCardInLibrary();
if (you.searchLibrary(targetCard, game, targetOpponent.getId())) {
if (you.searchLibrary(targetCard, source, game, targetOpponent.getId())) {
Card card = targetOpponent.getLibrary().remove(targetCard.getFirstTarget(), game);
if (card != null) {
UUID exileZoneId = CardUtil.getCardExileZoneId(game, source);

View file

@ -88,7 +88,7 @@ class GrozothEffect extends SearchEffect {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Card sourceCard = game.getCard(source.getSourceId());
if (sourceCard != null && player != null && player.searchLibrary(target, game)) {
if (sourceCard != null && player != null && player.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
Cards cards = new CardsImpl();
for (UUID cardId : target.getTargets()) {

View file

@ -13,7 +13,6 @@ import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterBasicLandCard;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game;
@ -73,7 +72,7 @@ class HarvestSeasonEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
TargetCardInLibrary target = new TargetCardInLibrary(0, new PermanentsOnBattlefieldCount(filter).calculate(game, source, this), StaticFilters.FILTER_CARD_BASIC_LAND);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
controller.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null);
}
controller.shuffleLibrary(source, game);

View file

@ -69,7 +69,7 @@ class HauntingEchoesEffect extends OneShotEffect {
int count = targetPlayer.getLibrary().count(filterCard, game);
TargetCardInLibrary target = new TargetCardInLibrary(count, count, filterCard);
player.searchLibrary(target, game, targetPlayer.getId());
player.searchLibrary(target, source, game, targetPlayer.getId());
List<UUID> targets = target.getTargets();
for (UUID cardId : targets) {
Card libraryCard = game.getCard(cardId);

View file

@ -74,7 +74,7 @@ class SeekEffect extends OneShotEffect {
if (player != null && opponent != null) {
if (opponent.getLibrary().hasCards()) {
TargetCardInLibrary target = new TargetCardInLibrary();
if (player.searchLibrary(target, game, opponent.getId())) {
if (player.searchLibrary(target, source, game, opponent.getId())) {
UUID targetId = target.getFirstTarget();
Card card = opponent.getLibrary().remove(targetId, game);
if (card != null) {

View file

@ -72,7 +72,7 @@ class HiredGiantEffect extends OneShotEffect {
Player player = game.getPlayer(playerId);
if (player != null && player.chooseUse(Outcome.PutCreatureInPlay, "Search your library for a land card and put it onto the battlefield?", source, game)) {
TargetCardInLibrary target = new TargetCardInLibrary(new FilterLandCard());
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
Card targetCard = player.getLibrary().getCard(target.getFirstTarget(), game);
if (targetCard != null) {
player.moveCards(targetCard, Zone.BATTLEFIELD, source, game);

View file

@ -79,7 +79,7 @@ class HoardingDragonEffect extends OneShotEffect {
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
TargetCardInLibrary target = new TargetCardInLibrary(new FilterArtifactCard());
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {

View file

@ -67,7 +67,7 @@ class InameDeathAspectEffect extends SearchEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null && player.searchLibrary(target, game)) {
if (player != null && player.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
player.moveCards(new CardsImpl(target.getTargets()), Zone.GRAVEYARD, source, game);
}

View file

@ -74,7 +74,7 @@ class IncomingEffect extends OneShotEffect {
Player player = game.getPlayer(playerId);
if (player != null) {
TargetCardInLibrary target = new TargetCardInLibrary(0, Integer.MAX_VALUE, filter);
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
player.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game);
player.shuffleLibrary(source, game);
}

View file

@ -1,7 +1,6 @@
package mage.cards.i;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -75,7 +74,7 @@ class IncreasingAmbitionEffect extends SearchEffect {
else {
target = new TargetCardInLibrary();
}
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
for (UUID cardId: target.getTargets()) {
Card card = player.getLibrary().remove(cardId, game);

View file

@ -1,7 +1,6 @@
package mage.cards.i;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
@ -78,7 +77,7 @@ class InsidiousDreamsEffect extends OneShotEffect {
if (controller != null && sourceObject != null) {
TargetCardInLibrary target = new TargetCardInLibrary(0, amount, new FilterCard());
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
Cards chosen = new CardsImpl();
for (UUID cardId : target.getTargets()) {
Card card = controller.getLibrary().remove(cardId, game);

View file

@ -70,7 +70,7 @@ class IntuitionEffect extends SearchEffect {
if (controller == null || opponent == null)
return false;
if (controller.getLibrary().size() >= 3 && controller.searchLibrary(target, game)) {
if (controller.getLibrary().size() >= 3 && controller.searchLibrary(target, source, game)) {
if (target.getTargets().size() == 3) {
Cards cards = new CardsImpl();

View file

@ -114,14 +114,14 @@ class InventEffect extends OneShotEffect {
}
Cards cards = new CardsImpl();
TargetCardInLibrary target = new TargetCardInLibrary(filter1);
if (player.searchLibrary(target, game, false)) {
if (player.searchLibrary(target, source, game, false)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
cards.add(card);
}
}
target = new TargetCardInLibrary(filter2);
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
cards.add(card);

View file

@ -267,7 +267,7 @@ class JaceArchitectOfThoughtEffect3 extends OneShotEffect {
playerName = "your";
}
TargetCardInLibrary target = new TargetCardInLibrary(new FilterNonlandCard("nonland card from " + playerName + " library"));
if (controller.searchLibrary(target, game, playerId, !checkList.contains(playerId))) {
if (controller.searchLibrary(target, source, game, playerId, !checkList.contains(playerId))) {
checkList.add(playerId);
UUID targetId = target.getFirstTarget();
Card card = player.getLibrary().remove(targetId, game);

View file

@ -1,7 +1,6 @@
package mage.cards.j;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
@ -65,7 +64,7 @@ class JaradsOrdersEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterCreatureCard("creature cards"));
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
Cards revealed = new CardsImpl();
for (UUID cardId: target.getTargets()) {

View file

@ -70,7 +70,7 @@ class JestersCapEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId());
if (player != null && targetPlayer != null) {
TargetCardInLibrary target = new TargetCardInLibrary(3, 3, new FilterCard());
player.searchLibrary(target, game, targetPlayer.getId());
player.searchLibrary(target, source, game, targetPlayer.getId());
for (UUID cardId : target.getTargets()) {
final Card targetCard = game.getCard(cardId);
if (targetCard != null) {

View file

@ -99,7 +99,7 @@ class JourneyForTheElixirEffect extends OneShotEffect {
if (!walkerFound || !landFound) {
TargetCardInLibrary targetWalker = new TargetCardInLibrary(0, 1, filter);
targetWalker.setNotTarget(true);
if (!walkerFound && player.searchLibrary(targetWalker, game, false)) {
if (!walkerFound && player.searchLibrary(targetWalker, source, game, false)) {
Card card = game.getCard(targetWalker.getFirstTarget());
if (card != null) {
cardsToHand.add(card);
@ -107,7 +107,7 @@ class JourneyForTheElixirEffect extends OneShotEffect {
}
TargetCardInLibrary targetLand = new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD_BASIC_LAND_A);
targetLand.setNotTarget(true);
if (!landFound && player.searchLibrary(targetLand, game, false)) {
if (!landFound && player.searchLibrary(targetLand, source, game, false)) {
Card card = game.getCard(targetLand.getFirstTarget());
if (card != null) {
cardsToHand.add(card);

View file

@ -72,7 +72,7 @@ class JungleWayfinderEffect extends OneShotEffect {
if (player != null) {
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD_BASIC_LAND);
if (player.chooseUse(Outcome.Benefit, "Search your library for a card to put into your hand?", source, game)) {
player.searchLibrary(target, game);
player.searchLibrary(target, source, game);
for (UUID cardId : target.getTargets()) {
Card card = player.getLibrary().getCard(cardId, game);
if (card != null) {

View file

@ -88,7 +88,7 @@ class KahoMinamoHistorianEffect extends SearchEffect {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
UUID exileZone = CardUtil.getCardExileZoneId(game, source);
if (!target.getTargets().isEmpty()) {
controller.moveCardsToExile(new CardsImpl(target.getTargets()).getCards(game), source, game, true, exileZone, sourceObject.getIdName());

View file

@ -68,7 +68,7 @@ class KnowledgeExploitationEffect extends OneShotEffect {
Player opponent = game.getPlayer(this.getTargetPointer().getFirst(game, source));
if (controller != null && opponent != null) {
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, new FilterInstantOrSorceryCard());
if (controller.searchLibrary(target, game, opponent.getId())) {
if (controller.searchLibrary(target, source, game, opponent.getId())) {
Card card = opponent.getLibrary().remove(target.getFirstTarget(), game);
if (card != null) {
controller.cast(card.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game));

View file

@ -68,7 +68,7 @@ class KodamasReachEffect extends OneShotEffect {
return false;
}
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, StaticFilters.FILTER_CARD_BASIC_LAND);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
Cards revealed = new CardsImpl();
for (UUID cardId : target.getTargets()) {

View file

@ -77,7 +77,7 @@ class LegacyOfTheBelovedEffect extends OneShotEffect {
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, p.getConvertedManaCost()));
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, filter);
Player player = game.getPlayer(source.getControllerId());
if (player != null && player.searchLibrary(target, game)) {
if (player != null && player.searchLibrary(target, source, game)) {
player.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game, false, false, false, null);
player.shuffleLibrary(source, game);
return true;

View file

@ -70,7 +70,7 @@ class LifesFinaleEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId());
if (player != null && opponent != null) {
TargetCardInLibrary target = new TargetCardInLibrary(0, 3, new FilterCreatureCard("creature cards from his library to put in his graveyard"));
if (player.searchLibrary(target, game, opponent.getId())) {
if (player.searchLibrary(target, source, game, opponent.getId())) {
player.moveCards(new CardsImpl(target.getTargets()), Zone.GRAVEYARD, source, game);
}
opponent.shuffleLibrary(source, game);

View file

@ -100,7 +100,7 @@ class LinSivviDefiantHeroEffect extends OneShotEffect {
filter.add(new SubtypePredicate(SubType.REBEL));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);

View file

@ -114,7 +114,7 @@ class LobotomyEffect extends OneShotEffect {
// If the player has no nonland cards in their hand, you can still search that player's library and have him or her shuffle it.
if (chosenCard != null || controller.chooseUse(outcome, "Search library anyway?", source, game)) {
TargetCardInLibrary targetCardsLibrary = new TargetCardInLibrary(0, Integer.MAX_VALUE, filterNamedCards);
controller.searchLibrary(targetCardsLibrary, game, targetPlayer.getId());
controller.searchLibrary(targetCardsLibrary, source, game, targetPlayer.getId());
for (UUID cardId : targetCardsLibrary.getTargets()) {
Card card = game.getCard(cardId);
if (card != null) {

View file

@ -57,7 +57,7 @@ class LongTermPlansEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
TargetCardInLibrary target = new TargetCardInLibrary();
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
Card card = player.getLibrary().remove(target.getFirstTarget(), game);
if (card != null) {
player.shuffleLibrary(source, game);

View file

@ -64,7 +64,7 @@ class ManaSeveranceEffect extends SearchEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
for (UUID cardId : target.getTargets()) {
Card card = controller.getLibrary().getCard(cardId, game);

View file

@ -73,7 +73,7 @@ class MangarasTomeSearchEffect extends OneShotEffect {
Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && permanent != null) {
TargetCardInLibrary target = new TargetCardInLibrary(5, new FilterCard());
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
for (UUID targetId : target.getTargets()) {
Card card = controller.getLibrary().getCard(targetId, game);
if (card != null) {

View file

@ -67,7 +67,7 @@ class ManipulateFateEffect extends SearchEffect {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if(player != null) {
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
for (UUID targetId : getTargets()) {
Card card = player.getLibrary().getCard(targetId, game);
if (card != null) {

View file

@ -100,7 +100,7 @@ class MaralenOfTheMornsongEffect2 extends OneShotEffect {
if (player != null) {
player.loseLife(3, game, false);
TargetCardInLibrary target = new TargetCardInLibrary();
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
player.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game);
}
player.shuffleLibrary(source, game);

View file

@ -79,7 +79,7 @@ class MimeofactureEffect extends OneShotEffect {
FilterCard filter = new FilterCard("card named " + permanent.getName());
filter.add(new NamePredicate(permanent.getName()));
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter);
if (controller.searchLibrary(target, game, opponent.getId())) {
if (controller.searchLibrary(target, source, game, opponent.getId())) {
Card card = opponent.getLibrary().getCard(target.getFirstTarget(), game);
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}

View file

@ -135,7 +135,7 @@ class MishraArtificerProdigyEffect extends OneShotEffect {
// Library
if (card == null && controller.chooseUse(Outcome.Neutral, "Search your library?", source, game)) {
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
card = game.getCard(target.getFirstTarget());
}
controller.shuffleLibrary(source, game);

View file

@ -72,7 +72,7 @@ class MyrIncubatorEffect extends SearchEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null
&& controller.searchLibrary(target, game)) {
&& controller.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
tokensToCreate = target.getTargets().size();
controller.moveCards(new CardsImpl(target.getTargets()), Zone.EXILED, source, game);

View file

@ -110,7 +110,7 @@ class NahiriTheHarbingerEffect extends SearchEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {

View file

@ -92,7 +92,7 @@ public final class NaturalBalance extends CardImpl {
if (landCount < 5 && player.chooseUse(outcome, "Search your library for up to " + amount + " basic land cards and put them onto the battlefield?", source, game)) {
// Select lands and put them onto battlefield
TargetCardInLibrary target = new TargetCardInLibrary(0, amount, StaticFilters.FILTER_CARD_BASIC_LAND);
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
player.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game);
}
toShuffle.add(player);

View file

@ -85,7 +85,7 @@ class NeoformEffect extends OneShotEffect {
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, newConvertedCost + 1));
filter.add(new CardTypePredicate(CardType.CREATURE));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (controller.searchLibrary(target, game)) {
if (controller.searchLibrary(target, source, game)) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
game.addEffect(new NeoformReplacementEffect(), source);
controller.moveCards(card, Zone.BATTLEFIELD, source, game);

View file

@ -65,7 +65,7 @@ class NeverendingTormentEffect extends OneShotEffect {
if (targetPlayer != null
&& you != null) {
TargetCardInLibrary target = new TargetCardInLibrary(you.getHand().size(), new FilterCard());
you.searchLibrary(target, game, targetPlayer.getId());
you.searchLibrary(target, source, game, targetPlayer.getId());
for (UUID cardId : target.getTargets()) {
final Card targetCard = game.getCard(cardId);
if (targetCard != null) {

View file

@ -64,7 +64,7 @@ class NewFrontiersEffect extends OneShotEffect {
Player player = game.getPlayer(playerId);
if (player != null && player.chooseUse(outcome, "Search your library for up to " + amount + " basic lands?", source, game)) {
TargetCardInLibrary target = new TargetCardInLibrary(0, amount, StaticFilters.FILTER_CARD_BASIC_LAND);
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
player.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null);
player.shuffleLibrary(source, game);
}

View file

@ -155,7 +155,7 @@ public final class NightDealings extends CardImpl {
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, cmc));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (player.searchLibrary(target, game)) {
if (player.searchLibrary(target, source, game)) {
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);

View file

@ -80,7 +80,7 @@ class NightmareIncursionEffect extends OneShotEffect {
if (controller != null && targetPlayer != null) {
int amount = new PermanentsOnBattlefieldCount(filter).calculate(game, source, this);
TargetCardInLibrary target = new TargetCardInLibrary(0, amount, new FilterCard());
if (controller.searchLibrary(target, game, targetPlayer.getId())) {
if (controller.searchLibrary(target, source, game, targetPlayer.getId())) {
List<UUID> targetId = target.getTargets();
for (UUID targetCard : targetId) {
Card card = targetPlayer.getLibrary().remove(targetCard, game);

Some files were not shown because too many files have changed in this diff Show more