a special case for Human scrying with a single card available and no need to arrange

This commit is contained in:
Maxmtg
2013-03-16 10:43:08 +00:00
parent c96304666d
commit c3bb1c17a5
2 changed files with 27 additions and 8 deletions

View File

@@ -71,12 +71,15 @@ public class ScryEffect extends SpellAbilityEffect {
}
ImmutablePair<List<Card>, List<Card>> lists = p.getController().arrangeForScry(topN);
for(Card c : lists.getRight()) {
p.getGame().getAction().moveToBottomOfLibrary(c);
List<Card> toTop = lists.getLeft();
List<Card> toBottom = lists.getRight();
if ( null != toBottom) {
for(Card c : toBottom) {
p.getGame().getAction().moveToBottomOfLibrary(c);
}
}
List<Card> toTop = lists.getLeft();
if ( null != toTop ) {
Collections.reverse(toTop); // the last card in list will become topmost in library, have to revert thus.
for(Card c : toTop) {

View File

@@ -1,6 +1,7 @@
package forge.game.player;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -292,15 +293,30 @@ public class PlayerControllerHuman extends PlayerController {
@Override
public ImmutablePair<List<Card>, List<Card>> arrangeForScry(List<Card> topN) {
List<Card> toBottom = GuiChoose.order("Select cards to be put on the bottom of your library", "Cards to put on the bottom", -1, topN, null, null);
topN.removeAll(toBottom);
List<Card> toTop = topN.isEmpty() ? null : GuiChoose.order("Arrange cards to be put on top of your library", "Cards arranged", 0, topN, null, null);
List<Card> toBottom = null;
List<Card> toTop = null;
if (topN.size() == 1) {
if (willPutCardOnTop(topN.get(0)))
toTop = topN;
else
toBottom = topN;
} else {
toBottom = GuiChoose.order("Select cards to be put on the bottom of your library", "Cards to put on the bottom", -1, topN, null, null);
topN.removeAll(toBottom);
if ( topN.isEmpty() )
toTop = null;
else if ( topN.size() == 1 )
toTop = topN;
else
toTop = GuiChoose.order("Arrange cards to be put on top of your library", "Cards arranged", 0, topN, null, null);
}
return ImmutablePair.of(toTop, toBottom);
}
@Override
public boolean willPutCardOnTop(Card c) {
return GuiDialog.confirm(c, "Where you put " + c.getName() + " in your library", new String[]{"Top", "Bottom"} );
return GuiDialog.confirm(c, "Where will you put " + c.getName() + " in your library", new String[]{"Top", "Bottom"} );
}
}