1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package de.kaiserpfalzedv.rpg.torg.model.core;
19
20 import lombok.AllArgsConstructor;
21 import lombok.Getter;
22 import org.eclipse.microprofile.openapi.annotations.media.Schema;
23
24 import jakarta.validation.constraints.NotNull;
25 import java.util.List;
26 import java.util.Optional;
27
28
29
30
31
32
33
34 @AllArgsConstructor
35 @Getter
36 @Schema(description = "A definition of attack DNs")
37 public enum AttackPowerTarget {
38 DefaultAttack("Default Attack", null, null, null),
39 DodgeOrDexterity("Dodge or Dexterity", null, null, "Target’s dodge or Dexterity"),
40 FaithOrSpirit("Faith Or Spirit", null, null, "Target’s faith or Spirit"),
41 WillpowerOrMind("Willpower or Mind", null, null, "Target’s willpower or Mind"),
42 WillpowerOrSpirit("Willpower or Spirit", null, null, "Target’s willpower or Spirit"),
43 TargetAttribute("Target Attribute", null, null, "Target’s attribute"),
44 VERY_EASY("Very Easy", 6, +4, "Very Easy (DN 6)"),
45 EASY("Easy", 8, +2, "Easy (DN 8)"),
46 STANDARD("Standard", 10, 0, "Standard (DN 10)"),
47 STANDARD_DodgeOrDexterity("Standard; or Dodge or Dexterity", 10, 0, "Standard (DN 10); or a target’s dodge or Dexterity"),
48 CHALLENGING("Challenging", 12, -2, "Challenging (DN 12)"),
49 HARD("Hard", 14, -4, "Hard (DN 14)"),
50 VERY_HARD("Very Hard", 16, -6, "Very Hard (DN 16)"),
51 HEROIC("Heroic", 18, -8, "Heroic (DN 18)"),
52 NEAR_IMPOSSIBLE("Near Impossible", 20, -10, "Near Impossible (DN 20)");
53
54 @Schema(description = "Name of the attack type")
55 private final String name;
56
57 @Schema(description = "DN value", nullable = true)
58 private final Integer dn;
59
60 @Schema(description = "Modifier for the DN", nullable = true)
61 private final Integer modifier;
62
63 @Schema(description = "Foundry VTTs definition text", nullable = true)
64 private final String foundry;
65
66 public Optional<AttackPowerTarget> mapFromFoundry(@NotNull final String name) {
67 return allAttackPowerTargets().stream()
68 .filter(e -> name.equalsIgnoreCase(e.foundry)).distinct()
69 .findFirst();
70 }
71
72 public List<AttackPowerTarget> allAttackPowerTargets() {
73 return List.of(
74 DefaultAttack,
75 DodgeOrDexterity, FaithOrSpirit, WillpowerOrSpirit, WillpowerOrMind,
76 TargetAttribute,
77 VERY_EASY, EASY,
78 STANDARD, STANDARD_DodgeOrDexterity,
79 CHALLENGING, HARD, VERY_HARD, HEROIC, NEAR_IMPOSSIBLE
80 );
81 }
82 }