mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- 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:
@@ -46,6 +46,7 @@ import forge.card.spellability.SpellAbility;
|
|||||||
import forge.card.trigger.TriggerType;
|
import forge.card.trigger.TriggerType;
|
||||||
import forge.control.input.InputSelectCardsFromList;
|
import forge.control.input.InputSelectCardsFromList;
|
||||||
import forge.game.GameState;
|
import forge.game.GameState;
|
||||||
|
import forge.game.GameType;
|
||||||
import forge.game.PlanarDice;
|
import forge.game.PlanarDice;
|
||||||
import forge.game.player.HumanPlay;
|
import forge.game.player.HumanPlay;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
@@ -497,7 +498,36 @@ 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() {
|
private static GameState getGame() {
|
||||||
|
|||||||
@@ -76,16 +76,18 @@ public enum CDev implements ICDoc {
|
|||||||
public void mousePressed(final MouseEvent e) {
|
public void mousePressed(final MouseEvent e) {
|
||||||
GuiDisplayUtil.devModeCardToBattlefield(); } };
|
GuiDisplayUtil.devModeCardToBattlefield(); } };
|
||||||
|
|
||||||
|
|
||||||
private final MouseListener madBreakpoint = new MouseAdapter() { @Override
|
private final MouseListener madBreakpoint = new MouseAdapter() { @Override
|
||||||
public void mousePressed(final MouseEvent e) {
|
public void mousePressed(final MouseEvent e) {
|
||||||
GuiDisplayUtil.devModeBreakpoint(); } };
|
GuiDisplayUtil.devModeBreakpoint(); } };
|
||||||
|
|
||||||
|
|
||||||
private final MouseListener madRiggedRoll = new MouseAdapter() { @Override
|
private final MouseListener madRiggedRoll = new MouseAdapter() { @Override
|
||||||
public void mousePressed(final MouseEvent e) {
|
public void mousePressed(final MouseEvent e) {
|
||||||
GuiDisplayUtil.devModeRiggedPlanarRoll(); } };
|
GuiDisplayUtil.devModeRiggedPlanarRoll(); } };
|
||||||
|
|
||||||
|
private final MouseListener madWalkToPlane = new MouseAdapter() { @Override
|
||||||
|
public void mousePressed(final MouseEvent e) {
|
||||||
|
GuiDisplayUtil.devModePlaneswalkTo(); } };
|
||||||
|
|
||||||
//========== End mouse listener inits
|
//========== End mouse listener inits
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@@ -114,6 +116,7 @@ public enum CDev implements ICDoc {
|
|||||||
VDev.SINGLETON_INSTANCE.getLblBreakpoint().addMouseListener(madBreakpoint);
|
VDev.SINGLETON_INSTANCE.getLblBreakpoint().addMouseListener(madBreakpoint);
|
||||||
VDev.SINGLETON_INSTANCE.getLblCardToBattlefield().addMouseListener(madCardToBattlefield);
|
VDev.SINGLETON_INSTANCE.getLblCardToBattlefield().addMouseListener(madCardToBattlefield);
|
||||||
VDev.SINGLETON_INSTANCE.getLblRiggedRoll().addMouseListener(madRiggedRoll);
|
VDev.SINGLETON_INSTANCE.getLblRiggedRoll().addMouseListener(madRiggedRoll);
|
||||||
|
VDev.SINGLETON_INSTANCE.getLblWalkTo().addMouseListener(madWalkToPlane);
|
||||||
|
|
||||||
ForgePreferences prefs = Singletons.getModel().getPreferences();
|
ForgePreferences prefs = Singletons.getModel().getPreferences();
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ public enum VDev implements IVDoc<CDev> {
|
|||||||
private final DevLabel lblCardToHand = new DevLabel("Add card to hand");
|
private final DevLabel lblCardToHand = new DevLabel("Add card to hand");
|
||||||
private final DevLabel lblBreakpoint = new DevLabel("Trigger breakpoint");
|
private final DevLabel lblBreakpoint = new DevLabel("Trigger breakpoint");
|
||||||
private final DevLabel lblRiggedRoll = new DevLabel("Rigged planar roll");
|
private final DevLabel lblRiggedRoll = new DevLabel("Rigged planar roll");
|
||||||
|
private final DevLabel lblWalkTo = new DevLabel("Planeswalk to");
|
||||||
|
|
||||||
//========= Constructor
|
//========= Constructor
|
||||||
|
|
||||||
@@ -93,6 +94,7 @@ public enum VDev implements IVDoc<CDev> {
|
|||||||
devLBLs.add(lblUntapPermanent);
|
devLBLs.add(lblUntapPermanent);
|
||||||
devLBLs.add(lblSetLife);
|
devLBLs.add(lblSetLife);
|
||||||
devLBLs.add(lblBreakpoint);
|
devLBLs.add(lblBreakpoint);
|
||||||
|
devLBLs.add(lblWalkTo);
|
||||||
|
|
||||||
scroller.setBorder(null);
|
scroller.setBorder(null);
|
||||||
scroller.setOpaque(false);
|
scroller.setOpaque(false);
|
||||||
@@ -105,8 +107,8 @@ public enum VDev implements IVDoc<CDev> {
|
|||||||
viewport.add(this.lblTutor, constraints);
|
viewport.add(this.lblTutor, constraints);
|
||||||
viewport.add(this.lblCardToHand, halfConstraints + ", split 2");
|
viewport.add(this.lblCardToHand, halfConstraints + ", split 2");
|
||||||
viewport.add(this.lblCardToBattlefield, halfConstraints);
|
viewport.add(this.lblCardToBattlefield, halfConstraints);
|
||||||
|
viewport.add(this.lblRiggedRoll, halfConstraints + ", split 2");
|
||||||
viewport.add(this.lblRiggedRoll, constraints);
|
viewport.add(this.lblWalkTo, halfConstraints);
|
||||||
viewport.add(this.lblMilling, constraints);
|
viewport.add(this.lblMilling, constraints);
|
||||||
viewport.add(this.lblUnlimitedLands, constraints);
|
viewport.add(this.lblUnlimitedLands, constraints);
|
||||||
viewport.add(this.lblSetupGame, constraints);
|
viewport.add(this.lblSetupGame, constraints);
|
||||||
@@ -233,6 +235,10 @@ public enum VDev implements IVDoc<CDev> {
|
|||||||
return this.lblRiggedRoll;
|
return this.lblRiggedRoll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DevLabel getLblWalkTo() {
|
||||||
|
return this.lblWalkTo;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Labels that act as buttons which control dev mode functions. Labels are
|
* Labels that act as buttons which control dev mode functions. Labels are
|
||||||
* used to support multiline text.
|
* used to support multiline text.
|
||||||
|
|||||||
Reference in New Issue
Block a user