mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
- Added Fathom Trawl
- Enabled ordering of cards going to library or battlefield from DigUntil effects.
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
Reference in New Issue
Block a user