diff --git a/.idea/misc.xml b/.idea/misc.xml
index c496ad9..fa20b13 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -9,7 +9,7 @@
-
+
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 4d27f11..ccfdf14 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,7 +2,12 @@
+
+
+
+
+
@@ -17,10 +22,82 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -29,28 +106,10 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -66,10 +125,6 @@
- numOfLittyShips
- delay
- Hp
- shipwarfare
destroyPeasa
destr
destro
@@ -96,6 +151,10 @@
continue
cashTex
cashTe
+ 10000
+ too
+ shipstatusstr
+ shipstatus
HP
@@ -122,16 +181,17 @@
+
-
-
-
-
-
+
+
+
+
+
@@ -139,6 +199,7 @@
+
@@ -155,7 +216,6 @@
-
@@ -163,7 +223,7 @@
-
+
@@ -507,13 +567,13 @@
-
+
-
+
-
+
@@ -522,7 +582,7 @@
-
+
@@ -677,62 +737,29 @@
-
-
-
-
+
-
-
-
-
-
+
+
-
+
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -746,17 +773,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Player.java b/src/Player.java
index f846f0b..7fd869e 100644
--- a/src/Player.java
+++ b/src/Player.java
@@ -1,5 +1,3 @@
-import java.util.Scanner;
-
public class Player {
private String name = "Taipan";
diff --git a/src/StartGUI.java b/src/StartGUI.java
index 863ccaa..f545a7c 100644
--- a/src/StartGUI.java
+++ b/src/StartGUI.java
@@ -140,16 +140,14 @@ public class StartGUI {
String response = nameField.getText();
// purely for testing purposes.
- if (player.getName().equalsIgnoreCase("Vikram")) {
+ if (response.equalsIgnoreCase("Vikram")) {
player.setMoney(999999999);
player.setBank(999999999);
- player.setGuns(999);
+ player.setGuns(0);
player.setHP(99999999);
- player.setCargoSpace(99999999);
- }
- else{
- setFirm(response);
+ player.setCargoSpace(Integer.MAX_VALUE);
}
+ setFirm(response);
TaipanShopGUI shop = new TaipanShopGUI(player);
shop.initializeShop(stage);
diff --git a/src/TaipanShop.java b/src/TaipanShop.java
index 9e8af02..e1c0399 100644
--- a/src/TaipanShop.java
+++ b/src/TaipanShop.java
@@ -1,6 +1,65 @@
import java.util.Random;
import java.util.Scanner;
-public class TaipanShop {
+import javafx.application.Application;
+import javafx.geometry.Insets;
+import javafx.scene.Scene;
+import javafx.scene.control.Label;
+import javafx.scene.layout.GridPane;
+import javafx.scene.layout.HBox;
+import javafx.stage.Stage;
+public class TaipanShop extends Application {
+
+ public static void main(String args[]){
+ launch(args);
+ }
+ public void start(Stage stage){
+ stage.setTitle("Shop");
+
+ GridPane grid = new GridPane();
+ grid.setPadding(new Insets(10,10,10,10));
+ grid.setVgap(20);
+ grid.setHgap(20);
+
+ grid.add(new Label("Firm: "+ player.getName()), 2, 0);
+
+ HBox warehouse = new HBox();
+ warehouse.setSpacing(20);
+ int itemsInWarehouse = player.getwOpium()+player.getwGeneral()+player.getwArms()+player.getwSilk();
+ Label ware1 = new Label("Warehouse\n\tOpium\n\tSilk\n\tArms\n\tGeneral");
+ Label ware2 = new Label("\n"+player.getwOpium()+"\n"+player.getwSilk()+"\n"+player.getwArms()+"\n"+player.getwGeneral());
+ Label ware3 = new Label("\nIn use:\n " + itemsInWarehouse + "\nVacant:\n " + (10000 - itemsInWarehouse));
+ warehouse.getChildren().addAll(ware1, ware2, new Label(), ware3);
+
+ HBox inventory = new HBox();
+ inventory.setSpacing(20);
+ int itemsInInventory = player.getCargoSpace()-player.getSilkHeld()-player.getOpiumHeld()-player.getGeneralHeld()-player.getArmsHeld();
+ Label inv1 = new Label("Hold "+itemsInInventory+"\n\tOpium\n\tSilk\n\tArms\n\tGeneral");
+ Label inv2 = new Label("\n"+player.getOpiumHeld()+"\n"+player.getSilkHeld()+"\n"+player.getArmsHeld()+"\n"+player.getGeneralHeld());
+ Label inv3 = new Label("Guns "+player.getGuns());
+ inventory.getChildren().addAll(inv1, inv2, new Label(), inv3);
+
+ String location;
+ switch(player.getLocation()){
+ case 1: location = "Hong Kong"; break;
+ case 2: location = "Shanghai"; break;
+ case 3: location = "Nagasaki"; break;
+ case 4: location = "Saigon"; break;
+ case 5: location = "Manila"; break;
+ case 6: location = "Singapore"; break;
+ case 7: location = "Batavia"; break;
+ default: location = "Error"; break;
+ }
+
+ grid.add(warehouse, 1, 1);
+ grid.add(inventory, 1, 2);
+ grid.add(new Label("\n\n\n Location\n"+location),3, 1 );
+ grid.add(new Label("Debt\n"+player.getDebt()), 3, 2);
+
+ Scene root = new Scene(grid, 600, 480);
+ stage.setResizable(false);
+ stage.setScene(root);
+ stage.show();
+ }
private Player player;
private int opiumPrice = 16000;
diff --git a/src/TaipanShopGUI.java b/src/TaipanShopGUI.java
index fbf07a9..0a2beee 100644
--- a/src/TaipanShopGUI.java
+++ b/src/TaipanShopGUI.java
@@ -491,7 +491,7 @@ public class TaipanShopGUI {
bankButton.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
- bankGUI bank = new bankGUI();
+ bankGUI bank = new bankGUI(getPlayer());
bank.initializeBank(stage);
stage.show();
}
@@ -520,7 +520,7 @@ public class TaipanShopGUI {
loanButton.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
- loanSharkGUI loan = new loanSharkGUI();
+ loanSharkGUI loan = new loanSharkGUI(getPlayer());
loan.initializeLoanShark(stage);
stage.show();
}
@@ -754,6 +754,7 @@ public class TaipanShopGUI {
stage.setResizable(false);
stage.setScene(root);
+ buttonSetup("reset");
updatePrices();
defaultTextOut();
updateStage();
@@ -778,16 +779,19 @@ public class TaipanShopGUI {
public String shipStatusString(){
String shipStatus;
- switch(player.getHP()){
- case 100: shipStatus = "Mint Condition"; break;
- case 80: shipStatus = "Great"; break;
- case 70: shipStatus = "Good"; break;
- case 60: shipStatus = "Acceptable"; break;
- case 50: shipStatus = "Tolerable"; break;
- case 30: shipStatus = "Damaged"; break;
- case 10: shipStatus = "Poor"; break;
- case 1: shipStatus = "Extremely Poor"; break;
- default: shipStatus = "Sinking"; break;
+ switch(player.getHP()/10){
+ case 10: shipStatus = "Mint Condition"; break;
+ case 9: shipStatus = "Near Perfect"; break;
+ case 8: shipStatus = "Great"; break;
+ case 7: shipStatus = "Good"; break;
+ case 6: shipStatus = "Acceptable"; break;
+ case 5: shipStatus = "Tolerable"; break;
+ case 4: shipStatus = "Needs Repair"; break;
+ case 3: shipStatus = "Damaged"; break;
+ case 2: shipStatus = "Indangered"; break;
+ case 1: shipStatus = "Near Sinking"; break;
+ case 0: shipStatus = "Sinking"; break;
+ default: shipStatus = "Invincible"; break;
}
return shipStatus;
}
diff --git a/src/TravelGUI.java b/src/TravelGUI.java
index 2610d71..90ae4a7 100644
--- a/src/TravelGUI.java
+++ b/src/TravelGUI.java
@@ -427,16 +427,19 @@ public class TravelGUI{
public String shipStatusString(){
String shipStatus;
- switch(player.getHP()){
- case 100: shipStatus = "Mint Condition"; break;
- case 80: shipStatus = "Great"; break;
- case 70: shipStatus = "Good"; break;
- case 60: shipStatus = "Acceptable"; break;
- case 50: shipStatus = "Tolerable"; break;
- case 30: shipStatus = "Damaged"; break;
- case 10: shipStatus = "Poor"; break;
- case 1: shipStatus = "Extremely Poor"; break;
- default: shipStatus = "Sinking"; break;
+ switch(player.getHP()/10){
+ case 10: shipStatus = "Mint Condition"; break;
+ case 9: shipStatus = "Near Perfect"; break;
+ case 8: shipStatus = "Great"; break;
+ case 7: shipStatus = "Good"; break;
+ case 6: shipStatus = "Acceptable"; break;
+ case 5: shipStatus = "Tolerable"; break;
+ case 4: shipStatus = "Needs Repair"; break;
+ case 3: shipStatus = "Damaged"; break;
+ case 2: shipStatus = "Indangered"; break;
+ case 1: shipStatus = "Near Sinking"; break;
+ case 0: shipStatus = "Sinking"; break;
+ default: shipStatus = "Invincible"; break;
}
return shipStatus;
}
diff --git a/src/bankGUI.java b/src/bankGUI.java
index 4818102..5c0ad4d 100644
--- a/src/bankGUI.java
+++ b/src/bankGUI.java
@@ -12,7 +12,7 @@ import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class bankGUI{
- private Player player = new Player();
+ private Player player;
/**
* setter method that takes in a Player object as an argument.
*
@@ -36,19 +36,19 @@ public class bankGUI{
*
//* @param player object of the class Player
*/
- //public bankGUI(Player player){
- // Player playerDummy = new Player(player);
- // this.player = playerDummy;
- //}
+ public bankGUI(Player player){
+ Player playerDummy = new Player(player);
+ this.player = playerDummy;
+ }
public Stage initializeBank(Stage primaryStage) {
primaryStage.setTitle("Bank");
//Declaring each Layout
BorderPane brdr1 = new BorderPane();
- HBox hbx1 = new HBox(10);
- HBox hbx2 = new HBox(10);
- VBox vbx1 = new VBox(10);
+ HBox hbx1 = new HBox(30);
+ HBox hbx2 = new HBox(30);
+ VBox vbx1 = new VBox(30);
//Declaring all Variables
Label l1 = new Label("Player: " + player.getName());
@@ -88,11 +88,11 @@ public class bankGUI{
brdr1.setTop(vbx1);
// Set the event handler when the deposit button is clicked
- boolean keepGoing = true;
b1.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
int withdraw = Integer.parseInt(txtField1.getText());
+ System.out.println(withdraw);
if(withdraw <= player.getBank()){
player.setMoney(withdraw + player.getMoney());
player.setBank(player.getBank()-withdraw);
@@ -111,6 +111,7 @@ public class bankGUI{
@Override
public void handle(ActionEvent event) {
int deposit = Integer.parseInt(txtField1.getText());
+ System.out.println(deposit);
if(deposit <= player.getMoney()){
player.setBank(deposit + player.getBank());
player.setMoney(player.getMoney()-deposit);
@@ -146,7 +147,7 @@ public class bankGUI{
public void start(Stage primaryStage) {
- bankGUI bank = new bankGUI();
+ bankGUI bank = new bankGUI(player);
bank.initializeBank(primaryStage);
primaryStage.show();
}
diff --git a/src/loanSharkGUI.java b/src/loanSharkGUI.java
index c1dc880..4c335cd 100644
--- a/src/loanSharkGUI.java
+++ b/src/loanSharkGUI.java
@@ -12,7 +12,7 @@ import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class loanSharkGUI{
- private Player player = new Player();
+ private Player player;
/**
* setter method that takes in a Player object as an argument.
*
@@ -36,10 +36,10 @@ public class loanSharkGUI{
*
//* @param player object of the class Player
*/
- //public loanSharkGUI(Player player){
- // Player playerDummy = new Player(player);
- // this.player = playerDummy;
- //}
+ public loanSharkGUI(Player player){
+ Player playerDummy = new Player(player);
+ this.player = playerDummy;
+ }
public Stage initializeLoanShark(Stage primaryStage) {
primaryStage.setTitle("Loan Shark");
@@ -151,7 +151,7 @@ public class loanSharkGUI{
public void start(Stage primaryStage) {
- loanSharkGUI loan = new loanSharkGUI();
+ loanSharkGUI loan = new loanSharkGUI(player);
loan.initializeLoanShark(primaryStage);
primaryStage.show();
}