Initial commit

This commit is contained in:
Loïc Prieto 2025-06-15 16:16:19 +02:00
commit c41ac72f28
6 changed files with 116 additions and 0 deletions

13
.gitignore vendored Normal file
View file

@ -0,0 +1,13 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
## Mac OS ###
.DS_Store

26
pom.xml Normal file
View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>40kDamageCalculator</artifactId>
<version>0.0.1</version>
<properties>
<maven.compiler.source>24</maven.compiler.source>
<maven.compiler.target>24</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- JavaFX modules -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>24-ea+5</version>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,47 @@
package ninja.thefirearchmage.games.fourtykcalculator;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import java.util.Arrays;
public class FourtyKCalculatorApp extends Application {
@Override
public void start(Stage stage) throws Exception {
stage.setTitle("Eradicator Damage Calculator");
TextArea output = new TextArea();
output.setEditable(false);
Button calculateBtn = new Button("Calculate");
calculateBtn.setOnAction(e -> {
List<Target> targets = Arrays.asList(
new Target("Rhino", 9, 3, null, 10),
new Target("Lehman Russ", 11, 2, null, 13),
new Target("Redemptor Dread", 10, 3, 5, 12),
new Target("Knight Paladin", 13, 2, 5, 22),
new Target("Plagueburst Crawler", 12, 3, 4, 12)
);
StringBuilder sb = new StringBuilder();
for (Target target : targets) {
sb.append(calculate(target, 3, true, true, true, "melta"));
sb.append("\n");
}
output.setText(sb.toString());
});
VBox layout = new VBox(10);
layout.setPadding(new Insets(10));
layout.getChildren().addAll(calculateBtn, output);
Scene scene = new Scene(layout, 500, 400);
stage.setScene(scene);
stage.show();
}
}

View file

@ -0,0 +1,7 @@
package ninja.thefirearchmage.games.fourtykcalculator;
public class Main {
public static void main(String[] args) {
System.out.printf("Hello and welcome!");
}
}

View file

@ -0,0 +1,22 @@
package ninja.thefirearchmage.games.fourtykcalculator;
import java.util.Optional;
public class Weapon {
private int strength;
private int ap;
private double averageDamage;
private int hitValue;
private boolean hasLethalHits;
private Optional<Integer> sustainedHits;
private boolean hasMortalWounds;
private boolean hasHazardous;
private Optional<Integer> antiInfantery;
private Optional<Integer> antiVehicle;
private Optional<Integer> antiMonster;
private Optional<Integer> antiPsychic;
private boolean hasHeavy;
private boolean hasBlast;
private boolean hasLance;
private Optional<Integer> melta;
}

View file

@ -0,0 +1 @@
melta: