added free change rack in free round
parent
6f3179ee91
commit
38c6ea073b
|
@ -294,7 +294,7 @@ public class LaticeApplicationWindow extends Application {
|
||||||
//RackChange Button
|
//RackChange Button
|
||||||
Image changeIconImage = new Image("changeIcon.png");
|
Image changeIconImage = new Image("changeIcon.png");
|
||||||
ImageView changeIconView = new ImageView(changeIconImage);
|
ImageView changeIconView = new ImageView(changeIconImage);
|
||||||
changeButton = new Button("Change Rack (3 points)", changeIconView);
|
changeButton = new Button("Change Rack (2 points)", changeIconView);
|
||||||
changeButton.setPrefWidth(Constant.ACTION_BUTTONS_WIDTH);
|
changeButton.setPrefWidth(Constant.ACTION_BUTTONS_WIDTH);
|
||||||
changeButton.setPrefHeight(Constant.ACTION_BUTTONS_HEIGHT);
|
changeButton.setPrefHeight(Constant.ACTION_BUTTONS_HEIGHT);
|
||||||
|
|
||||||
|
@ -396,7 +396,11 @@ public class LaticeApplicationWindow extends Application {
|
||||||
public void handle(MouseEvent arg0) {
|
public void handle(MouseEvent arg0) {
|
||||||
|
|
||||||
////// for the actual player //////
|
////// for the actual player //////
|
||||||
if (player.getScore() >= 3) {
|
if (player.getScore() >= 2 || isFreePlacement) {
|
||||||
|
if (!isFreePlacement) {
|
||||||
|
playerFX.setRemovePointsFromScore(player, 2);
|
||||||
|
}
|
||||||
|
|
||||||
System.out.println("Changing Rack");
|
System.out.println("Changing Rack");
|
||||||
confirmBtnClickedCount++;
|
confirmBtnClickedCount++;
|
||||||
player.getRack().changeRack();
|
player.getRack().changeRack();
|
||||||
|
@ -428,9 +432,10 @@ public class LaticeApplicationWindow extends Application {
|
||||||
setDragnDropOnRectangles(rect, board, referee, player);
|
setDragnDropOnRectangles(rect, board, referee, player);
|
||||||
borderPane.setBottom(rackTileImage);
|
borderPane.setBottom(rackTileImage);
|
||||||
|
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
System.out.println("Not enough points to change the rack");
|
System.out.println("Not enough points to change the rack");
|
||||||
gameInfoLabel.setText("Error !" + player.getName() + ", you haven't enough points to change your rack");
|
gameInfoLabel.setText("Error ! " + player.getName() + ", you haven't enough points to change your rack");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -540,7 +545,7 @@ public class LaticeApplicationWindow extends Application {
|
||||||
|
|
||||||
//testing if player has enough points
|
//testing if player has enough points
|
||||||
if (referee.checkScoreToPlay(player, isFreePlacement) == false) {
|
if (referee.checkScoreToPlay(player, isFreePlacement) == false) {
|
||||||
gameInfoLabel.setText("Error !" + player.getName() + ", you haven't enough points to play another tile");
|
gameInfoLabel.setText("Error ! " + player.getName() + ", you haven't enough points to play another tile");
|
||||||
rect[a][b].setFill(tileOnRect);
|
rect[a][b].setFill(tileOnRect);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
|
@ -591,17 +596,17 @@ public class LaticeApplicationWindow extends Application {
|
||||||
|
|
||||||
if (nbr == 2) {
|
if (nbr == 2) {
|
||||||
System.out.println("Vous avez gagné 1 point");
|
System.out.println("Vous avez gagné 1 point");
|
||||||
gameInfoLabel.setText(player.getName() + "You won 1 point");
|
gameInfoLabel.setText(player.getName() + ", you won 1 point");
|
||||||
playerFX.setAddPointsToScore(player, 1);
|
playerFX.setAddPointsToScore(player, 1);
|
||||||
|
|
||||||
}else if (nbr == 3) {
|
}else if (nbr == 3) {
|
||||||
System.out.println("Vous avez gagné 2 points");
|
System.out.println("Vous avez gagné 2 points");
|
||||||
gameInfoLabel.setText(player.getName() + "You won 2 points");
|
gameInfoLabel.setText(player.getName() + ", you won 2 points");
|
||||||
playerFX.setAddPointsToScore(player, 2);
|
playerFX.setAddPointsToScore(player, 2);
|
||||||
|
|
||||||
}else if (nbr == 4) {
|
}else if (nbr == 4) {
|
||||||
System.out.println("Vous avez gagné 4 points");
|
System.out.println("Vous avez gagné 4 points");
|
||||||
gameInfoLabel.setText(player.getName() + "You won 4 points");
|
gameInfoLabel.setText(player.getName() + ", you won 4 points");
|
||||||
playerFX.setAddPointsToScore(player, 4);
|
playerFX.setAddPointsToScore(player, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,7 +618,7 @@ public class LaticeApplicationWindow extends Application {
|
||||||
//Sun rule
|
//Sun rule
|
||||||
if (referee.sunRule(board, player.getRack().getListRackTile().get(indexTileClicked))) {
|
if (referee.sunRule(board, player.getRack().getListRackTile().get(indexTileClicked))) {
|
||||||
System.out.println("Vous avez gagné 2 points en mettant votre tuile sur un soleil");
|
System.out.println("Vous avez gagné 2 points en mettant votre tuile sur un soleil");
|
||||||
gameInfoLabel.setText("Wow!" + player.getName() + "You won 2 points by placing a tile on a sun !");
|
gameInfoLabel.setText("Wow! " + player.getName() + ", you won 2 points by placing a tile on a sun !");
|
||||||
playerFX.setAddPointsToScore(player, 2);
|
playerFX.setAddPointsToScore(player, 2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -664,7 +669,7 @@ public class LaticeApplicationWindow extends Application {
|
||||||
//Setting drag n drop on tiles
|
//Setting drag n drop on tiles
|
||||||
setDragnDropOnRack(rackTileImage, player);
|
setDragnDropOnRack(rackTileImage, player);
|
||||||
|
|
||||||
rackTileImage.getChildren().addAll(confirmButton, changeButton, buyActionButton);
|
rackTileImage.getChildren().addAll(confirmButton, changeButton/*, buyActionButton*/);
|
||||||
borderPane.setBottom(rackTileImage);
|
borderPane.setBottom(rackTileImage);
|
||||||
tileDropped = false;
|
tileDropped = false;
|
||||||
playerFX.setTilesRemaining(player);
|
playerFX.setTilesRemaining(player);
|
||||||
|
|
Loading…
Reference in New Issue