diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 0e191d0..123eccf 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,10 +1,10 @@ - - + - + + @@ -16,17 +16,15 @@ - + - - + + - - - - + + @@ -35,25 +33,17 @@ - - - - - - - - - - + + - + - - + + @@ -96,6 +86,7 @@ opiumHeld hp player. + exitValue player.getName() @@ -111,12 +102,13 @@ - + - + - - + + - - - - - - + + + - + - - - - - - - - - + + - - + + diff --git a/src/Player.java b/src/Player.java index c09d4e3..18d8116 100644 --- a/src/Player.java +++ b/src/Player.java @@ -11,6 +11,7 @@ public class Player { private int guns = 3; private int HP = 100; + public String getName() { return name; } @@ -113,4 +114,11 @@ public class Player { System.out.flush(); System.out.println("Game over"); } + + public static void main(String[] args) throws Exception{ + ShipWarfare littyboi = new ShipWarfare(); + TaipanShop littyShop = new TaipanShop(); + littyShop.shop(); + } + } diff --git a/src/ShipWarfare.java b/src/ShipWarfare.java index 0f73aa5..aec5b46 100644 --- a/src/ShipWarfare.java +++ b/src/ShipWarfare.java @@ -132,15 +132,18 @@ public class ShipWarfare extends Player { System.out.println("Oh no, they are taking the offensive!"); delayForASecond(); //Computer volley - setHP(getHP() - randomValue.nextInt(10)); + setHP(getHP() - (1+ randomValue.nextInt(10))); if (getHP() <= 0) { exitValue = 2; break; } System.out.printf("EEK, we have %d health left\n", getHP()); delayForASecond(); + if(userAttacks==false){ + userAttacks=true; + } - System.out.println("Shall we continue the offensive? Enter \"f\" to fight, and \"r\" to run"); + System.out.println("Shall we continue to fight? Enter \"f\" to fight, and \"r\" to run"); String response = userInput.nextLine(); if (response.equalsIgnoreCase("r")) { @@ -166,7 +169,7 @@ public class ShipWarfare extends Player { gameOver(); return true; } else if (exitValue == 3) { - System.out.println("We made it"); + System.out.printf("We made it out at %d health!\n", getHP()); return true; } return false; diff --git a/src/TaipanShop.java b/src/TaipanShop.java index 15ba226..b7ee380 100644 --- a/src/TaipanShop.java +++ b/src/TaipanShop.java @@ -2,6 +2,7 @@ import java.util.Random; import java.util.Scanner; public class TaipanShop extends Player { + private Player player = new Player(); private int cargoSpace = 60; private int currentCargo = 0; private int opiumPrice = 16000; @@ -395,6 +396,9 @@ public class TaipanShop extends Player { } } + + + public static void main(String[] args){ TaipanShop shop = new TaipanShop(); shop.shop();