From 73f757890a3d232560c4efc8fea953b16077634d Mon Sep 17 00:00:00 2001
From: KahootChampion
Date: Wed, 20 Feb 2019 07:47:04 -0700
Subject: [PATCH] Perhaps done basic ship warfare?
---
.idea/workspace.xml | 127 ++++++++++++++++++++++++-------------------
src/Player.java | 8 +++
src/ShipWarfare.java | 9 ++-
src/TaipanShop.java | 4 ++
4 files changed, 90 insertions(+), 58 deletions(-)
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 @@
-
+
@@ -127,8 +119,8 @@
-
+
@@ -150,7 +142,7 @@
-
+
@@ -180,6 +172,13 @@
+
+
+
+
+
+
+
@@ -198,10 +197,12 @@
+
+
@@ -221,7 +222,8 @@
-
+
+
1550458807806
@@ -244,16 +246,38 @@
1550544805794
-
+
+ 1550554529721
+
+
+
+ 1550554529721
+
+
+ 1550555424630
+
+
+
+ 1550555424631
+
+
+ 1550673099893
+
+
+
+ 1550673099893
+
+
-
+
-
+
+
-
+
@@ -262,7 +286,7 @@
-
+
@@ -294,7 +318,10 @@
-
+
+
+
+
@@ -310,39 +337,29 @@
-
+
-
-
+
+
-
-
-
-
-
-
+
+
+
-
+
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
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();