Skip to content
Snippets Groups Projects
Commit 63dc10c5 authored by Tomas Beranek's avatar Tomas Beranek
Browse files

refactor: mistakes removed

parent c1725a37
No related branches found
No related tags found
2 merge requests!5Merging simulation branch with main branch,!4Merging Main branch with Simulation branch
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<groupId>edu.ntnu.idatt2001.Project</groupId> <groupId>edu.ntnu.idatt2001.Project</groupId>
<artifactId>wargame</artifactId> <artifactId>wargame</artifactId>
<version>0.1-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<properties> <properties>
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId> <artifactId>junit-jupiter-params</artifactId>
<version>5.8.1</version> <version>5.8.2</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
...@@ -79,17 +79,17 @@ ...@@ -79,17 +79,17 @@
<dependency> <dependency>
<groupId>commons-codec</groupId> <groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId> <artifactId>commons-codec</artifactId>
<version>1.11</version> <version>20041127.091804</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.openjfx</groupId> <groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId> <artifactId>javafx-controls</artifactId>
<version>17.0.2</version> <version>18.0.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.openjfx</groupId> <groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId> <artifactId>javafx-fxml</artifactId>
<version>17.0.2</version> <version>18.0.1</version>
</dependency> </dependency>
</dependencies> </dependencies>
<reporting> <reporting>
......
...@@ -20,7 +20,6 @@ public class Battle { ...@@ -20,7 +20,6 @@ public class Battle {
private Army armyOne; private Army armyOne;
private Army armyTwo; private Army armyTwo;
private Army winningArmy; private Army winningArmy;
private List<String> attackStringList;
/** /**
* this is a constructor for the battle class that takes two classes. * this is a constructor for the battle class that takes two classes.
...@@ -30,11 +29,13 @@ public class Battle { ...@@ -30,11 +29,13 @@ public class Battle {
public Battle(Army armyOne, Army armyTwo) { public Battle(Army armyOne, Army armyTwo) {
this.armyOne = armyOne; this.armyOne = armyOne;
this.armyTwo = armyTwo; this.armyTwo = armyTwo;
this.attackStringList = new ArrayList<>();
} }
/** /**
* this method is the simulation of the battle, two armies attack each other, and one wins * this method is the simulation of the battle, two armies attack each other, and one wins
* <p>
* method not longer in use, but can be used in further development
* </p>
* @return return the winning army as an Army object * @return return the winning army as an Army object
*/ */
public Army simulate(int terrain){ public Army simulate(int terrain){
......
...@@ -94,16 +94,6 @@ public class SimulationViewController implements Initializable { ...@@ -94,16 +94,6 @@ public class SimulationViewController implements Initializable {
updateArmyTwoTable(SimulationSingleton.getInstance().getArmyTwo()); updateArmyTwoTable(SimulationSingleton.getInstance().getArmyTwo());
} }
/**
* Method sets an image by the image name
* The method requires that all images is located in the resources under {@code TerrainPictures} and that the image is jpg
* @param imageName The name of the image
* @return The image if found
*/
private Image getImageByName(String imageName) {
return new Image("/TerrainPictures/" + imageName + ".jpg");
}
/** /**
* method that sets a specific image on the screen when chosen by user * method that sets a specific image on the screen when chosen by user
* {@linkhttps://gitlab.stud.idi.ntnu.no/G1-06/idatt-1002-2022-1-06/-/blob/final-prod/finalprod/src/main/java/edu/ntnu/idatt1002/g106/handballapp/finalprod/controller/SetUpTournamentController.java} * {@linkhttps://gitlab.stud.idi.ntnu.no/G1-06/idatt-1002-2022-1-06/-/blob/final-prod/finalprod/src/main/java/edu/ntnu/idatt1002/g106/handballapp/finalprod/controller/SetUpTournamentController.java}
...@@ -311,6 +301,16 @@ public class SimulationViewController implements Initializable { ...@@ -311,6 +301,16 @@ public class SimulationViewController implements Initializable {
warGamesTerrainInput.setDisable(bool); warGamesTerrainInput.setDisable(bool);
} }
/**
* Method sets an image by the image name
* The method requires that all images is located in the resources under {@code TerrainPictures} and that the image is jpg
* @param imageName The name of the image
* @return The image if found
*/
private Image getImageByName(String imageName) {
return new Image("/TerrainPictures/" + imageName + ".jpg");
}
/** /**
* method that takes the user to army details page * method that takes the user to army details page
* @param event any button event * @param event any button event
......
...@@ -28,10 +28,10 @@ public abstract class Unit { ...@@ -28,10 +28,10 @@ public abstract class Unit {
* @throws IllegalArgumentException if health sett < 0 thr or name is empty exception * @throws IllegalArgumentException if health sett < 0 thr or name is empty exception
*/ */
public Unit(String name, int health, int attack, int armor, int melee) throws IllegalArgumentException { public Unit(String name, int health, int attack, int armor, int melee) throws IllegalArgumentException {
if(name.isBlank()) throw new IllegalArgumentException("Name no blank bad"); if(name.isBlank()) throw new IllegalArgumentException("Name cant be blank");
this.name = name; this.name = name;
if(health <= 0) throw new IllegalArgumentException("health less zero bad"); if(health <= 0) throw new IllegalArgumentException("health cant be less or equal to Zero");
this.health = health; this.health = health;
//I think that attack and armor can be < 0 because in a war something can go wrong or very well //I think that attack and armor can be < 0 because in a war something can go wrong or very well
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment