I DON'T KNOW WHAT I DID, BUT IT WORKED A LITTLE BIT

This commit is contained in:
2019-04-06 18:09:04 -06:00
parent 256706377d
commit 5d0e349ffb
2 changed files with 11 additions and 9 deletions

View File

@@ -44,8 +44,8 @@ public class ShipWarfareGUI extends Player {
private Label report;
private int counter;
private int checkIfDone;
private int numOfLittyShips;
private int timeCounter;
@@ -157,8 +157,8 @@ public class ShipWarfareGUI extends Player {
public boolean winOrLose(Stage stage) {
ShipWarfareGUILogic logic = new ShipWarfareGUILogic(getPlayer());
int commenceFire = logic.destroyLittyShipsOrEscape(logic.getNumOfLittyShips());
logic.setNumOfLittyShips(numOfLittyShips);
int commenceFire = logic.destroyLittyShipsOrEscape(numOfLittyShips);
if (commenceFire == 1) {
wipe();
report.setText(logic.getReportMessage());
@@ -231,7 +231,8 @@ public class ShipWarfareGUI extends Player {
ShipWarfareGUILogic logic = new ShipWarfareGUILogic(getPlayer());
logic.setNumOfLittyShips(logic.numOfShips());
numOfLittyShips = logic.numOfShips();
logic.setNumOfLittyShips(numOfLittyShips);
title.setText(String.format("%d ships from Liu Yuen's Fleet are attacking, Would you like to fight or run?", logic.getNumOfLittyShips()));
setPlayer(logic.getPlayer());
@@ -389,10 +390,11 @@ public class ShipWarfareGUI extends Player {
report.setText("Epic");
counter++;
ShipWarfareGUILogic logic = new ShipWarfareGUILogic(getPlayer());
logic.setNumOfLittyShips(numOfLittyShips);
if (logic.runFromShips() == false) {
report.setText(("Couldn't run away"));
try {
checkIfDone = logic.destroyLittyShipsOrEscape(logic.getNumOfLittyShips());
checkIfDone = logic.destroyLittyShipsOrEscape(numOfLittyShips);
} catch (Exception e) {
e.printStackTrace();
}
@@ -460,7 +462,7 @@ public class ShipWarfareGUI extends Player {
*/
public void handle(ActionEvent event) {
shotsFired.stop();
if (checkIfDone == 4) {
if (!winOrLose(primaryStage)) {
shipsRetaliate();
} else {
report.setVisible(true);

View File

@@ -37,7 +37,7 @@ public class ShipWarfareGUILogic extends Player {
/**
* this.setter method that takes in an integer as an argument
* setter method that takes in an integer as an argument
*
* @param numOfLittyShips the number of ships to be used in the peasant fleet attack
*/
@@ -47,7 +47,6 @@ public class ShipWarfareGUILogic extends Player {
if (counter1 == 1) {
startingLittyShips = numOfLittyShips;
}
}
public int getNumOfLittyShips(){
@@ -162,8 +161,9 @@ public class ShipWarfareGUILogic extends Player {
*
* @return true if the user wins, loses, or flees, it returns false otherwise
*/
public int destroyLittyShipsOrEscape() {
public int destroyLittyShipsOrEscape(int tempLittyShips) {
this.numOfLittyShips = tempLittyShips;
int calculateLoot = 0;
int chanceOfEnemyRun = 0;
int hitCounter = 0;