diff --git a/client/src/main/java/fr/lnl/game/client/App.java b/client/src/main/java/fr/lnl/game/client/App.java index 574a030..5409823 100644 --- a/client/src/main/java/fr/lnl/game/client/App.java +++ b/client/src/main/java/fr/lnl/game/client/App.java @@ -38,7 +38,7 @@ public class App extends Application { public static void startGame(ViewLambda lambda) throws IllegalArgumentException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException { List players = parsePlayers(); - game = new Game(new Grid(12, 12, players), players, new GameFinishEvent()); + game = new Game(new Grid(12, 12, players, 0.80F,0.95F), players, new GameFinishEvent()); for (Player player : game.getPlayers()) { playerList.put(player, new ClientPlayer(player, lambda.createViewLambda(player))); } diff --git a/client/src/main/java/fr/lnl/game/client/view/GUI.java b/client/src/main/java/fr/lnl/game/client/view/GUI.java index 2a33bb6..917913c 100644 --- a/client/src/main/java/fr/lnl/game/client/view/GUI.java +++ b/client/src/main/java/fr/lnl/game/client/view/GUI.java @@ -12,6 +12,7 @@ import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.Pane; import javafx.scene.layout.StackPane; +import javafx.scene.shape.Rectangle; import javafx.stage.Modality; import javafx.stage.Stage; @@ -105,7 +106,7 @@ public class GUI { private Grid getGrid() { List players = Arrays.asList(new RandomComputerPlayer(1, null, ClassPlayer.DEFAULT), new RandomComputerPlayer(2, null, ClassPlayer.DEFAULT)); - Grid grid = new Grid(16, 16, players); + Grid grid = new Grid(16, 16, players, 0.80F, 0.95F); //grid.placePlayersBRUT(); return grid; } diff --git a/server/src/main/java/fr/lnl/game/server/games/Game.java b/server/src/main/java/fr/lnl/game/server/games/Game.java index 0966e38..58b918f 100644 --- a/server/src/main/java/fr/lnl/game/server/games/Game.java +++ b/server/src/main/java/fr/lnl/game/server/games/Game.java @@ -23,27 +23,15 @@ public class Game { private Action selectedAction = null; public Game(Grid grid, List players, ModelListener gameFinishEvent) throws IllegalArgumentException { - if(players.size() < 2) + if(players.size() < 2 || players.size() > grid.getNumberNeutralBox()) throw new IllegalArgumentException("The game need 2 or more player to start"); this.players = players; this.currentPlayer = players.get(0); this.grid = grid; this.gameFinishEvent = gameFinishEvent; - placePlayersBRUT(); currentPlayer.setActions(generateAndGetPlayerActions(currentPlayer)); } - /** - * @deprecated utiliser pour le moment, nécessite une meilleure implémentation pour savoir ou placé les joueurs - */ - @Deprecated - public void placePlayersBRUT(){ - grid.getBoard().get(new Point(7,7)).setA(grid.getPlayers().get(0)); - grid.getPlayers().get(0).setPosition(new Point(7, 7)); - grid.getBoard().get(new Point(7,8)).setA(grid.getPlayers().get(1)); - grid.getPlayers().get(1).setPosition(new Point(7, 8)); - } - public void play() { if (currentPlayer instanceof ComputerPlayer player) { selectedAction = player.choseAction(); diff --git a/server/src/test/java/fr/lnl/game/server/Mock.java b/server/src/test/java/fr/lnl/game/server/Mock.java index 89aa984..a7f5526 100644 --- a/server/src/test/java/fr/lnl/game/server/Mock.java +++ b/server/src/test/java/fr/lnl/game/server/Mock.java @@ -22,7 +22,7 @@ public class Mock { public Mock() { List players = Arrays.asList(new RandomComputerPlayer(1,null, ClassPlayer.DEFAULT), new RandomComputerPlayer(2,null, ClassPlayer.DEFAULT)); - this.grid = new Grid(16,16, players); + this.grid = new Grid(16,16, players,0.80F, 0.95F); placePlayersBRUT(); placeEnergyBallBRUT(); placeInternWallBRUT();