Fixed money updating after fighting for loot

This commit is contained in:
2019-04-07 11:23:01 -06:00
parent ae8cac6595
commit ab596f60b0
2 changed files with 6 additions and 5 deletions

View File

@@ -213,6 +213,7 @@ public class ShipWarfareGUI extends Player {
if (exitValue == 1) {
wipe();
calculateLoot = logic.calculateLoot();
super.setMoney(logic.getMoney());
report.setText(String.format("Our firm has earned $%,d in loot! ", calculateLoot));
continueButton.setVisible(true);
completeWipe();

View File

@@ -69,16 +69,16 @@ public class ShipWarfareGUILogic extends Player {
int numOfShipsAttacking = 0;
Random randomValue = new Random();
if (getMoney() <= 100000) {
if (super.getMoney() <= 100000) {
//Minimum one ship will attack, maximum 20
numOfShipsAttacking = randomValue.nextInt(20) + 1;
} else if (getMoney() <= 200000) {
} else if (super.getMoney() <= 200000) {
//Minimum 30 Ships will attack, maximum 70
numOfShipsAttacking = randomValue.nextInt(40) + 31;
} else if (getMoney() <= 500000) {
} else if (super.getMoney() <= 500000) {
//Minimum 50 ships will attack, maximum 140
numOfShipsAttacking = randomValue.nextInt(90) + 51;
} else if (getMoney() >= 1000000) {
} else if (super.getMoney() >= 1000000) {
//Minimum 100 ships will attack, maximum 300 ships
numOfShipsAttacking = randomValue.nextInt(200) + 101;
}
@@ -92,7 +92,7 @@ public class ShipWarfareGUILogic extends Player {
Random randomValue = new Random();
int calculateLoot;
calculateLoot = (startingLittyShips * 100) + randomValue.nextInt(startingLittyShips) * 200;
setMoney(getMoney() + calculateLoot);
super.setMoney(super.getMoney() + calculateLoot);
return calculateLoot;
}