Conflict resolution
This commit is contained in:
parent
e862e79a62
commit
7afd79b929
@ -38,7 +38,7 @@ public class App extends Application {
|
||||
public static void startGame(ViewLambda lambda) throws IllegalArgumentException, InvocationTargetException, NoSuchMethodException,
|
||||
InstantiationException, IllegalAccessException {
|
||||
List<Player> 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)));
|
||||
}
|
||||
|
@ -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<Player> 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;
|
||||
}
|
||||
|
@ -23,27 +23,15 @@ public class Game {
|
||||
private Action selectedAction = null;
|
||||
|
||||
public Game(Grid grid, List<Player> 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();
|
||||
|
@ -22,7 +22,7 @@ public class Mock {
|
||||
public Mock() {
|
||||
List<Player> 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();
|
||||
|
Loading…
Reference in New Issue
Block a user