- Added Fathom Trawl

- Enabled ordering of cards going to library or battlefield from DigUntil effects.
This commit is contained in:
moomarc
2013-05-24 09:50:52 +00:00
parent 2370324591
commit 4197acc6fd
6 changed files with 39 additions and 4 deletions

View File

@@ -101,11 +101,11 @@ public class DigUntilEffect extends SpellAbilityEffect {
final ZoneType revealedDest = ZoneType.smartValueOf(sa.getParam("RevealedDestination"));
final int revealedLibPos = AbilityUtils.calculateAmount(host, sa.getParam("RevealedLibraryPosition"), sa);
final ZoneType digSite = sa.hasParam("DigZone") ? ZoneType.smartValueOf(sa.getParam("DigZone")) : ZoneType.Library;
for (final Player p : getTargetPlayers(sa)) {
if ((tgt == null) || p.canBeTargetedBy(sa)) {
final List<Card> found = new ArrayList<Card>();
final List<Card> revealed = new ArrayList<Card>();
List<Card> revealed = new ArrayList<Card>();
final PlayerZone library = p.getZone(digSite);
@@ -130,7 +130,11 @@ public class DigUntilEffect extends SpellAbilityEffect {
}
final GameState game = p.getGame();
// TODO Allow Human to choose the order
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) {
final Iterator<Card> itr = found.iterator();
while (itr.hasNext()) {
@@ -162,7 +166,11 @@ public class DigUntilEffect extends SpellAbilityEffect {
Collections.shuffle(revealed, random);
}
// TODO Use getOrderChoices before this moveTo call for the Human
if (revealedDest == ZoneType.Library && !sa.hasParam("Shuffle") && 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();
while (itr.hasNext()) {
final Card c = itr.next();

View File

@@ -126,6 +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);
/** 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

@@ -210,6 +210,12 @@ public class PlayerControllerAi extends PlayerController {
return true; // AI does not know what will happen next (another clash or that would become his topdeck)
}
@Override
public List<Card> orderMoveToZoneList(List<Card> revealed, ZoneType destinationZone) {
//TODO Add logic for AI ordering here
return revealed;
}
@Override
public List<Card> chooseCardsToDiscardFrom(Player p, SpellAbility sa, List<Card> validCards, int min, int max) {
boolean isTargetFriendly = !p.isOpponentOf(player);

View File

@@ -333,6 +333,16 @@ public class PlayerControllerHuman extends PlayerController {
return GuiDialog.confirm(c, "Where will you put " + c.getName() + " in your library", new String[]{"Top", "Bottom"} );
}
@Override
public List<Card> orderMoveToZoneList(List<Card> revealed, 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);
} else if (destinationZone == ZoneType.Battlefield) {
return GuiChoose.order("Choose order of cards to put onto the battlefield", "Put first", 0, revealed, null, null);
}
return revealed;
}
@Override
public List<Card> chooseCardsToDiscardFrom(Player p, SpellAbility sa, List<Card> valid, int min, int max) {
if ( p != player ) {