diff --git a/src/controllers/scenecontrollers/GameSceneController.java b/src/controllers/scenecontrollers/GameSceneController.java index 8f0001c..5764c96 100644 --- a/src/controllers/scenecontrollers/GameSceneController.java +++ b/src/controllers/scenecontrollers/GameSceneController.java @@ -14,6 +14,8 @@ import javafx.scene.layout.HBox; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; +import javafx.scene.text.Font; +import javafx.scene.text.FontWeight; import javafx.scene.text.Text; import javafx.stage.Modality; import javafx.stage.Stage; @@ -260,7 +262,9 @@ public void handleEndTurnButton() { public void handleSaveGameButton() { DataManager.saveGame("SaveGame1"); - + Text text = new Text("Game saved as SaveGame1!"); + text.setFont(Font.font("Arial", FontWeight.BOLD, 20)); + gameLog.getChildren().add(text); } public static void handleChanceRegionPopup() { diff --git a/src/models/Agreement.java b/src/models/Agreement.java index 91706b9..4ddd57f 100644 --- a/src/models/Agreement.java +++ b/src/models/Agreement.java @@ -58,7 +58,6 @@ public boolean performOffers(City city, Player player){ firstOffer.performOffer(firstPlayer,secondPlayer); } } - firstOffer.performOffer(firstPlayer, secondPlayer); } } // if secondOffer instanceof ContinuousOffer @@ -77,7 +76,6 @@ public boolean performOffers(City city, Player player){ secondOffer.performOffer(firstPlayer,secondPlayer); } } - secondOffer.performOffer(firstPlayer, secondPlayer); } } } @@ -87,8 +85,15 @@ public boolean performOffers(City city, Player player){ // check offers if city is involved public boolean checkOffers(City city) { if(isOffered) { - return city.getId() == ((ContiuousOffer) firstOffer).getCity().getId() - || city.getId() == ((ContiuousOffer) secondOffer).getCity().getId(); + if(firstOffer instanceof ContiuousOffer){ + return city.getId() == ((ContiuousOffer) firstOffer).getCity().getId(); + } + else if(secondOffer instanceof ContiuousOffer){ + return city.getId() == ((ContiuousOffer) secondOffer).getCity().getId(); + } + else { + return false; + } } else { return false; diff --git a/src/models/SellRegion.java b/src/models/SellRegion.java index b03db09..dcde0ca 100644 --- a/src/models/SellRegion.java +++ b/src/models/SellRegion.java @@ -15,6 +15,7 @@ public void performOffer(Player firstPlayer, Player secondPlayer) { if(secondPlayer.removeCity(city)){ // add city to first player (if possible) firstPlayer.addCity(city); + city.setOwner(firstPlayer); return; } System.out.println("Second player does not own city: " + city.getName()); diff --git a/src/models/TakePercentage.java b/src/models/TakePercentage.java index 4d52b56..c97a619 100644 --- a/src/models/TakePercentage.java +++ b/src/models/TakePercentage.java @@ -14,7 +14,7 @@ public TakePercentage(City city, int percentage){ @Override public void performOffer(Player firstPlayer, Player secondPlayer) { // get percentage of rent from secondPlayers city - double rate = ((double)percentage)/10; + double rate = ((double)percentage)/100; firstPlayer.addMoney(city.getRent() * rate); secondPlayer.addMoney(city.getRent() * (1 - rate)); }