mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Sealed Deck gauntlets can now have up to 7 rounds, Draft support added to GauntletMini.java.
This commit is contained in:
@@ -19,6 +19,7 @@ package forge.game.limited;
|
|||||||
|
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.SwingWorker;
|
import javax.swing.SwingWorker;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import forge.Constant;
|
import forge.Constant;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
@@ -43,6 +44,8 @@ public class GauntletMini {
|
|||||||
private int currentRound;
|
private int currentRound;
|
||||||
private int wins;
|
private int wins;
|
||||||
private int losses;
|
private int losses;
|
||||||
|
private GameType gauntletType;
|
||||||
|
private List<Deck> aiDecks;
|
||||||
|
|
||||||
// private final String humanName;
|
// private final String humanName;
|
||||||
/**
|
/**
|
||||||
@@ -52,7 +55,8 @@ public class GauntletMini {
|
|||||||
currentRound = 1;
|
currentRound = 1;
|
||||||
wins = 0;
|
wins = 0;
|
||||||
losses = 0;
|
losses = 0;
|
||||||
// humanName = hName;
|
gauntletType = GameType.Sealed; // Assignable in launch();
|
||||||
|
aiDecks = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,7 +67,7 @@ public class GauntletMini {
|
|||||||
* the number of rounds in the mini tournament
|
* the number of rounds in the mini tournament
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void setRounds(int gameRounds) {
|
private void setRounds(int gameRounds) {
|
||||||
rounds = gameRounds;
|
rounds = gameRounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +79,7 @@ public class GauntletMini {
|
|||||||
* @param hDeck
|
* @param hDeck
|
||||||
* the human deck for this tournament
|
* the human deck for this tournament
|
||||||
*/
|
*/
|
||||||
public void setHumanDeck(Deck hDeck) {
|
private void setHumanDeck(Deck hDeck) {
|
||||||
humanDeck = hDeck;
|
humanDeck = hDeck;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,13 +90,13 @@ public class GauntletMini {
|
|||||||
wins = 0;
|
wins = 0;
|
||||||
losses = 0;
|
losses = 0;
|
||||||
Constant.Runtime.HUMAN_DECK[0] = humanDeck;
|
Constant.Runtime.HUMAN_DECK[0] = humanDeck;
|
||||||
Constant.Runtime.COMPUTER_DECK[0] = Singletons.getModel().getDecks().getSealed().get(humanDeck.getName()).getAiDecks().get(0);
|
Constant.Runtime.COMPUTER_DECK[0] = aiDecks.get(0);
|
||||||
currentRound = 1;
|
currentRound = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Advances the tournamen to the next round.
|
* Advances the tournament to the next round.
|
||||||
*/
|
*/
|
||||||
public void nextRound() {
|
public void nextRound() {
|
||||||
|
|
||||||
@@ -103,15 +107,44 @@ public class GauntletMini {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Constant.Runtime.HUMAN_DECK[0] = humanDeck;
|
Constant.Runtime.HUMAN_DECK[0] = humanDeck;
|
||||||
Constant.Runtime.COMPUTER_DECK[0] = Singletons.getModel().getDecks().getSealed().get(humanDeck.getName()).getAiDecks().get(currentRound);
|
Constant.Runtime.COMPUTER_DECK[0] = aiDecks.get(currentRound);
|
||||||
currentRound += 1;
|
currentRound += 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Setup and launch the gauntlet.
|
||||||
|
* Note: The AI decks are connected to the human deck.
|
||||||
|
*
|
||||||
|
* @param gameRounds
|
||||||
|
* the number of rounds (opponent decks) in this tournament
|
||||||
|
* @param hDeck
|
||||||
|
* the human deck for this tournament
|
||||||
|
* @param gType
|
||||||
|
* game type (Sealed, Draft, Constructed...)
|
||||||
|
*/
|
||||||
|
public void launch(int gameRounds, Deck hDeck, final GameType gType) {
|
||||||
|
setHumanDeck(hDeck);
|
||||||
|
setRounds(gameRounds);
|
||||||
|
gauntletType = gType;
|
||||||
|
if (gauntletType == GameType.Sealed) {
|
||||||
|
aiDecks = Singletons.getModel().getDecks().getSealed().get(humanDeck.getName()).getAiDecks();
|
||||||
|
}
|
||||||
|
else if (gauntletType == GameType.Draft) {
|
||||||
|
aiDecks = Singletons.getModel().getDecks().getDraft().get(humanDeck.getName()).getAiDecks();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new IllegalStateException("Cannot launch Gauntlet, game mode not implemented.");
|
||||||
|
}
|
||||||
|
resetCurrentRound();
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the tournament.
|
* Starts the tournament.
|
||||||
*/
|
*/
|
||||||
public void launch() {
|
private void start() {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -125,7 +158,7 @@ public class GauntletMini {
|
|||||||
|
|
||||||
public Object doInBackground() {
|
public Object doInBackground() {
|
||||||
|
|
||||||
Constant.Runtime.setGameType(GameType.Sealed);
|
Constant.Runtime.setGameType(gauntletType);
|
||||||
|
|
||||||
GameNew.newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0]);
|
GameNew.newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0]);
|
||||||
|
|
||||||
@@ -143,7 +176,7 @@ public class GauntletMini {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the total number of rounds in the tournament.
|
* Returns the total number of rounds in the tournament.
|
||||||
* @return int, number of rounds in the Sealed Deck tournament
|
* @return int, number of rounds in the tournament
|
||||||
*/
|
*/
|
||||||
public final int getRounds() {
|
public final int getRounds() {
|
||||||
return rounds;
|
return rounds;
|
||||||
@@ -151,7 +184,7 @@ public class GauntletMini {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of the current round in the tournament.
|
* Returns the number of the current round in the tournament.
|
||||||
* @return int, number of rounds in the Sealed Deck tournament
|
* @return int, number of rounds in the tournament
|
||||||
*/
|
*/
|
||||||
public final int getCurrentRound() {
|
public final int getCurrentRound() {
|
||||||
return currentRound;
|
return currentRound;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import forge.control.FControl;
|
|||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.deck.DeckBase;
|
import forge.deck.DeckBase;
|
||||||
import forge.deck.DeckGroup;
|
import forge.deck.DeckGroup;
|
||||||
|
import forge.game.GameType;
|
||||||
import forge.game.limited.SealedDeck;
|
import forge.game.limited.SealedDeck;
|
||||||
import forge.game.limited.SealedDeckFormat;
|
import forge.game.limited.SealedDeckFormat;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiUtils;
|
||||||
@@ -124,12 +125,8 @@ public enum CSubmenuSealed implements ICDoc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int rounds = Singletons.getModel().getDecks().getSealed().get(human.getName()).getAiDecks().size();
|
int rounds = Singletons.getModel().getDecks().getSealed().get(human.getName()).getAiDecks().size();
|
||||||
// System.out.println("There are " + rounds + " rounds in this game.");
|
|
||||||
|
|
||||||
AllZone.getGauntlet().setRounds(rounds);
|
AllZone.getGauntlet().launch(rounds, human, GameType.Sealed);
|
||||||
AllZone.getGauntlet().setHumanDeck(human);
|
|
||||||
AllZone.getGauntlet().resetCurrentRound();
|
|
||||||
AllZone.getGauntlet().launch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
@@ -171,9 +168,12 @@ public enum CSubmenuSealed implements ICDoc {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Integer[] integers = new Integer[5];
|
// This seems to be limited by the MAX_DRAFT_PLAYERS constant
|
||||||
|
// in DeckGroupSerializer.java. You could create more AI decks
|
||||||
|
// but only the first seven would load. --BBU
|
||||||
|
final Integer[] integers = new Integer[7];
|
||||||
|
|
||||||
for (int i = 0; i <= 4; i++) {
|
for (int i = 0; i <= 6; i++) {
|
||||||
integers[i] = Integer.valueOf(i + 1);
|
integers[i] = Integer.valueOf(i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user