Added loot. Still need to have ships escape sometimes and Liu yen

This commit is contained in:
KahootChampion
2019-02-21 21:39:24 -07:00
parent 03b08e4de3
commit 3bd9f58fb1
4 changed files with 120 additions and 63 deletions

View File

@@ -2,13 +2,13 @@ public class Player {
private String name = "Taipan";
private int bank = 0;
private int money = 1000;
private int money = 1000000000;
private int opiumHeld = 0;
private int silkHeld = 0;
private int generalHeld = 0;
private int armsHeld = 0;
private int location = 1;
private int guns = 3;
private int guns = 1000;
private int HP = 100;

View File

@@ -5,7 +5,9 @@ import java.util.concurrent.TimeUnit;
public class ShipWarfare extends Player {
private int numOfPeasantShips = 0;
private int numOfLittyShips=0;
private boolean userAttacks = true;
private int startingShips=0;
public void peasantFleetAttack() throws Exception {
@@ -49,10 +51,13 @@ public class ShipWarfare extends Player {
public int getNumOfPeasantShips() {
return numOfPeasantShips;
}
public void setNumOfPeasantShips(int numOfPeasantShips) {
this.numOfPeasantShips = numOfPeasantShips;
startingShips = numOfPeasantShips;
}
public void delayForASecond() throws Exception {
@@ -96,6 +101,8 @@ public class ShipWarfare extends Player {
}
public boolean destroyShipsOrEscape(int typeOfShip) throws Exception {
int calculateLoot=0;
Scanner userInput = new Scanner(System.in);
Random randomValue = new Random();
numOfPeasantShips = typeOfShip;
@@ -170,6 +177,9 @@ public class ShipWarfare extends Player {
if (exitValue == 1) {
System.out.printf("\nGot eem\nVictory!\nIt appears we have defeated the enemy fleet and made it out at %d%% ship status\n", getHP());
calculateLoot= (randomValue.nextInt(startingShips) + startingShips) *100;
setMoney(getMoney()+calculateLoot);
System.out.printf("We got $%,d!",calculateLoot);
return true;
} else if (exitValue == 2) {
gameOver();