Used Harkamal's dumb extended class thingy cuz he begged me tod do it.

This commit is contained in:
KahootChampion
2019-02-18 19:13:39 -07:00
parent 5c41bf5b7c
commit 534b8728a5
3 changed files with 3 additions and 27 deletions

View File

@@ -8,7 +8,7 @@ public class Player {
private int generalHeld = 0; private int generalHeld = 0;
private int armsHeld = 0; private int armsHeld = 0;
private int location = 1; private int location = 1;
private int guns = 0; private int guns = 3;
private int Hp = 100; private int Hp = 100;
public String getName() { public String getName() {

View File

@@ -2,11 +2,8 @@ import java.util.Scanner;
import java.util.Random; import java.util.Random;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class ShipWarfare { public class ShipWarfare extends Player {
private int money = 0;
private int guns = 3;
private int hp = 100;
private int numOfPeasantShips = 0; private int numOfPeasantShips = 0;
@@ -40,34 +37,13 @@ public class ShipWarfare {
} }
public int getMoney() {
return money;
}
public int getGuns() {
return guns;
}
public int getHp() {
return hp;
}
public int getNumOfPeasantShips() { public int getNumOfPeasantShips() {
return numOfPeasantShips; return numOfPeasantShips;
} }
public void setHp(int hp) {
this.hp = hp;
}
public void setMoney(int money) {
this.money = money;
}
public void setGuns(int guns) {
this.guns = guns;
}
public void setNumOfPeasantShips(int numOfPeasantShips) { public void setNumOfPeasantShips(int numOfPeasantShips) {
this.numOfPeasantShips = numOfPeasantShips; this.numOfPeasantShips = numOfPeasantShips;
@@ -184,7 +160,7 @@ public class ShipWarfare {
} }
} }
if (exitValue == 1) { if (exitValue == 1) {
System.out.printf("\nGot eem\nVictory!\nIt appears we have defeated the enemy fleet and made it out at %d health\n", hp); System.out.printf("\nGot eem\nVictory!\nIt appears we have defeated the enemy fleet and made it out at %d health\n", getHp());
return true; return true;
} else if (exitValue == 2) { } else if (exitValue == 2) {
gameOver(); gameOver();