From 8d07d531de7a4714803330870a44a0fb1f6459be Mon Sep 17 00:00:00 2001
From: KahootChampion
Date: Sat, 6 Apr 2019 16:24:47 -0600
Subject: [PATCH] Helath not lowering anymore
---
.idea/workspace.xml | 212 +++++++++++++++++++++++++----------
src/ShipWarfareGUI.java | 39 +++----
src/ShipWarfareGUILogic.java | 3 +-
3 files changed, 169 insertions(+), 85 deletions(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index e531918..a141c98 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,7 +1,7 @@
-
+
@@ -20,8 +20,8 @@
-
-
+
+
@@ -33,8 +33,8 @@
-
-
+
+
@@ -42,29 +42,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- continueButton
- continueButton.setV
- .setText
- .setVisi
- taipanSH
- runButton.setOn
- runButton.se
- setVis
- counter
- stage
- run
flee
runFrom
report
@@ -84,6 +118,17 @@
getGuns
!
earned
+ destroyLitty
+ des
+ counter1
+ destro
+ logic
+ getNum
+ boolean
+ initializetrace
+ checkIfDone
+ winOrLose
+ setNum
HP
@@ -122,6 +167,7 @@
+
@@ -159,15 +205,15 @@
-
+
-
+
@@ -308,28 +354,9 @@
-
-
-
- 1552168801248
-
-
-
- 1552168801248
-
-
- 1552172956109
-
-
-
- 1552172956109
-
-
- 1552173216531
-
-
-
- 1552173216532
+
+
+
1552181324520
@@ -653,17 +680,37 @@
1553560337526
-
+
+ 1553869256642
+
+
+
+ 1553869256642
+
+
+ 1554437585221
+
+
+
+ 1554437585221
+
+
+ 1554585714023
+
+
+
+ 1554585714024
+
+
-
+
-
-
+
@@ -672,7 +719,7 @@
-
+
@@ -760,8 +807,6 @@
-
-
@@ -785,7 +830,9 @@
-
+
+
+
@@ -917,17 +964,10 @@
-
-
-
-
-
-
-
-
-
+
+
@@ -936,8 +976,8 @@
-
-
+
+
@@ -945,10 +985,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
diff --git a/src/ShipWarfareGUI.java b/src/ShipWarfareGUI.java
index d77eb78..c3b5acd 100644
--- a/src/ShipWarfareGUI.java
+++ b/src/ShipWarfareGUI.java
@@ -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);
diff --git a/src/ShipWarfareGUILogic.java b/src/ShipWarfareGUILogic.java
index abc645f..e007926 100644
--- a/src/ShipWarfareGUILogic.java
+++ b/src/ShipWarfareGUILogic.java
@@ -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));