* Search library and/or graveyard and put in hand - fixed that it shuffle library before card move;

This commit is contained in:
Oleg Agafonov 2020-06-25 00:43:10 +04:00
parent 6dfacfbca5
commit d8bbfefde6
2 changed files with 12 additions and 2 deletions

View file

@ -55,6 +55,7 @@ public class SearchLibraryGraveyardPutInHandEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
Card cardFound = null;
boolean needShuffle = false;
if (controller != null && sourceObject != null) {
if (forceToSearchBoth || controller.chooseUse(outcome, "Search your library for a card named " + filter.getMessage() + '?', source, game)) {
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter);
@ -64,7 +65,7 @@ public class SearchLibraryGraveyardPutInHandEffect extends OneShotEffect {
cardFound = game.getCard(target.getFirstTarget());
}
}
controller.shuffleLibrary(source, game);
needShuffle = true;
}
if (cardFound == null && controller.chooseUse(outcome, "Search your graveyard for a card named " + filter.getMessage() + '?', source, game)) {
@ -82,6 +83,10 @@ public class SearchLibraryGraveyardPutInHandEffect extends OneShotEffect {
controller.moveCards(cardFound, Zone.HAND, source, game);
}
if (needShuffle) {
controller.shuffleLibrary(source, game);
}
return true;
}

View file

@ -53,6 +53,7 @@ public class SearchLibraryGraveyardPutOntoBattlefieldEffect extends OneShotEffec
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
Card cardFound = null;
boolean needShuffle = false;
if (controller != null && sourceObject != null) {
if (forceToSearchBoth || controller.chooseUse(outcome, "Search your library for a " + filter.getMessage() + '?', source, game)) {
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter);
@ -62,7 +63,7 @@ public class SearchLibraryGraveyardPutOntoBattlefieldEffect extends OneShotEffec
cardFound = game.getCard(target.getFirstTarget());
}
}
controller.shuffleLibrary(source, game);
needShuffle = true;
}
if (cardFound == null && controller.chooseUse(outcome, "Search your graveyard for a " + filter.getMessage() + '?', source, game)) {
@ -79,6 +80,10 @@ public class SearchLibraryGraveyardPutOntoBattlefieldEffect extends OneShotEffec
controller.moveCards(cardFound, Zone.BATTLEFIELD, source, game);
}
if (needShuffle) {
controller.shuffleLibrary(source, game);
}
return true;
}