- Added a button to dev mode console to make the current player planeswalk to a specified plane, even if it isn't in their planar deck. Should make life easier for testing new planes.

This commit is contained in:
moomarc
2013-05-29 07:47:01 +00:00
parent 716a5d33e1
commit 4f43579c20
3 changed files with 48 additions and 9 deletions

View File

@@ -46,6 +46,7 @@ import forge.card.spellability.SpellAbility;
import forge.card.trigger.TriggerType;
import forge.control.input.InputSelectCardsFromList;
import forge.game.GameState;
import forge.game.GameType;
import forge.game.PlanarDice;
import forge.game.player.HumanPlay;
import forge.game.player.Player;
@@ -74,7 +75,7 @@ public final class GuiDisplayUtil {
public static void devSetupGameState() {
int humanLife = -1;
int computerLife = -1;
final Map<ZoneType, String> humanCardTexts = new EnumMap<ZoneType, String>(ZoneType.class);
final Map<ZoneType, String> aiCardTexts = new EnumMap<ZoneType, String>(ZoneType.class);
@@ -497,9 +498,38 @@ public final class GuiDisplayUtil {
}
});
}
public static void devModePlaneswalkTo() {
final GameState game = getGame();
if (game.getMatch().getGameType() != GameType.Planechase) { return; }
final Player p = game.getPhaseHandler().getPlayerTurn();
final List<CardPrinted> allPlanars = new ArrayList<CardPrinted>();
for (CardPrinted c : CardDb.variants().getAllCards()) {
if (c.getRules().getType().isPlane() || c.getRules().getType().isPhenomenon()) {
allPlanars.add(c);
}
}
Collections.sort(allPlanars);
// use standard forge's list selection dialog
final IPaperCard c = GuiChoose.oneOrNone("Name the card", allPlanars);
if (c == null) { return; }
final Card forgeCard = c.toForgeCard(p);
forgeCard.setOwner(p);
game.getAction().changeZone(null, p.getZone(ZoneType.PlanarDeck), forgeCard, 0);
PlanarDice.roll(p, PlanarDice.Planeswalk);
game.getAction().invoke(new Runnable() {
@Override
public void run() {
p.getGame().getStack().chooseOrderOfSimultaneousStackEntryAll();
}
});
}
private static GameState getGame() {
return Singletons.getControl().getObservedGame();
}

View File

@@ -76,16 +76,18 @@ public enum CDev implements ICDoc {
public void mousePressed(final MouseEvent e) {
GuiDisplayUtil.devModeCardToBattlefield(); } };
private final MouseListener madBreakpoint = new MouseAdapter() { @Override
public void mousePressed(final MouseEvent e) {
GuiDisplayUtil.devModeBreakpoint(); } };
private final MouseListener madRiggedRoll = new MouseAdapter() { @Override
public void mousePressed(final MouseEvent e) {
GuiDisplayUtil.devModeRiggedPlanarRoll(); } };
private final MouseListener madWalkToPlane = new MouseAdapter() { @Override
public void mousePressed(final MouseEvent e) {
GuiDisplayUtil.devModePlaneswalkTo(); } };
//========== End mouse listener inits
/* (non-Javadoc)
@@ -114,6 +116,7 @@ public enum CDev implements ICDoc {
VDev.SINGLETON_INSTANCE.getLblBreakpoint().addMouseListener(madBreakpoint);
VDev.SINGLETON_INSTANCE.getLblCardToBattlefield().addMouseListener(madCardToBattlefield);
VDev.SINGLETON_INSTANCE.getLblRiggedRoll().addMouseListener(madRiggedRoll);
VDev.SINGLETON_INSTANCE.getLblWalkTo().addMouseListener(madWalkToPlane);
ForgePreferences prefs = Singletons.getModel().getPreferences();

View File

@@ -76,7 +76,8 @@ public enum VDev implements IVDoc<CDev> {
private final DevLabel lblCardToHand = new DevLabel("Add card to hand");
private final DevLabel lblBreakpoint = new DevLabel("Trigger breakpoint");
private final DevLabel lblRiggedRoll = new DevLabel("Rigged planar roll");
private final DevLabel lblWalkTo = new DevLabel("Planeswalk to");
//========= Constructor
private VDev() {
@@ -93,6 +94,7 @@ public enum VDev implements IVDoc<CDev> {
devLBLs.add(lblUntapPermanent);
devLBLs.add(lblSetLife);
devLBLs.add(lblBreakpoint);
devLBLs.add(lblWalkTo);
scroller.setBorder(null);
scroller.setOpaque(false);
@@ -105,8 +107,8 @@ public enum VDev implements IVDoc<CDev> {
viewport.add(this.lblTutor, constraints);
viewport.add(this.lblCardToHand, halfConstraints + ", split 2");
viewport.add(this.lblCardToBattlefield, halfConstraints);
viewport.add(this.lblRiggedRoll, constraints);
viewport.add(this.lblRiggedRoll, halfConstraints + ", split 2");
viewport.add(this.lblWalkTo, halfConstraints);
viewport.add(this.lblMilling, constraints);
viewport.add(this.lblUnlimitedLands, constraints);
viewport.add(this.lblSetupGame, constraints);
@@ -228,11 +230,15 @@ public enum VDev implements IVDoc<CDev> {
public DevLabel getLblBreakpoint() {
return this.lblBreakpoint;
}
public DevLabel getLblRiggedRoll() {
return this.lblRiggedRoll;
}
public DevLabel getLblWalkTo() {
return this.lblWalkTo;
}
/**
* Labels that act as buttons which control dev mode functions. Labels are
* used to support multiline text.