@rpgjs/action-battle 5.0.0-beta.5 → 5.0.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +161 -22
  2. package/dist/ai.server.d.ts +55 -4
  3. package/dist/client/index.js +13 -8
  4. package/dist/client/index10.js +54 -136
  5. package/dist/client/index11.js +52 -23
  6. package/dist/client/index12.js +101 -1217
  7. package/dist/client/index13.js +139 -42
  8. package/dist/client/index14.js +23 -8
  9. package/dist/client/index15.js +68 -444
  10. package/dist/client/index16.js +1343 -0
  11. package/dist/client/index17.js +13 -0
  12. package/dist/client/index18.js +60 -0
  13. package/dist/client/index19.js +10 -0
  14. package/dist/client/index2.js +25 -87
  15. package/dist/client/index20.js +504 -0
  16. package/dist/client/index3.js +45 -83
  17. package/dist/client/index4.js +98 -297
  18. package/dist/client/index5.js +81 -33
  19. package/dist/client/index6.js +284 -78
  20. package/dist/client/index7.js +33 -74
  21. package/dist/client/index8.js +95 -55
  22. package/dist/client/index9.js +75 -96
  23. package/dist/core/attack-profile.d.ts +9 -0
  24. package/dist/core/attack-runtime.d.ts +20 -0
  25. package/dist/core/enemy-attack-profiles.d.ts +6 -0
  26. package/dist/core/equipment.d.ts +2 -0
  27. package/dist/core/hit-reaction.d.ts +5 -0
  28. package/dist/index.d.ts +7 -2
  29. package/dist/server/index.js +12 -7
  30. package/dist/server/index10.js +1340 -8
  31. package/dist/server/index11.js +37 -0
  32. package/dist/server/index12.js +60 -0
  33. package/dist/server/index13.js +13 -0
  34. package/dist/server/index14.js +503 -0
  35. package/dist/server/index15.js +10 -0
  36. package/dist/server/index2.js +1 -1
  37. package/dist/server/index3.js +25 -87
  38. package/dist/server/index4.js +45 -141
  39. package/dist/server/index5.js +104 -21
  40. package/dist/server/index6.js +137 -1215
  41. package/dist/server/index7.js +22 -34
  42. package/dist/server/index8.js +70 -44
  43. package/dist/server/index9.js +44 -437
  44. package/dist/server.d.ts +8 -2
  45. package/dist/ui/state.d.ts +5 -5
  46. package/package.json +5 -5
  47. package/src/ai.server.spec.ts +120 -0
  48. package/src/ai.server.ts +362 -56
  49. package/src/client.ts +21 -12
  50. package/src/config.ts +17 -2
  51. package/src/core/attack-profile.spec.ts +118 -0
  52. package/src/core/attack-profile.ts +100 -0
  53. package/src/core/attack-runtime.spec.ts +103 -0
  54. package/src/core/attack-runtime.ts +83 -0
  55. package/src/core/contracts.ts +3 -0
  56. package/src/core/enemy-attack-profiles.spec.ts +35 -0
  57. package/src/core/enemy-attack-profiles.ts +103 -0
  58. package/src/core/equipment.spec.ts +37 -0
  59. package/src/core/equipment.ts +17 -0
  60. package/src/core/hit-reaction.spec.ts +43 -0
  61. package/src/core/hit-reaction.ts +70 -0
  62. package/src/core/hit.spec.ts +54 -1
  63. package/src/core/hit.ts +26 -0
  64. package/src/index.ts +48 -1
  65. package/src/server.ts +192 -34
  66. package/src/types.ts +62 -6
package/src/types.ts CHANGED
@@ -89,6 +89,61 @@ export interface ActionBattleUiOptions {
89
89
  targeting?: ActionBattleUiTargetingOptions;
90
90
  }
91
91
 
92
+ export type ActionBattleAttackDirection =
93
+ | "up"
94
+ | "down"
95
+ | "left"
96
+ | "right"
97
+ | "default";
98
+
99
+ export interface ActionBattleAttackHitboxConfig {
100
+ offsetX: number;
101
+ offsetY: number;
102
+ width: number;
103
+ height: number;
104
+ }
105
+
106
+ export type ActionBattleAttackHitboxMap = Partial<
107
+ Record<ActionBattleAttackDirection, ActionBattleAttackHitboxConfig>
108
+ >;
109
+
110
+ export type ActionBattleAttackHitPolicy =
111
+ | "oncePerTarget"
112
+ | "allowRepeatHits";
113
+
114
+ export interface ActionBattleHitReactionProfile {
115
+ invincibilityMs?: number;
116
+ hitstunMs?: number;
117
+ staggerPower?: number;
118
+ }
119
+
120
+ export interface NormalizedActionBattleHitReactionProfile {
121
+ invincibilityMs: number;
122
+ hitstunMs: number;
123
+ staggerPower: number;
124
+ }
125
+
126
+ export interface ActionBattleAttackProfile {
127
+ id?: string;
128
+ startupMs?: number;
129
+ activeMs?: number;
130
+ recoveryMs?: number;
131
+ cooldownMs?: number;
132
+ movementLock?: boolean;
133
+ directionLock?: boolean;
134
+ animationKey?: ActionBattleAnimationKey;
135
+ hitPolicy?: ActionBattleAttackHitPolicy;
136
+ reaction?: ActionBattleHitReactionProfile;
137
+ hitboxes?: ActionBattleAttackHitboxMap;
138
+ }
139
+
140
+ export interface NormalizedActionBattleAttackProfile
141
+ extends Required<Omit<ActionBattleAttackProfile, "hitboxes" | "reaction">> {
142
+ reaction: NormalizedActionBattleHitReactionProfile;
143
+ hitboxes?: ActionBattleAttackHitboxMap;
144
+ totalDurationMs: number;
145
+ }
146
+
92
147
  export interface ActionBattleSkillOptions {
93
148
  getTargeting?: ActionBattleSkillTargetingResolver;
94
149
  defaultAoeMask?: ActionBattleAoeMask;
@@ -99,19 +154,19 @@ export interface ActionBattleTargetingOptions {
99
154
  allowEmptyTarget?: boolean;
100
155
  }
101
156
 
157
+ export interface ActionBattleDebugOptions {
158
+ attacks?: boolean;
159
+ }
160
+
102
161
  export interface ActionBattleAttackOptions {
162
+ profile?: ActionBattleAttackProfile;
103
163
  lockMovement?: boolean;
104
164
  lockDurationMs?: number;
105
165
  showPreview?: boolean;
106
166
  previewDurationMs?: number;
107
167
  previewColor?: number;
108
168
  previewAccentColor?: number;
109
- hitboxes?: Partial<
110
- Record<
111
- "up" | "down" | "left" | "right" | "default",
112
- { offsetX: number; offsetY: number; width: number; height: number }
113
- >
114
- >;
169
+ hitboxes?: ActionBattleAttackHitboxMap;
115
170
  resolveHitboxes?: (context: {
116
171
  player: any;
117
172
  direction: string;
@@ -139,6 +194,7 @@ export interface ActionBattleOptions {
139
194
  skills?: ActionBattleSkillOptions;
140
195
  targeting?: ActionBattleTargetingOptions;
141
196
  attack?: ActionBattleAttackOptions;
197
+ debug?: ActionBattleDebugOptions;
142
198
  animations?: ActionBattleAnimationOptions;
143
199
  systems?: ActionBattleSystemOptions;
144
200
  }