mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
fixed issue 255
This commit is contained in:
parent
abb58c4008
commit
bbb4f8a346
8 changed files with 32 additions and 8 deletions
|
|
@ -312,6 +312,7 @@ public class NewTableDialog extends MageDialog {
|
|||
options.getPlayerTypes().add(player.getPlayerType());
|
||||
}
|
||||
options.setDeckType((String) this.cbDeckType.getSelectedItem());
|
||||
options.setLimited(false);
|
||||
options.setAttackOption((MultiplayerAttackOption) this.cbAttackOption.getSelectedItem());
|
||||
options.setRange((RangeOfInfluence) this.cbRange.getSelectedItem());
|
||||
options.setWinsNeeded((Integer)this.spnNumWins.getValue());
|
||||
|
|
|
|||
|
|
@ -306,6 +306,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
tOptions.getMatchOptions().setWinsNeeded(2);
|
||||
tOptions.getMatchOptions().setAttackOption(MultiplayerAttackOption.LEFT);
|
||||
tOptions.getMatchOptions().setRange(RangeOfInfluence.ALL);
|
||||
tOptions.getMatchOptions().setLimited(true);
|
||||
table = session.createTournamentTable(roomId, tOptions);
|
||||
if (table == null) {
|
||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Error creating table.", "Error", JOptionPane.ERROR_MESSAGE);
|
||||
|
|
|
|||
|
|
@ -209,6 +209,9 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||
DeckView deckView = message.getDeck();
|
||||
Deck deck = DeckUtil.construct(deckView);
|
||||
if (message.getFlag())
|
||||
construct(deck, message.getTableId(), message.getTime());
|
||||
else
|
||||
sideboard(deck, message.getTableId(), message.getTime());
|
||||
}
|
||||
else if (callback.getMethod().equals("construct")) {
|
||||
|
|
|
|||
|
|
@ -514,7 +514,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
options.setWinsNeeded(1);
|
||||
table = session.createTable(roomId, options);
|
||||
session.joinTable(roomId, table.getTableId(), "Human", "Human", 1, Sets.loadDeck("test.dck"));
|
||||
session.joinTable(roomId, table.getTableId(), "Computer", "Computer - minimax", 1, Sets.loadDeck("test.dck"));
|
||||
session.joinTable(roomId, table.getTableId(), "Computer", "Computer - minimax", 5, Sets.loadDeck("test.dck"));
|
||||
session.startGame(roomId, table.getTableId());
|
||||
} catch (Exception ex) {
|
||||
handleError(ex);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class TableClientMessage implements Serializable {
|
|||
private UUID gameId;
|
||||
private UUID playerId;
|
||||
private int time;
|
||||
private boolean flag;
|
||||
private boolean flag = false;
|
||||
|
||||
public TableClientMessage(Deck deck, UUID tableId, int time) {
|
||||
this.deck = new DeckView(deck);
|
||||
|
|
@ -54,6 +54,13 @@ public class TableClientMessage implements Serializable {
|
|||
this.time = time;
|
||||
}
|
||||
|
||||
public TableClientMessage(Deck deck, UUID tableId, int time, boolean flag) {
|
||||
this.deck = new DeckView(deck);
|
||||
this.tableId = tableId;
|
||||
this.time = time;
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public TableClientMessage(UUID gameId, UUID playerId) {
|
||||
this.gameId = gameId;
|
||||
this.playerId = playerId;
|
||||
|
|
|
|||
|
|
@ -381,7 +381,7 @@ public class TableController {
|
|||
User user = UserManager.getInstance().getUser(entry.getKey());
|
||||
int remaining = (int) futureTimeout.getDelay(TimeUnit.SECONDS);
|
||||
if (user != null)
|
||||
user.sideboard(deck, table.getId(), remaining);
|
||||
user.sideboard(deck, table.getId(), remaining, options.isLimited());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -395,6 +395,10 @@ public class TableController {
|
|||
table.construct();
|
||||
}
|
||||
|
||||
public MatchOptions getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public void endGame() {
|
||||
UUID choosingPlayerId = match.getChooser();
|
||||
match.endGame();
|
||||
|
|
|
|||
|
|
@ -139,8 +139,8 @@ public class User {
|
|||
fireCallback(new ClientCallback("startTournament", tournamentId, new TableClientMessage(tournamentId, playerId)));
|
||||
}
|
||||
|
||||
public void sideboard(final Deck deck, final UUID tableId, final int time) {
|
||||
fireCallback(new ClientCallback("sideboard", tableId, new TableClientMessage(deck, tableId, time)));
|
||||
public void sideboard(final Deck deck, final UUID tableId, final int time, boolean limited) {
|
||||
fireCallback(new ClientCallback("sideboard", tableId, new TableClientMessage(deck, tableId, time, limited)));
|
||||
sideboarding.put(tableId, deck);
|
||||
}
|
||||
|
||||
|
|
@ -203,8 +203,8 @@ public class User {
|
|||
entry.getValue().construct(0);
|
||||
}
|
||||
for (Entry<UUID, Deck> entry: sideboarding.entrySet()) {
|
||||
int remaining = TableManager.getInstance().getController(entry.getKey()).getRemainingTime();
|
||||
sideboard(entry.getValue(), entry.getKey(), remaining);
|
||||
TableController controller = TableManager.getInstance().getController(entry.getKey());
|
||||
sideboard(entry.getValue(), entry.getKey(), controller.getRemainingTime(), controller.getOptions().isLimited());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ public class MatchOptions implements Serializable {
|
|||
protected int winsNeeded;
|
||||
protected String gameType;
|
||||
protected String deckType;
|
||||
protected boolean limited;
|
||||
protected List<String> playerTypes = new ArrayList<String>();
|
||||
|
||||
public MatchOptions(String name, String gameType) {
|
||||
|
|
@ -101,4 +102,11 @@ public class MatchOptions implements Serializable {
|
|||
return playerTypes;
|
||||
}
|
||||
|
||||
public boolean isLimited() {
|
||||
return limited;
|
||||
}
|
||||
|
||||
public void setLimited(boolean limited) {
|
||||
this.limited = limited;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue