- Small fixes to last commit and added some Shuffle params where necessary

This commit is contained in:
moomarc
2013-05-24 11:16:24 +00:00
parent 6dbd03841b
commit 42f77b29e9
6 changed files with 24 additions and 17 deletions

View File

@@ -104,7 +104,7 @@ public class DigUntilEffect extends SpellAbilityEffect {
for (final Player p : getTargetPlayers(sa)) {
if ((tgt == null) || p.canBeTargetedBy(sa)) {
final List<Card> found = new ArrayList<Card>();
List<Card> found = new ArrayList<Card>();
List<Card> revealed = new ArrayList<Card>();
final PlayerZone library = p.getZone(digSite);
@@ -130,12 +130,13 @@ public class DigUntilEffect extends SpellAbilityEffect {
}
final GameState game = p.getGame();
if (revealedDest == ZoneType.Battlefield && revealed.size() >= 2) {
revealed = p.getController().orderMoveToZoneList(revealed, revealedDest);
// should possibly use host.getController().getController()... above instead of p.getController?
}
if (foundDest != null) {
// Allow ordering of found cards
if ((foundDest.isKnown()) && found.size() >= 2) {
found = p.getController().orderMoveToZoneList(found, foundDest);
// should possibly use host.getController().getController()... for these instead of p.getController?
}
final Iterator<Card> itr = found.iterator();
while (itr.hasNext()) {
final Card c = itr.next();
@@ -166,9 +167,13 @@ public class DigUntilEffect extends SpellAbilityEffect {
Collections.shuffle(revealed, random);
}
if (revealedDest == ZoneType.Library && !sa.hasParam("Shuffle") && revealed.size() >= 2) {
// Allow ordering the rest of the revealed cards
if ((revealedDest.isKnown()) && revealed.size() >= 2) {
revealed = p.getController().orderMoveToZoneList(revealed, revealedDest);
}
if (revealedDest == ZoneType.Library && !sa.hasParam("Shuffle")
&& !sa.hasParam("RevealRandomOrder") && revealed.size() >= 2) {
revealed = p.getController().orderMoveToZoneList(revealed, revealedDest);
// should possibly use host.getController().getController()... above instead of p.getController?
}
final Iterator<Card> itr = revealed.iterator();

View File

@@ -126,7 +126,7 @@ public abstract class PlayerController {
public abstract void reveal(String string, Collection<Card> cards, ZoneType zone, Player owner);
public abstract ImmutablePair<List<Card>, List<Card>> arrangeForScry(List<Card> topN);
public abstract boolean willPutCardOnTop(Card c);
public abstract List<Card> orderMoveToZoneList(List<Card> revealed, ZoneType destinationZone);
public abstract List<Card> orderMoveToZoneList(List<Card> cards, ZoneType destinationZone);
/** p = target player, validCards - possible discards, min cards to discard */
public abstract List<Card> chooseCardsToDiscardFrom(Player playerDiscard, SpellAbility sa, List<Card> validCards, int min, int max);

View File

@@ -211,9 +211,9 @@ public class PlayerControllerAi extends PlayerController {
}
@Override
public List<Card> orderMoveToZoneList(List<Card> revealed, ZoneType destinationZone) {
public List<Card> orderMoveToZoneList(List<Card> cards, ZoneType destinationZone) {
//TODO Add logic for AI ordering here
return revealed;
return cards;
}
@Override

View File

@@ -334,13 +334,15 @@ public class PlayerControllerHuman extends PlayerController {
}
@Override
public List<Card> orderMoveToZoneList(List<Card> revealed, ZoneType destinationZone) {
public List<Card> orderMoveToZoneList(List<Card> cards, ZoneType destinationZone) {
if (destinationZone == ZoneType.Library) {
return GuiChoose.order("Choose order of cards to put into the library", "Closest to top", 0, revealed, null, null);
return GuiChoose.order("Choose order of cards to put into the library", "Closest to top", 0, cards, null, null);
} else if (destinationZone == ZoneType.Battlefield) {
return GuiChoose.order("Choose order of cards to put onto the battlefield", "Put first", 0, revealed, null, null);
return GuiChoose.order("Choose order of cards to put onto the battlefield", "Put first", 0, cards, null, null);
} else if (destinationZone == ZoneType.Graveyard) {
return GuiChoose.order("Choose order of cards to put into the graveyard", "Closest to top", 0, cards, null, null);
}
return revealed;
return cards;
}
@Override