mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
- Dev Mode: added a new function "Remove Card from Game", which allows to completely remove a card from the game in case it was added previously by mistake.
This commit is contained in:
@@ -79,7 +79,7 @@ public enum CSubmenuPuzzleCreate implements ICDoc, IMenuProvider {
|
||||
|
||||
private void startPuzzleCreate() {
|
||||
String firstPlayer = SGuiChoose.one("Who should be the first to take a turn?",
|
||||
Arrays.asList(new String[] {"Human", "AI"}));
|
||||
Arrays.asList("Human", "AI"));
|
||||
|
||||
final Puzzle emptyPuzzle = new Puzzle(generateEmptyPuzzle(firstPlayer));
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ public final class CDev implements ICDoc {
|
||||
view.getLblWinGame().addMouseListener(madWinGame);
|
||||
view.getLblCardToBattlefield().addMouseListener(madCardToBattlefield);
|
||||
view.getLblExileFromPlay().addMouseListener(madExileFromPlay);
|
||||
view.getLblRemoveFromGame().addMouseListener(madRemoveFromGame);
|
||||
view.getLblRiggedRoll().addMouseListener(madRiggedRoll);
|
||||
view.getLblWalkTo().addMouseListener(madWalkToPlane);
|
||||
}
|
||||
@@ -246,6 +247,16 @@ public final class CDev implements ICDoc {
|
||||
getController().cheat().exileCardsFromBattlefield();
|
||||
}
|
||||
|
||||
private final MouseListener madRemoveFromGame = new MouseAdapter() {
|
||||
@Override
|
||||
public void mousePressed(final MouseEvent e) {
|
||||
removeCardsFromGame();
|
||||
}
|
||||
};
|
||||
public void removeCardsFromGame() {
|
||||
getController().cheat().removeCardsFromGame();
|
||||
}
|
||||
|
||||
private final MouseListener madRiggedRoll = new MouseAdapter() {
|
||||
@Override
|
||||
public void mousePressed(final MouseEvent e) {
|
||||
|
||||
@@ -72,6 +72,7 @@ public class VDev implements IVDoc<CDev>, IDevListener {
|
||||
private final DevLabel lblCardToLibrary = new DevLabel("Add Card to Library");
|
||||
private final DevLabel lblCardToGraveyard = new DevLabel("Add Card to Graveyard");
|
||||
private final DevLabel lblCardToExile = new DevLabel("Add Card to Exile");
|
||||
private final DevLabel lblRemoveFromGame = new DevLabel("Remove Card from Game");
|
||||
|
||||
private final DevLabel lblRiggedRoll = new DevLabel("Rigged Planar Roll");
|
||||
private final DevLabel lblWalkTo = new DevLabel("Planeswalk to");
|
||||
@@ -97,8 +98,9 @@ public class VDev implements IVDoc<CDev>, IDevListener {
|
||||
viewport.add(this.lblCardToLibrary, halfConstraintsLeft);
|
||||
viewport.add(this.lblCardToGraveyard, halfConstraints);
|
||||
viewport.add(this.lblCardToExile, halfConstraintsLeft);
|
||||
viewport.add(this.lblSetLife, halfConstraints);
|
||||
viewport.add(this.lblWinGame, constraints);
|
||||
viewport.add(this.lblRemoveFromGame, halfConstraints);
|
||||
viewport.add(this.lblSetLife, halfConstraintsLeft);
|
||||
viewport.add(this.lblWinGame, halfConstraints);
|
||||
viewport.add(this.lblSetupGame, halfConstraintsLeft);
|
||||
viewport.add(this.lblDumpGame, halfConstraints);
|
||||
viewport.add(this.lblUnlimitedLands, constraints);
|
||||
@@ -223,6 +225,11 @@ public class VDev implements IVDoc<CDev>, IDevListener {
|
||||
return this.lblExileFromPlay;
|
||||
}
|
||||
|
||||
/** @return {@link forge.screens.match.views.VDev.DevLabel} */
|
||||
public DevLabel getLblRemoveFromGame() {
|
||||
return this.lblRemoveFromGame;
|
||||
}
|
||||
|
||||
/** @return {@link forge.screens.match.views.VDev.DevLabel} */
|
||||
public DevLabel getLblCounterPermanent() {
|
||||
return this.lblCounterPermanent;
|
||||
|
||||
@@ -110,6 +110,17 @@ public class VDevMenu extends FDropDownMenu {
|
||||
});
|
||||
}
|
||||
}));
|
||||
addItem(new FMenuItem("Remove Card from Game", new FEventHandler() {
|
||||
@Override
|
||||
public void handleEvent(FEvent e) {
|
||||
ThreadUtil.invokeInGameThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MatchController.instance.getGameController().cheat().removeCardsFromGame();
|
||||
}
|
||||
});
|
||||
}
|
||||
}));
|
||||
addItem(new FMenuItem("Set Player Life", new FEventHandler() {
|
||||
@Override
|
||||
public void handleEvent(FEvent e) {
|
||||
|
||||
@@ -42,6 +42,8 @@ public interface IDevModeCheats {
|
||||
*/
|
||||
void exileCardsFromBattlefield();
|
||||
|
||||
void removeCardsFromGame();
|
||||
|
||||
void addCardToBattlefield();
|
||||
|
||||
void riggedPlanarRoll();
|
||||
@@ -113,6 +115,9 @@ public interface IDevModeCheats {
|
||||
@Override
|
||||
public void addCardToExile() {
|
||||
}
|
||||
@Override
|
||||
public void removeCardsFromGame() {
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
@@ -2199,6 +2199,42 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see forge.player.IDevModeCheats#exileCardsFromBattlefield()
|
||||
*/
|
||||
@Override
|
||||
public void removeCardsFromGame() {
|
||||
final Player p = game.getPlayer(getGui().oneOrNone("Remove card(s) belonging to which player?",
|
||||
PlayerView.getCollection(game.getPlayers())));
|
||||
if (p == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String zone = getGui().one("Remove card(s) from which zone?",
|
||||
Arrays.asList("Hand", "Battlefield", "Library", "Graveyard", "Exile"));
|
||||
|
||||
final CardCollection selection;
|
||||
|
||||
CardCollectionView cards = p.getCardsIn(ZoneType.smartValueOf(zone));
|
||||
selection = game.getCardList(getGui().many("Choose cards to remove from game", "Removed", 0, -1,
|
||||
CardView.getCollection(cards), null));
|
||||
|
||||
if (selection != null && selection.size() > 0) {
|
||||
for (Card c : selection) {
|
||||
if (c == null) {
|
||||
continue;
|
||||
}
|
||||
c.ceaseToExist();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(p).append(" removes ").append(c).append(" from game due to Dev Cheats.");
|
||||
game.getGameLog().add(GameLogEntryType.ZONE_CHANGE, sb.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user