Helath not lowering anymore
This commit is contained in:
@@ -28,7 +28,6 @@ import java.util.concurrent.ExecutionException;
|
||||
|
||||
public class ShipWarfareGUI extends Player {
|
||||
|
||||
private ShipWarfareGUILogic logic;
|
||||
private Circle cannon;
|
||||
private VBox buttonBox;
|
||||
private HBox fightRunBox;
|
||||
@@ -49,7 +48,6 @@ public class ShipWarfareGUI extends Player {
|
||||
private int checkIfDone;
|
||||
|
||||
|
||||
|
||||
private int timeCounter;
|
||||
|
||||
|
||||
@@ -73,9 +71,6 @@ public class ShipWarfareGUI extends Player {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets most of the labels invisible except for the "fight or run" label
|
||||
*/
|
||||
@@ -102,9 +97,6 @@ public class ShipWarfareGUI extends Player {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Player attacks enemy ships in an animation
|
||||
*/
|
||||
@@ -163,8 +155,11 @@ public class ShipWarfareGUI extends Player {
|
||||
});
|
||||
}
|
||||
|
||||
public boolean winOrLose( Stage stage){
|
||||
if (logic.destroyLittyShipsOrEscape() == 1) {
|
||||
public boolean winOrLose(Stage stage) {
|
||||
ShipWarfareGUILogic logic = new ShipWarfareGUILogic(getPlayer());
|
||||
|
||||
int commenceFire = logic.destroyLittyShipsOrEscape();
|
||||
if (commenceFire == 1) {
|
||||
wipe();
|
||||
report.setText(logic.getReportMessage());
|
||||
continueButton.setVisible(true);
|
||||
@@ -175,13 +170,14 @@ public class ShipWarfareGUI extends Player {
|
||||
return true;
|
||||
|
||||
|
||||
} else if (logic.destroyLittyShipsOrEscape() == 2) {
|
||||
} else if (commenceFire == 2) {
|
||||
GameEndGUI gameEndGUI = new GameEndGUI(getPlayer());
|
||||
gameEndGUI.initializeGameEndGUI(stage);
|
||||
stage.show();
|
||||
return true;
|
||||
|
||||
} else if (logic.destroyLittyShipsOrEscape() == 3) {
|
||||
} else if (commenceFire == 3) {
|
||||
|
||||
report.setText(logic.getReportMessage());
|
||||
continueButton.setVisible(true);
|
||||
completeWipe();
|
||||
@@ -189,15 +185,12 @@ public class ShipWarfareGUI extends Player {
|
||||
runButton.setVisible(false);
|
||||
continueButton.setDefaultButton(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Generaties ships and deploys logic for the shipwarfare
|
||||
*
|
||||
@@ -223,7 +216,7 @@ public class ShipWarfareGUI extends Player {
|
||||
BorderPane encompassingPane = new BorderPane();
|
||||
HBox usAgainstEnemyDivisor = new HBox();
|
||||
Circle cannon = new Circle();
|
||||
logic = new ShipWarfareGUILogic(getPlayer());
|
||||
ShipWarfareGUILogic logic = new ShipWarfareGUILogic(getPlayer());
|
||||
|
||||
|
||||
cannon.setLayoutX(beginningX);
|
||||
@@ -391,20 +384,22 @@ public class ShipWarfareGUI extends Player {
|
||||
title.setText("Ayy captain we will try to run!");
|
||||
report.setText("Epic");
|
||||
counter++;
|
||||
|
||||
ShipWarfareGUILogic logic = new ShipWarfareGUILogic(getPlayer());
|
||||
if (logic.runFromShips() == false) {
|
||||
report.setText(("Couldn't run away"));
|
||||
try {
|
||||
checkIfDone = logic.destroyLittyShipsOrEscape();
|
||||
checkIfDone = logic.destroyLittyShipsOrEscape();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (checkIfDone != 4 ) {
|
||||
if (checkIfDone != 4) {
|
||||
report.setVisible(true);
|
||||
title.setVisible(true);
|
||||
shipsRemaining.setVisible(true);
|
||||
gunsLeftOrTaken.setVisible(true);
|
||||
|
||||
} else {
|
||||
gunsLeftOrTaken.setText("AYYYY");
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -435,7 +430,7 @@ public class ShipWarfareGUI extends Player {
|
||||
runButton.setVisible(false);
|
||||
|
||||
try {
|
||||
winOrLose(primaryStage);
|
||||
winOrLose(primaryStage);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -461,7 +456,7 @@ public class ShipWarfareGUI extends Player {
|
||||
*/
|
||||
public void handle(ActionEvent event) {
|
||||
shotsFired.stop();
|
||||
if (checkIfDone==4) {
|
||||
if (checkIfDone == 4) {
|
||||
shipsRetaliate();
|
||||
} else {
|
||||
report.setVisible(true);
|
||||
|
||||
@@ -271,7 +271,8 @@ public class ShipWarfareGUILogic extends Player {
|
||||
|
||||
if (exitValue == 1) {
|
||||
setAvenue(1);
|
||||
calculateLoot = (startingLittyShips * 100) + randomValue.nextInt(startingLittyShips) * 200;
|
||||
//calculateLoot = (startingLittyShips * 100) + randomValue.nextInt(startingLittyShips) * 200;
|
||||
calculateLoot = 100;
|
||||
setMoney(getMoney() + calculateLoot);
|
||||
setReportMessage(String.format("Our firm has earned $%,d in loot! ", calculateLoot));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user