mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
removed Game object reference
This commit is contained in:
parent
3b86e421d6
commit
ca4281ed2d
1 changed files with 10 additions and 24 deletions
|
|
@ -32,7 +32,6 @@ import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.Constants.TableState;
|
import mage.Constants.TableState;
|
||||||
import mage.MageItem;
|
|
||||||
import mage.cards.decks.DeckValidator;
|
import mage.cards.decks.DeckValidator;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
|
@ -40,24 +39,22 @@ import mage.players.Player;
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class Table implements MageItem, Serializable {
|
public class Table implements Serializable {
|
||||||
|
|
||||||
private UUID tableId;
|
private UUID tableId;
|
||||||
private String name;
|
private String name;
|
||||||
private Game game;
|
private String gameType;
|
||||||
// private String deckType;
|
|
||||||
private Seat[] seats;
|
private Seat[] seats;
|
||||||
private int numSeats;
|
private int numSeats;
|
||||||
private DeckValidator validator;
|
private DeckValidator validator;
|
||||||
private TableState state = TableState.WAITING;
|
private TableState state = TableState.WAITING;
|
||||||
|
|
||||||
public Table(Game game, DeckValidator validator, List<String> playerTypes) {
|
public Table(String gameType, DeckValidator validator, List<String> playerTypes) {
|
||||||
tableId = UUID.randomUUID();
|
tableId = UUID.randomUUID();
|
||||||
this.numSeats = game.getNumPlayers();
|
this.numSeats = playerTypes.size();
|
||||||
this.game = game;
|
this.gameType = gameType;
|
||||||
createSeats(playerTypes);
|
createSeats(playerTypes);
|
||||||
this.validator = validator;
|
this.validator = validator;
|
||||||
// this.validator = DeckValidatorFactory.getInstance().createDeckValidator(deckType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createSeats(List<String> playerTypes) {
|
private void createSeats(List<String> playerTypes) {
|
||||||
|
|
@ -69,32 +66,27 @@ public class Table implements MageItem, Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return tableId;
|
return tableId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGame(Game game) {
|
// public void setGame(Game game) {
|
||||||
this.game = game;
|
// this.game = game;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public void initGame() throws GameException {
|
public void initGame(Game game) throws GameException {
|
||||||
for (int i = 0; i < numSeats; i++ ) {
|
for (int i = 0; i < numSeats; i++ ) {
|
||||||
game.addPlayer(seats[i].getPlayer());
|
game.addPlayer(seats[i].getPlayer());
|
||||||
}
|
}
|
||||||
state = TableState.DUELING;
|
state = TableState.DUELING;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void replayGame() {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void endGame() {
|
public void endGame() {
|
||||||
state = TableState.FINISHED;
|
state = TableState.FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGameType() {
|
public String getGameType() {
|
||||||
return game.getGameType();
|
return gameType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDeckType() {
|
public String getDeckType() {
|
||||||
|
|
@ -131,7 +123,6 @@ public class Table implements MageItem, Serializable {
|
||||||
if (seats[i].getPlayer().getId().equals(playerId))
|
if (seats[i].getPlayer().getId().equals(playerId))
|
||||||
seats[i].setPlayer(null);
|
seats[i].setPlayer(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TableState getState() {
|
public TableState getState() {
|
||||||
|
|
@ -142,9 +133,4 @@ public class Table implements MageItem, Serializable {
|
||||||
return this.validator;
|
return this.validator;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void checkTable() {
|
|
||||||
// if (game != null && state == TableState.DUELING && game.isGameOver())
|
|
||||||
// state = TableState.FINISHED;
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue