Perhaps done basic ship warfare?

This commit is contained in:
KahootChampion
2019-02-20 07:47:04 -07:00
parent 8f324ac967
commit 73f757890a
4 changed files with 90 additions and 58 deletions

View File

@@ -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();
}
}

View File

@@ -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;

View File

@@ -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();