@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.
- package/README.md +161 -22
- package/dist/ai.server.d.ts +55 -4
- package/dist/client/index.js +13 -8
- package/dist/client/index10.js +54 -136
- package/dist/client/index11.js +52 -23
- package/dist/client/index12.js +101 -1217
- package/dist/client/index13.js +139 -42
- package/dist/client/index14.js +23 -8
- package/dist/client/index15.js +68 -444
- package/dist/client/index16.js +1343 -0
- package/dist/client/index17.js +13 -0
- package/dist/client/index18.js +60 -0
- package/dist/client/index19.js +10 -0
- package/dist/client/index2.js +25 -87
- package/dist/client/index20.js +504 -0
- package/dist/client/index3.js +45 -83
- package/dist/client/index4.js +98 -297
- package/dist/client/index5.js +81 -33
- package/dist/client/index6.js +284 -78
- package/dist/client/index7.js +33 -74
- package/dist/client/index8.js +95 -55
- package/dist/client/index9.js +75 -96
- package/dist/core/attack-profile.d.ts +9 -0
- package/dist/core/attack-runtime.d.ts +20 -0
- package/dist/core/enemy-attack-profiles.d.ts +6 -0
- package/dist/core/equipment.d.ts +2 -0
- package/dist/core/hit-reaction.d.ts +5 -0
- package/dist/index.d.ts +7 -2
- package/dist/server/index.js +12 -7
- package/dist/server/index10.js +1340 -8
- package/dist/server/index11.js +37 -0
- package/dist/server/index12.js +60 -0
- package/dist/server/index13.js +13 -0
- package/dist/server/index14.js +503 -0
- package/dist/server/index15.js +10 -0
- package/dist/server/index2.js +1 -1
- package/dist/server/index3.js +25 -87
- package/dist/server/index4.js +45 -141
- package/dist/server/index5.js +104 -21
- package/dist/server/index6.js +137 -1215
- package/dist/server/index7.js +22 -34
- package/dist/server/index8.js +70 -44
- package/dist/server/index9.js +44 -437
- package/dist/server.d.ts +8 -2
- package/dist/ui/state.d.ts +5 -5
- package/package.json +5 -5
- package/src/ai.server.spec.ts +120 -0
- package/src/ai.server.ts +362 -56
- package/src/client.ts +21 -12
- package/src/config.ts +17 -2
- package/src/core/attack-profile.spec.ts +118 -0
- package/src/core/attack-profile.ts +100 -0
- package/src/core/attack-runtime.spec.ts +103 -0
- package/src/core/attack-runtime.ts +83 -0
- package/src/core/contracts.ts +3 -0
- package/src/core/enemy-attack-profiles.spec.ts +35 -0
- package/src/core/enemy-attack-profiles.ts +103 -0
- package/src/core/equipment.spec.ts +37 -0
- package/src/core/equipment.ts +17 -0
- package/src/core/hit-reaction.spec.ts +43 -0
- package/src/core/hit-reaction.ts +70 -0
- package/src/core/hit.spec.ts +54 -1
- package/src/core/hit.ts +26 -0
- package/src/index.ts +48 -1
- package/src/server.ts +192 -34
- package/src/types.ts +62 -6
package/dist/client/index11.js
CHANGED
|
@@ -1,25 +1,54 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/core/
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { normalizeActionBattleAttackProfile } from "./index3.js";
|
|
2
|
+
//#region src/core/attack-runtime.ts
|
|
3
|
+
var ACTION_BATTLE_HITBOX_FRAME_MS = 16;
|
|
4
|
+
function getNormalizedActionBattleAttackProfile(options = {}) {
|
|
5
|
+
const attack = options.attack ?? {};
|
|
6
|
+
return normalizeActionBattleAttackProfile(attack.profile, {
|
|
7
|
+
lockMovement: attack.lockMovement,
|
|
8
|
+
lockDurationMs: attack.lockDurationMs,
|
|
9
|
+
hitboxes: attack.hitboxes
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function resolveActionBattleHitboxSpeed(profile, hitboxCount) {
|
|
13
|
+
const positions = Math.max(1, Math.floor(hitboxCount));
|
|
14
|
+
const activeFrames = Math.max(1, Math.ceil(profile.activeMs / 16));
|
|
15
|
+
return Math.max(1, Math.ceil(activeFrames / positions));
|
|
16
|
+
}
|
|
17
|
+
function scheduleActionBattleStartup(profile, callback, scheduler = setTimeout) {
|
|
18
|
+
if (profile.startupMs <= 0) {
|
|
19
|
+
callback();
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return scheduler(callback, profile.startupMs);
|
|
23
|
+
}
|
|
24
|
+
var attackIdCounter = 0;
|
|
25
|
+
function createActionBattleAttackId(attackerId, profileId) {
|
|
26
|
+
attackIdCounter++;
|
|
27
|
+
return `${attackerId ?? "unknown"}:${profileId}:${Date.now()}:${attackIdCounter}`;
|
|
28
|
+
}
|
|
29
|
+
var getTargetKey = (target) => {
|
|
30
|
+
if (!target || target.id === void 0 || target.id === null) return null;
|
|
31
|
+
return String(target.id);
|
|
32
|
+
};
|
|
33
|
+
var ActionBattleHitTracker = class {
|
|
34
|
+
hitTargets = /* @__PURE__ */ new Set();
|
|
35
|
+
constructor(hitPolicy) {
|
|
36
|
+
this.hitPolicy = hitPolicy;
|
|
37
|
+
}
|
|
38
|
+
canHit(target) {
|
|
39
|
+
if (this.hitPolicy === "allowRepeatHits") return true;
|
|
40
|
+
const key = getTargetKey(target);
|
|
41
|
+
return !key || !this.hitTargets.has(key);
|
|
42
|
+
}
|
|
43
|
+
recordHit(target) {
|
|
44
|
+
const key = getTargetKey(target);
|
|
45
|
+
if (key) this.hitTargets.add(key);
|
|
46
|
+
}
|
|
47
|
+
tryHit(target) {
|
|
48
|
+
if (!this.canHit(target)) return false;
|
|
49
|
+
this.recordHit(target);
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
21
52
|
};
|
|
22
|
-
var getActionBattleSystems = () => currentActionBattleSystems;
|
|
23
|
-
var createActionBattleSystems = mergeSystems;
|
|
24
53
|
//#endregion
|
|
25
|
-
export {
|
|
54
|
+
export { ACTION_BATTLE_HITBOX_FRAME_MS, ActionBattleHitTracker, createActionBattleAttackId, getNormalizedActionBattleAttackProfile, resolveActionBattleHitboxSpeed, scheduleActionBattleStartup };
|