From 2198fffbd544c3f45d8691f008220c25c44d5540 Mon Sep 17 00:00:00 2001
From: KahootChampion
Date: Sun, 10 Mar 2019 19:41:30 -0600
Subject: [PATCH 1/4] A lot of errors but easily fixable SHipwarfareGUI
---
.idea/workspace.xml | 151 ++++++++++++++++++++++------------------
src/ShipWarfareGUI.java | 58 +++++++++++++--
2 files changed, 134 insertions(+), 75 deletions(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index ff8785b..f748ccb 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,7 +1,10 @@
-
+
+
+
+
@@ -13,55 +16,32 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
+
-
-
+
+
-
+
-
-
-
-
-
-
-
-
-
-
+
@@ -77,8 +57,6 @@
- howMuchRun
- pirateName
player
numOfPeasantShips
peasant
@@ -107,6 +85,8 @@
runFromShips()
dang it!
dang it
+ destroy
+ destroyPeas
HP
@@ -172,7 +152,7 @@
-
+
@@ -192,7 +172,7 @@
-
+
@@ -200,8 +180,8 @@
-
-
+
+
@@ -229,19 +209,19 @@
-
+
+
-
@@ -285,6 +265,8 @@
+
+
1550458470138
@@ -475,17 +457,31 @@
1552240801199
-
+
+ 1552241433802
+
+
+
+ 1552241433802
+
+
+ 1552254331758
+
+
+
+ 1552254331759
+
+
-
+
-
+
@@ -582,9 +578,6 @@
-
-
-
@@ -607,7 +600,10 @@
-
+
+
+
+
@@ -670,23 +666,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -701,14 +680,50 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
diff --git a/src/ShipWarfareGUI.java b/src/ShipWarfareGUI.java
index 92536cb..251ee8c 100644
--- a/src/ShipWarfareGUI.java
+++ b/src/ShipWarfareGUI.java
@@ -29,13 +29,16 @@ public class ShipWarfareGUI {
private Label gunsLeftOrTaken;
private Label continueToFight;
private int counter1;
+ private Button continueButton;
+
+
/*
- /**
- * constructor; only runs when a Player object is provided. The constructor is fully encapsulated.
- *
- * @param player is a Player object that will be copied and the player instance variable is set to the copy.
- */
+ /**
+ * constructor; only runs when a Player object is provided. The constructor is fully encapsulated.
+ *
+ * @param player is a Player object that will be copied and the player instance variable is set to the copy.
+ */
public ShipWarfareGUI(Player player){
Player playerDummy = new Player(player);
this.player = playerDummy;
@@ -175,6 +178,8 @@ public class ShipWarfareGUI {
HPLeft.setVisible(true);
gunsLeftOrTaken.setVisible(true);
continueToFight.setVisible(true);
+ continueButton.setVisible(false);
+
runAwayOrLeft.setText("No ships ran away");
@@ -270,12 +275,14 @@ public class ShipWarfareGUI {
calculateLoot = (startingPeasantShips *100) + randomValue.nextInt(startingPeasantShips) *200;
player.setMoney(player.getMoney() + calculateLoot);
report.setText(String.format("Our firm has earned $%,d in loot! ", calculateLoot));
+ continueButton.setVisible(true);
return true;
} else if (exitValue == 2) {
player.gameOver();
return true;
} else if (exitValue == 3) {
System.out.printf("We made it out at %d%% ship status!\n", player.getHP());
+ continueButton.setVisible(true);
return true;
}
return false;
@@ -302,6 +309,10 @@ public class ShipWarfareGUI {
HPLeft = new Label();
gunsLeftOrTaken = new Label();
continueToFight = new Label();
+ continueButton = new Button();
+
+ continueButton.setVisible(false);
+
BorderPane.setPrefHeight(400.0);
@@ -317,6 +328,9 @@ public class ShipWarfareGUI {
title.setText(String.format("%d ships attacking. Would you like to Fight or Run?",numOfPeasantShips));
title.setPadding(new Insets(6.0, 0.0, 0.0, 0.0));
+ continueButton.setMnemonicParsing(false);
+ continueButton.setText("Continue?");
+
fightButton.setAlignment(javafx.geometry.Pos.CENTER);
fightButton.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER);
fightButton.setId("Button1");
@@ -353,6 +367,8 @@ public class ShipWarfareGUI {
vBox.getChildren().add(HPLeft);
vBox.getChildren().add(gunsLeftOrTaken);
vBox.getChildren().add(continueToFight);
+ vBox.getChildren().add(continueButton);
+
//Fight
fightButton.setOnAction(new EventHandler() {
@@ -361,7 +377,20 @@ public class ShipWarfareGUI {
counter++;
chooseFightOrRun.setText("Ohh, Fight ehh?");
try {
- destroyPeasantShipsOrEscape();
+ if (destroyPeasantShipsOrEscape()){
+ completeWipe();
+ continueButton.setVisible(true);
+ continueButton.setOnAction(new EventHandler() {
+ @Override
+ public void handle(ActionEvent event) {
+ TaipanShopGUI shop = new TaipanShopGUI(player);
+ shop.initializeShop(stage);
+ stage.show();
+ }
+ });
+
+
+ }
} catch (Exception e) {
}
@@ -384,12 +413,27 @@ public class ShipWarfareGUI {
chooseFightOrRun.setVisible(false);
report.setText(("Couldn't run away"));
try {
- destroyPeasantShipsOrEscape();
+ if(destroyPeasantShipsOrEscape()==true){
+ completeWipe();
+ continueButton.setVisible(true);
+ continueButton.setOnAction(new EventHandler() {
+ @Override
+ public void handle(ActionEvent event) {
+ TaipanShopGUI shop = new TaipanShopGUI(player);
+ shop.initializeShop(stage);
+ stage.show();
+ }
+ });
+ }
+
} catch (Exception e) {
}
} else {
completeWipe();
report.setText("Phew! Got away safely");
+ TaipanShopGUI shop = new TaipanShopGUI(player);
+ shop.initializeShop(stage);
+ stage.show();
}
From 664d194d7b25416c09198e552ce61a1244636b1a Mon Sep 17 00:00:00 2001
From: KahootChampion
Date: Sun, 10 Mar 2019 20:00:36 -0600
Subject: [PATCH 2/4] Completed SHipWarfareGUI
---
.idea/workspace.xml | 60 ++++++++++++++++++++++++++---------------
src/ShipWarfareGUI.java | 4 +++
src/TaipanShopGUI.java | 2 +-
3 files changed, 44 insertions(+), 22 deletions(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index f748ccb..a1e2a0c 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,9 +1,10 @@
-
+
+
@@ -19,8 +20,8 @@
-
-
+
+
@@ -28,6 +29,15 @@
+
+
+
+
+
+
+
+
+
@@ -57,9 +67,6 @@
- player
- numOfPeasantShips
- peasant
litty
userAttacks
numOfLittyShips
@@ -87,6 +94,9 @@
dang it
destroy
destroyPeas
+ continue
+ cash
+ op
HP
@@ -113,6 +123,7 @@
+
@@ -152,7 +163,7 @@
-
+
@@ -266,7 +277,7 @@
-
+
1550458470138
@@ -471,11 +482,18 @@
1552254331759
-
+
+ 1552268490741
+
+
+
+ 1552268490741
+
+
-
+
@@ -578,7 +596,6 @@
-
@@ -603,7 +620,8 @@
-
+
+
@@ -697,13 +715,6 @@
-
-
-
-
-
-
-
@@ -718,10 +729,17 @@
+
+
+
+
+
+
+
-
-
+
+
diff --git a/src/ShipWarfareGUI.java b/src/ShipWarfareGUI.java
index 251ee8c..11d66ab 100644
--- a/src/ShipWarfareGUI.java
+++ b/src/ShipWarfareGUI.java
@@ -380,6 +380,8 @@ public class ShipWarfareGUI {
if (destroyPeasantShipsOrEscape()){
completeWipe();
continueButton.setVisible(true);
+ fightButton.setVisible(false);
+ runButton.setVisible(false);
continueButton.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -416,6 +418,8 @@ public class ShipWarfareGUI {
if(destroyPeasantShipsOrEscape()==true){
completeWipe();
continueButton.setVisible(true);
+ fightButton.setVisible(false);
+ runButton.setVisible(false);
continueButton.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
diff --git a/src/TaipanShopGUI.java b/src/TaipanShopGUI.java
index 50fb961..e00af07 100644
--- a/src/TaipanShopGUI.java
+++ b/src/TaipanShopGUI.java
@@ -803,7 +803,7 @@ public class TaipanShopGUI {
gunsText.setText(String.format("Guns %d\n\n\n\n ", player.getGuns()));
inventoryHeldText.setText(String.format("\n %d\n %d\n %d\n %d", player.getOpiumHeld(), player.getSilkHeld(), player.getArmsHeld(), player.getGeneralHeld()));
shipStatusText.setText(String.format("\tDebt\n\t%d\n\n\tShip status\n\t%s: %d", player.getDebt(), shipStatusString(), player.getHP()));
- cashText.setText(String.format(" Cash: %d", player.getMoney()));
+ cashText.setText(String.format(" Cash: $%,d", player.getMoney()));
bankText.setText(String.format("Bank: %d", player.getBank()));
}
From 4fd40af606917691c010bb99b873ffdc71113d41 Mon Sep 17 00:00:00 2001
From: KahootChampion
Date: Sun, 10 Mar 2019 20:01:20 -0600
Subject: [PATCH 3/4] Completed ShipWarfareGUI
---
.idea/workspace.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a1e2a0c..2165b3d 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -163,7 +163,7 @@
-
+
From df372522e497d181573ddd4f15b64f2ea63ac83f Mon Sep 17 00:00:00 2001
From: KahootChampion
Date: Sun, 10 Mar 2019 20:12:01 -0600
Subject: [PATCH 4/4] Probably should upload
---
.idea/workspace.xml | 86 ++++++++++++++++++++++++++-------------------
src/TravelGUI.java | 2 +-
2 files changed, 51 insertions(+), 37 deletions(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 2165b3d..4d27f11 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,8 +3,7 @@
-
-
+
@@ -17,11 +16,11 @@
-
+
-
-
+
+
@@ -32,8 +31,8 @@
-
-
+
+
@@ -47,11 +46,11 @@
-
+
-
-
+
+
@@ -67,8 +66,6 @@
- litty
- userAttacks
numOfLittyShips
delay
Hp
@@ -94,9 +91,11 @@
dang it
destroy
destroyPeas
- continue
cash
op
+ continue
+ cashTex
+ cashTe
HP
@@ -124,6 +123,7 @@
+
@@ -163,7 +163,7 @@
-
+
@@ -277,7 +277,7 @@
-
+
1550458470138
@@ -489,11 +489,25 @@
1552268490741
-
+
+ 1552269636545
+
+
+
+ 1552269636545
+
+
+ 1552269681200
+
+
+
+ 1552269681200
+
+
-
+
@@ -596,8 +610,6 @@
-
-
@@ -621,7 +633,9 @@
-
+
+
+
@@ -715,13 +729,6 @@
-
-
-
-
-
-
-
@@ -729,23 +736,30 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/TravelGUI.java b/src/TravelGUI.java
index 5a5dbf6..a591069 100644
--- a/src/TravelGUI.java
+++ b/src/TravelGUI.java
@@ -449,7 +449,7 @@ public class TravelGUI{
gunsText.setText(String.format("Guns %d\n\n\n\n ", player.getGuns()));
inventoryHeldText.setText(String.format("\n %d\n %d\n %d\n %d", player.getOpiumHeld(), player.getSilkHeld(), player.getArmsHeld(), player.getGeneralHeld()));
shipStatusText.setText(String.format("\tDebt\n\t%d\n\n\tShip status\n\t%s: %d", player.getDebt(), shipStatusString(), player.getHP()));
- cashText.setText(String.format(" Cash: %d", player.getMoney()));
+ cashText.setText(String.format(" Cash: $%,d", player.getMoney()));
bankText.setText(String.format("Bank: %d", player.getBank()));
}