diff --git a/pom.xml b/pom.xml index 1bf4742..549fe22 100644 --- a/pom.xml +++ b/pom.xml @@ -15,6 +15,14 @@ + + + org.projectlombok + lombok + 1.18.30 + provided + + org.openjfx @@ -23,4 +31,23 @@ + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + + + org.projectlombok + lombok + 1.18.30 + + + + + + \ No newline at end of file diff --git a/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/AttackScenario.java b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/AttackScenario.java new file mode 100644 index 0000000..d212031 --- /dev/null +++ b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/AttackScenario.java @@ -0,0 +1,28 @@ +package ninja.thefirearchmage.games.fourtykcalculator; + +import java.util.List; +import java.util.Optional; + +public class AttackScenario { + private List weapons; + private Optional hitReroll; + private Optional woundReroll; + private Optional damageReroll; + private boolean unmodifiableHit; + private boolean attackerWasStationary; + private boolean attackerCharged; + private boolean attackerInRapidFireRange; + + private DefensiveProfile defensiveProfile; + private Optional normalSaveReroll; + private boolean hasHitPenalty; + private boolean hasWoundPenalty; + private boolean isInCover; + private boolean forceWoundsOnFoursIfLower; + private int damageReduction; + + public void resolveAttack() { + // Attack step + + } +} diff --git a/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/DefensiveProfile.java b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/DefensiveProfile.java new file mode 100644 index 0000000..1a68844 --- /dev/null +++ b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/DefensiveProfile.java @@ -0,0 +1,24 @@ +package ninja.thefirearchmage.games.fourtykcalculator; + +import lombok.Getter; + +import java.util.Optional; + +@Getter +public class DefensiveProfile { + private final int toughness; + private final int normalSave; + private final Optional invulnerableSave; + private final Optional feelNoPain; + + public DefensiveProfile(int toughness, int normalSave) { + this(toughness, normalSave, Optional.empty(), Optional.empty()); + } + + public DefensiveProfile(int toughness, int normalSave, Optional invulnerableSave, Optional feelNoPain) { + this.toughness = toughness; + this.normalSave = normalSave; + this.invulnerableSave = invulnerableSave; + this.feelNoPain = feelNoPain; + } +} diff --git a/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/FeelNoPainEffect.java b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/FeelNoPainEffect.java new file mode 100644 index 0000000..af2e8c3 --- /dev/null +++ b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/FeelNoPainEffect.java @@ -0,0 +1,7 @@ +package ninja.thefirearchmage.games.fourtykcalculator; + + +public class FeelNoPainEffect { + private int rollValue; + private FeelNoPainType type; +} diff --git a/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/FeelNoPainType.java b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/FeelNoPainType.java new file mode 100644 index 0000000..11a462c --- /dev/null +++ b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/FeelNoPainType.java @@ -0,0 +1,7 @@ +package ninja.thefirearchmage.games.fourtykcalculator; + +public enum FeelNoPainType { + ALL, + MORTAL_WOUNDS, + PSYCHIC; +} \ No newline at end of file diff --git a/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/FourtyKCalculatorApp.java b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/FourtyKCalculatorApp.java index 3c86779..dddea81 100644 --- a/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/FourtyKCalculatorApp.java +++ b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/FourtyKCalculatorApp.java @@ -20,16 +20,16 @@ public class FourtyKCalculatorApp extends Application { Button calculateBtn = new Button("Calculate"); calculateBtn.setOnAction(e -> { - List 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) + List targets = Arrays.asList( + new DefensiveProfile("Rhino", 9, 3, null, 10), + new DefensiveProfile("Lehman Russ", 11, 2, null, 13), + new DefensiveProfile("Redemptor Dread", 10, 3, 5, 12), + new DefensiveProfile("Knight Paladin", 13, 2, 5, 22), + new DefensiveProfile("Plagueburst Crawler", 12, 3, 4, 12) ); StringBuilder sb = new StringBuilder(); - for (Target target : targets) { + for (DefensiveProfile target : targets) { sb.append(calculate(target, 3, true, true, true, "melta")); sb.append("\n"); } diff --git a/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/InvulnerableSave.java b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/InvulnerableSave.java new file mode 100644 index 0000000..642db1a --- /dev/null +++ b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/InvulnerableSave.java @@ -0,0 +1,18 @@ +package ninja.thefirearchmage.games.fourtykcalculator; + +import lombok.Getter; + +@Getter +public class InvulnerableSave { + private final int rollValue; + private final InvulnerableType type; + + public InvulnerableSave(int rollValue) { + this(rollValue, InvulnerableType.ALL); + } + + public InvulnerableSave(int rollValue, InvulnerableType type) { + this.rollValue = rollValue; + this.type = type; + } +} diff --git a/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/InvulnerableType.java b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/InvulnerableType.java new file mode 100644 index 0000000..096ea28 --- /dev/null +++ b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/InvulnerableType.java @@ -0,0 +1,10 @@ +package ninja.thefirearchmage.games.fourtykcalculator; + +/** + * To which attack type the invulnerability save applies. + */ +public enum InvulnerableType { + ALL, + RANGED, + MELEE; +} diff --git a/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/Main.java b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/Main.java index 051d7ae..9cdaafe 100644 --- a/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/Main.java +++ b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/Main.java @@ -2,6 +2,6 @@ package ninja.thefirearchmage.games.fourtykcalculator; public class Main { public static void main(String[] args) { - System.out.printf("Hello and welcome!"); + } } \ No newline at end of file diff --git a/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/Reroll.java b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/Reroll.java new file mode 100644 index 0000000..0f274b8 --- /dev/null +++ b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/Reroll.java @@ -0,0 +1,7 @@ +package ninja.thefirearchmage.games.fourtykcalculator; + +import java.util.Set; + +public class Reroll { + private Set rerollableValues; +} diff --git a/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/Weapon.java b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/Weapon.java index 1b9170d..fff922b 100644 --- a/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/Weapon.java +++ b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/Weapon.java @@ -5,7 +5,9 @@ import java.util.Optional; public class Weapon { private int strength; private int ap; - private double averageDamage; + private int attacks; + private WeaponDamage averageDamage; + private WeaponRangeType rangeType; private int hitValue; private boolean hasLethalHits; private Optional sustainedHits; @@ -18,5 +20,8 @@ public class Weapon { private boolean hasHeavy; private boolean hasBlast; private boolean hasLance; + private boolean ignoresCover; private Optional melta; + + } diff --git a/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/WeaponDamage.java b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/WeaponDamage.java new file mode 100644 index 0000000..b1dc279 --- /dev/null +++ b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/WeaponDamage.java @@ -0,0 +1,27 @@ +package ninja.thefirearchmage.games.fourtykcalculator; + +import lombok.Getter; + +import java.util.Optional; + +@Getter +public class WeaponDamage { + private final Optional diceType; + private final Optional numberOfDices; + private final int flatDamage; + + public WeaponDamage(int flatDamage) { + this(Optional.empty(), Optional.empty(), flatDamage); + } + public WeaponDamage(int diceType, int numberOfDices) { + this(Optional.of(diceType), Optional.of(numberOfDices), 0); + } + public WeaponDamage(int diceType, int numberOfDices, int extraDamage) { + this(Optional.of(diceType), Optional.of(numberOfDices), extraDamage); + } + public WeaponDamage(Optional diceType, Optional numberOfDices, int flatDamage) { + this.diceType = diceType; + this.numberOfDices = numberOfDices; + this.flatDamage = flatDamage; + } +} diff --git a/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/WeaponRangeType.java b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/WeaponRangeType.java new file mode 100644 index 0000000..eacb7c1 --- /dev/null +++ b/src/main/java/ninja/thefirearchmage/games/fourtykcalculator/WeaponRangeType.java @@ -0,0 +1,6 @@ +package ninja.thefirearchmage.games.fourtykcalculator; + +public enum WeaponRangeType { + MELEE, + RANGED; +} diff --git a/src/main/resources/defensive_profiles.yaml b/src/main/resources/defensive_profiles.yaml new file mode 100644 index 0000000..d1efdb0 --- /dev/null +++ b/src/main/resources/defensive_profiles.yaml @@ -0,0 +1,30 @@ +- intercessor: + name: Intercessor + toughness: 4 + save: 3 +- sm_terminator: + name: Space Marine Terminator + toughness: 5 + save: 2 + invulnerability: + save: 4 + type: ALL +- sm_rhino: + name: Space Marine Rhino + toughness: 9 + save: 3 +- impulsor: + name: Impulsor + toughness: 9 + save: 3 +- land_raider: + name: Space Marine Land Raider + toughness: 12 + save: 2 +- questoris_knight: + name: Questoris Class Knight + toughness: 12 + save: 3 + invulnerability: + save: 5 + type: RANGED \ No newline at end of file diff --git a/src/main/resources/weapons.yaml b/src/main/resources/weapons.yaml index 8d1e74f..41f6eae 100644 --- a/src/main/resources/weapons.yaml +++ b/src/main/resources/weapons.yaml @@ -1 +1,32 @@ -melta: +eradicator_melta_rifle: + name: Melta Rifle (Eradicator) + attacks: 1 + range_type: RANGED + damage: + dice_type: 6 + number_of_dices: 1 + melta: 2 + ap: -4 + toHit: 3 + strength: 9 + isHeavy: true +eradicator_multi_melta: + name: Multi-Melta (Eradicator) + damage: + dice_type: 6 + number_of_dices: 1 + attacks: 2 + range_type: RANGED + melta: 2 + ap: -4 + toHit: 4 + strength: 9 + isHeavy: true +intercessor_bolt_rifle: + name: Bolt Rifle (Intercessor) + attacks: 2 + damage: 1 + ap: -1 + toHit: 3 + strength: 4 + isHeavy: true \ No newline at end of file