diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 7f4f3c1..9fb2a36 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,6 +4,11 @@
+
+
+
+
+
@@ -28,11 +33,11 @@
-
-
+
+
-
-
+
+
@@ -40,46 +45,52 @@
-
-
-
-
-
-
+
+
-
+
-
-
+
+
-
+
-
+
-
-
+
+
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
@@ -138,22 +149,24 @@
-
-
+
@@ -165,6 +178,7 @@
+
@@ -181,13 +195,12 @@
-
-
+
@@ -248,8 +261,8 @@
-
+
@@ -382,10 +395,10 @@
-
+
-
+
@@ -394,7 +407,7 @@
-
+
@@ -403,8 +416,8 @@
-
-
+
+
@@ -446,45 +459,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -502,6 +476,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/out/production/TaipanClone/ShipWarfare.class b/out/production/TaipanClone/ShipWarfare.class
index 44a3b24..967eead 100644
Binary files a/out/production/TaipanClone/ShipWarfare.class and b/out/production/TaipanClone/ShipWarfare.class differ
diff --git a/src/Bank.java b/src/Bank.java
index 0f6130d..7324a99 100644
--- a/src/Bank.java
+++ b/src/Bank.java
@@ -1,52 +1,52 @@
-import java.util.Scanner;
-
-public class Bank{
-
- private Player player;
- public void setPlayer(Player player) {
- Player playerDummy = new Player(player);
- this.player = playerDummy;
- }
-
- public Player getPlayer(){
- Player playerDummy = new Player(player);
- return playerDummy;
- }
-
- public Bank(Player player){
- Player playerDummy = new Player(player);
- this.player = playerDummy;
- }
-
- public int promtMoney() {
- int addVal = 0;
- int retVal = 0;
- System.out.println("Please enter an amount");
- Scanner keyboard = new Scanner(System.in);
- addVal = keyboard.nextInt();
- if(addVal >= 0) {
- retVal = addVal;
- }
- return retVal;
- }
-
- public void addMoney() {
- int addMon = promtMoney();
- if(addMon >= 0) {
- player.setBank(promtMoney() + player.getMoney());
- }
-
- }
-
- public void removeMoney() {
- int subMon = promtMoney();
- if(subMon <= player.getMoney()) {
- player.setBank(subMon - player.getMoney());
- }
-
- }
-
- public void addInterest() {
- setBank((int)((player.getBank() * 1.05)));
- }
-}
+import java.util.Scanner;
+
+public class Bank{
+
+ private Player player;
+ public void setPlayer(Player player) {
+ Player playerDummy = new Player(player);
+ this.player = playerDummy;
+ }
+
+ public Player getPlayer(){
+ Player playerDummy = new Player(player);
+ return playerDummy;
+ }
+
+ public Bank(Player player){
+ Player playerDummy = new Player(player);
+ this.player = playerDummy;
+ }
+
+ public int promtMoney() {
+ int addVal = 0;
+ int retVal = 0;
+ System.out.println("Please enter an amount");
+ Scanner keyboard = new Scanner(System.in);
+ addVal = keyboard.nextInt();
+ if(addVal >= 0) {
+ retVal = addVal;
+ }
+ return retVal;
+ }
+
+ public void addMoney() {
+ int addMon = promtMoney();
+ if(addMon >= 0) {
+ player.setBank(promtMoney() + player.getMoney());
+ }
+
+ }
+
+ public void removeMoney() {
+ int subMon = promtMoney();
+ if(subMon <= player.getMoney()) {
+ player.setBank(subMon - player.getMoney());
+ }
+
+ }
+
+ public void addInterest() {
+ player.setBank((int)((player.getBank() * 1.01)));
+ }
+}
diff --git a/src/Player.java b/src/Player.java
index aaac9c8..853fad2 100644
--- a/src/Player.java
+++ b/src/Player.java
@@ -29,22 +29,6 @@ public class Player {
this.debt = player.debt;
}
- public Player(){
-
- }
-
- public Player(Player player){
- this.bank = player.bank;
- this.money = player.money;
- this.opiumHeld = player.opiumHeld;
- this.silkHeld = player.silkHeld;
- this.generalHeld = player.generalHeld;
- this.armsHeld = player.armsHeld;
- this.location = player.location;
- this.guns = player.guns;
- this.HP = player.HP;
- }
-
public String getName() {
return name;
}
diff --git a/src/Start.java b/src/Start.java
index 7ce3752..2d0c1b7 100644
--- a/src/Start.java
+++ b/src/Start.java
@@ -1,45 +1,46 @@
-import java.util.Scanner;
-public class Start
-{
- private Player player;
-
- public Player getPlayer() {
- Player playerTemp = new Player(player);
- return playerTemp;
- }
-
- public void setPlayer(Player player) {
- Player playerTemp = new Player(player);
- this.player = playerTemp;
- }
-
- public void setFirm (String name) {
- System.out.println("Taipan, \nWhat will you name your \nFirm: ");
- if (name.length() <= 22) {
- player.setName(name);
- }
- }
- public void main(String[] args)
- {
- System.out.println("Do you want to start . . .\n1) With cash (and a debt)\n>> or <<\n" +
- "With five guns and no cash (But no debt!)\n? ");
- Scanner userInput = new Scanner(System.in);
- if (userInput.nextInt() == 1)
- {
- player.setMoney(400);
- player.setDebt(5000);
-
- }
- if (userInput.nextInt() == 2)
- {
- player.setGuns(5);
- }
- }
-
-
- public Start(Player player)
- {
- Player playerTemp = new Player(player);
- this.player = playerTemp;
- }
-}
+import java.util.Scanner;
+public class Start
+{
+ private Player player;
+
+ public Player getPlayer() {
+ Player playerTemp = new Player(player);
+ return playerTemp;
+ }
+
+ public void setPlayer(Player player) {
+ Player playerTemp = new Player(player);
+ this.player = playerTemp;
+ }
+
+ public void setFirm (String name) {
+ if (name.length() <= 22) {
+ player.setName(name);
+ }
+ }
+ public void intialize()
+ {
+ Scanner userInput = new Scanner(System.in);
+ System.out.println("Taipan, \nWhat will you name your \nFirm: ");
+ setFirm(userInput.nextLine());
+ System.out.println("Do you want to start . . .\n1) With cash (and a debt)\n>> or <<\n" +
+ "With five guns and no cash (But no debt!)\n? ");
+ if (userInput.nextInt() == 1)
+ {
+ player.setMoney(400);
+ player.setDebt(5000);
+
+ }
+ if (userInput.nextInt() == 2)
+ {
+ player.setGuns(5);
+ }
+ }
+
+
+ public Start(Player player)
+ {
+ Player playerTemp = new Player(player);
+ this.player = playerTemp;
+ }
+}
diff --git a/src/Warehouse.java b/src/Warehouse.java
index 872332e..577b80f 100644
--- a/src/Warehouse.java
+++ b/src/Warehouse.java
@@ -1,154 +1,154 @@
- import java.util.Scanner;
-
-public class Warehouse {
- private int wOpium = 25;
- private int wSilk = 0;
- private int wGeneral = 0;
- private int wArms = 0;
- private String good = "";
- private int finalAmount = 0;
- private Player player;
-
-
- public void setPlayer(Player player) {
- Player playerDumy = new Player(player);
- this.player= playerDumy;
- }
-
- public Player getPlayer(){
- Player playerDummy = new Player(player);
- return playerDummy;
- }
-
- public Warehouse(Player player){
- Player playerDummy = new Player(player);
- this.player = playerDummy;
- }
-
-
- public void addAmount(String good, int amount) {
- int held = 0;
- if (amount > 0) {
- if (this.good.equalsIgnoreCase("O")) {
- this.wOpium += amount;
- held = player.getOpiumHeld();
- player.setOpiumHeld(held - amount);
- System.out.println(player.getOpiumHeld());
- }
- else if(this.good.equalsIgnoreCase("S")) {
- this.wSilk += amount;
- held = player.getSilkHeld();
- player.setSilkHeld(held - amount);
- }
- else if(this.good.equalsIgnoreCase("G")) {
- this.wGeneral += amount;
- held = player.getGeneralHeld();
- player.setGeneralHeld(held - amount);
- }
- else if(this.good.equalsIgnoreCase("A")) {
- this.wArms += amount;
- held = player.getArmsHeld();
- player.setArmsHeld(held - amount);
- }
- }
- else {
- System.out.println("Sorry this transfer cannot be made");
- }
- }
- public void removeAmount(String good, int amount) {
- int held = 0;
- if (amount > 0) {
- if (this.good.equalsIgnoreCase("O")) {
- this.wOpium -= amount;
- held = player.getOpiumHeld();
- player.setOpiumHeld(held + amount);
- }
- else if(this.good.equalsIgnoreCase("S")) {
- this.wSilk -= amount;
- held = player.getSilkHeld();
- player.setSilkHeld(held + amount);
- }
- else if(this.good.equalsIgnoreCase("G")) {
- this.wGeneral -= amount;
- held = player.getGeneralHeld();
- player.setGeneralHeld(held + amount);
- }
- else if(this.good.equalsIgnoreCase("A")) {
- this.wArms -= amount;
- held = player.getArmsHeld();
- player.setArmsHeld(held + amount);
- }
- }
- else {
- System.out.println("Sorry this transfer cannot be made");
- }
-
- }
-
- public void showWarehouse() {
- System.out.println("Opium : " + this.wOpium);
- System.out.println("Silk : " + this.wSilk);
- System.out.println("General : " + this.wGeneral);
- System.out.println("Arms : " + this.wArms);
- }
-
- private void askGood() {
- String aGood = "k";
- System.out.println("Please enter a good to transfer O, S, G, A :");
- Scanner keyboard = new Scanner(System.in);
- aGood = keyboard.nextLine();
- aGood = aGood.toUpperCase();
- this.good = aGood;
- }
-
- public void askAddAmount() {
- askGood();
- int amount = 0;
- System.out.println("Please enter the amount of the good you would like to transfer, put negative amount to remove");
- Scanner keyboard = new Scanner(System.in);
- amount = keyboard.nextInt();
- if(this.good.equalsIgnoreCase("O") && amount <= player.getOpiumHeld()) {
- finalAmount = amount;
- }
- else if(this.good.equalsIgnoreCase("S") && amount <= player.getSilkHeld()) {
- finalAmount = amount;
- }
- else if(this.good.equalsIgnoreCase("G") && amount <= player.getGeneralHeld()) {
- finalAmount = amount;
- }
- else if(this.good.equalsIgnoreCase("A") && amount <= player.getArmsHeld()) {
- finalAmount = amount;
- }
- }
-
- public void askRemoveAmount() {
- askGood();
- int amount = 0;
- System.out.println("Please enter the amount of the good you would like to remove");
- Scanner keyboard = new Scanner(System.in);
- amount = keyboard.nextInt();
- if(this.good.equalsIgnoreCase("O") && amount <= this.wOpium) {
- finalAmount = amount;
- }
- else if(this.good.equalsIgnoreCase("S") && amount <= this.wSilk) {
- finalAmount = amount;
- }
- else if(this.good.equalsIgnoreCase("G") && amount <= this.wGeneral) {
- finalAmount = amount;
- }
- else if(this.good.equalsIgnoreCase("A") && amount <= this.wArms) {
- finalAmount = amount;
- }
-
- }
- public static void main(String[] args){
- Warehouse hi = new Warehouse();
- hi.showWarehouse();
- hi.askRemoveAmount();
- hi.removeAmount(hi.good, hi.finalAmount);
- hi.showWarehouse();
- hi.askAddAmount();
- hi.addAmount(hi.good, hi.finalAmount);
- hi.showWarehouse();
- }
-}
+ import java.util.Scanner;
+
+public class Warehouse {
+ private int wOpium = 25;
+ private int wSilk = 0;
+ private int wGeneral = 0;
+ private int wArms = 0;
+ private String good = "";
+ private int finalAmount = 0;
+ private Player player;
+
+
+ public void setPlayer(Player player) {
+ Player playerDumy = new Player(player);
+ this.player= playerDumy;
+ }
+
+ public Player getPlayer(){
+ Player playerDummy = new Player(player);
+ return playerDummy;
+ }
+
+ public Warehouse(Player player){
+ Player playerDummy = new Player(player);
+ this.player = playerDummy;
+ }
+
+
+ public void addAmount(String good, int amount) {
+ int held = 0;
+ if (amount > 0) {
+ if (this.good.equalsIgnoreCase("O")) {
+ this.wOpium += amount;
+ held = player.getOpiumHeld();
+ player.setOpiumHeld(held - amount);
+ System.out.println(player.getOpiumHeld());
+ }
+ else if(this.good.equalsIgnoreCase("S")) {
+ this.wSilk += amount;
+ held = player.getSilkHeld();
+ player.setSilkHeld(held - amount);
+ }
+ else if(this.good.equalsIgnoreCase("G")) {
+ this.wGeneral += amount;
+ held = player.getGeneralHeld();
+ player.setGeneralHeld(held - amount);
+ }
+ else if(this.good.equalsIgnoreCase("A")) {
+ this.wArms += amount;
+ held = player.getArmsHeld();
+ player.setArmsHeld(held - amount);
+ }
+ }
+ else {
+ System.out.println("Sorry this transfer cannot be made");
+ }
+ }
+ public void removeAmount(String good, int amount) {
+ int held = 0;
+ if (amount > 0) {
+ if (this.good.equalsIgnoreCase("O")) {
+ this.wOpium -= amount;
+ held = player.getOpiumHeld();
+ player.setOpiumHeld(held + amount);
+ }
+ else if(this.good.equalsIgnoreCase("S")) {
+ this.wSilk -= amount;
+ held = player.getSilkHeld();
+ player.setSilkHeld(held + amount);
+ }
+ else if(this.good.equalsIgnoreCase("G")) {
+ this.wGeneral -= amount;
+ held = player.getGeneralHeld();
+ player.setGeneralHeld(held + amount);
+ }
+ else if(this.good.equalsIgnoreCase("A")) {
+ this.wArms -= amount;
+ held = player.getArmsHeld();
+ player.setArmsHeld(held + amount);
+ }
+ }
+ else {
+ System.out.println("Sorry this transfer cannot be made");
+ }
+
+ }
+
+ public void showWarehouse() {
+ System.out.println("Opium : " + this.wOpium);
+ System.out.println("Silk : " + this.wSilk);
+ System.out.println("General : " + this.wGeneral);
+ System.out.println("Arms : " + this.wArms);
+ }
+
+ private void askGood() {
+ String aGood = "k";
+ System.out.println("Please enter a good to transfer O, S, G, A :");
+ Scanner keyboard = new Scanner(System.in);
+ aGood = keyboard.nextLine();
+ aGood = aGood.toUpperCase();
+ this.good = aGood;
+ }
+
+ public void askAddAmount() {
+ askGood();
+ int amount = 0;
+ System.out.println("Please enter the amount of the good you would like to transfer, put negative amount to remove");
+ Scanner keyboard = new Scanner(System.in);
+ amount = keyboard.nextInt();
+ if(this.good.equalsIgnoreCase("O") && amount <= player.getOpiumHeld()) {
+ finalAmount = amount;
+ }
+ else if(this.good.equalsIgnoreCase("S") && amount <= player.getSilkHeld()) {
+ finalAmount = amount;
+ }
+ else if(this.good.equalsIgnoreCase("G") && amount <= player.getGeneralHeld()) {
+ finalAmount = amount;
+ }
+ else if(this.good.equalsIgnoreCase("A") && amount <= player.getArmsHeld()) {
+ finalAmount = amount;
+ }
+ }
+
+ public void askRemoveAmount() {
+ askGood();
+ int amount = 0;
+ System.out.println("Please enter the amount of the good you would like to remove");
+ Scanner keyboard = new Scanner(System.in);
+ amount = keyboard.nextInt();
+ if(this.good.equalsIgnoreCase("O") && amount <= this.wOpium) {
+ finalAmount = amount;
+ }
+ else if(this.good.equalsIgnoreCase("S") && amount <= this.wSilk) {
+ finalAmount = amount;
+ }
+ else if(this.good.equalsIgnoreCase("G") && amount <= this.wGeneral) {
+ finalAmount = amount;
+ }
+ else if(this.good.equalsIgnoreCase("A") && amount <= this.wArms) {
+ finalAmount = amount;
+ }
+
+ }
+ public static void main(String[] args){
+ Warehouse hi = new Warehouse(new Player());
+ hi.showWarehouse();
+ hi.askRemoveAmount();
+ hi.removeAmount(hi.good, hi.finalAmount);
+ hi.showWarehouse();
+ hi.askAddAmount();
+ hi.addAmount(hi.good, hi.finalAmount);
+ hi.showWarehouse();
+ }
+}
diff --git a/src/main.java b/src/main.java
index 4a80db6..7c6394d 100644
--- a/src/main.java
+++ b/src/main.java
@@ -13,6 +13,18 @@ public class main {
player = shop.getPlayer();
}
+ public void start(Start start){
+ start.setPlayer(player);
+ start.intialize();
+ player = start.getPlayer();
+ }
+
+ public void warehouse(Warehouse warehouse){
+ warehouse.setPlayer(player);
+ //warehouse.intialize();
+ player = warehouse.getPlayer();
+ }
+
public void peasantFleet(ShipWarfare warfare) throws Exception {
warfare.setPlayer(player);
warfare.peasantFleetAttack();
@@ -23,6 +35,8 @@ public class main {
main main = new main();
ShipWarfare littyWarfare = new ShipWarfare(main.getPlayer());
TaipanShop littyShop = new TaipanShop(main.getPlayer());
+ Start start = new Start(main.getPlayer());
+
main.shop(littyShop);