@zylem/behaviors 0.8.10 → 0.8.11

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 (159) hide show
  1. package/dist/acrobatics-2d.d.ts +25 -0
  2. package/dist/acrobatics-2d.js +37 -0
  3. package/dist/action-rpg.d.ts +21 -0
  4. package/dist/action-rpg.js +39 -0
  5. package/dist/adventure-tools.d.ts +22 -0
  6. package/dist/adventure-tools.js +39 -0
  7. package/dist/behavior-descriptor-NS_qnzzp.d.ts +4527 -0
  8. package/dist/behavior-metadata-Drm1zxI2.d.ts +13 -0
  9. package/dist/catalog.d.ts +2143 -0
  10. package/dist/catalog.js +9 -0
  11. package/dist/chunk-2BE5BW7D.js +130 -0
  12. package/dist/{chunk-VNQLMRWC.js → chunk-2QCCLHJC.js} +9 -5
  13. package/dist/chunk-2UGT4MIF.js +94 -0
  14. package/dist/chunk-3J3ISPFQ.js +99 -0
  15. package/dist/chunk-3LBGEWT6.js +124 -0
  16. package/dist/{chunk-UUMH3DC3.js → chunk-3QBNWT7B.js} +5 -1
  17. package/dist/chunk-3T44EDXU.js +114 -0
  18. package/dist/chunk-5AJJ44QK.js +129 -0
  19. package/dist/{chunk-YDLO5M7S.js → chunk-5SMXQ6AU.js} +1 -0
  20. package/dist/chunk-5VJIP535.js +71 -0
  21. package/dist/chunk-6DTIJB7B.js +166 -0
  22. package/dist/chunk-73MHJY6R.js +78 -0
  23. package/dist/chunk-73YASAYS.js +137 -0
  24. package/dist/{chunk-NZM5YQBW.js → chunk-7HGDADLB.js} +8 -4
  25. package/dist/chunk-7IOQEXYR.js +92 -0
  26. package/dist/{chunk-G5S5U6WI.js → chunk-APAM55J3.js} +9 -5
  27. package/dist/chunk-BLTBZJPG.js +126 -0
  28. package/dist/chunk-BN6QZDR5.js +90 -0
  29. package/dist/chunk-BR33KT4Z.js +3186 -0
  30. package/dist/chunk-C5AYL42A.js +138 -0
  31. package/dist/chunk-DDLZLJ7W.js +8 -0
  32. package/dist/chunk-DRIXFB4C.js +132 -0
  33. package/dist/{chunk-U2BSZJ3S.js → chunk-DTLUKSX2.js} +5 -1
  34. package/dist/{chunk-VB4GYWTE.js → chunk-EMEA45JQ.js} +9 -5
  35. package/dist/chunk-EQFLPRF7.js +130 -0
  36. package/dist/{chunk-X45KOKUF.js → chunk-GNRMH7D3.js} +8 -4
  37. package/dist/chunk-GYEKT5AY.js +102 -0
  38. package/dist/{chunk-SHZZ2QRV.js → chunk-HCWLIPXP.js} +5 -1
  39. package/dist/chunk-HQ2UFI3S.js +116 -0
  40. package/dist/chunk-I52PC5IU.js +128 -0
  41. package/dist/{chunk-T7ST62OT.js → chunk-IAIJG2PB.js} +9 -5
  42. package/dist/{chunk-NDJO56BB.js → chunk-IJILTFEL.js} +5 -1
  43. package/dist/{chunk-6RIS4MGM.js → chunk-IRNU4JGV.js} +9 -5
  44. package/dist/chunk-IRPBFVAK.js +141 -0
  45. package/dist/chunk-JFBR4FNX.js +140 -0
  46. package/dist/{chunk-ERS6SNA5.js → chunk-K34N2CBL.js} +5 -1
  47. package/dist/chunk-LMMF7KXF.js +178 -0
  48. package/dist/chunk-LWGJ3QQZ.js +107 -0
  49. package/dist/chunk-MPNGQLHZ.js +132 -0
  50. package/dist/chunk-OH5LJAEJ.js +135 -0
  51. package/dist/{chunk-HZMC4LGW.js → chunk-P6TMZSWF.js} +10 -6
  52. package/dist/chunk-PDHHOVVQ.js +126 -0
  53. package/dist/{chunk-7TIIRJKF.js → chunk-RUBKGAPS.js} +5 -1
  54. package/dist/chunk-S44ZHYE6.js +1912 -0
  55. package/dist/chunk-SFMJNAW3.js +128 -0
  56. package/dist/{chunk-IU7Y3L7Y.js → chunk-SKKVOH6D.js} +5 -1
  57. package/dist/chunk-TSYXRRS4.js +125 -0
  58. package/dist/chunk-TZHO6P22.js +150 -0
  59. package/dist/chunk-V26L6MY6.js +127 -0
  60. package/dist/chunk-V4M46BF6.js +105 -0
  61. package/dist/chunk-VSFWETXS.js +127 -0
  62. package/dist/chunk-VU4LTE2X.js +147 -0
  63. package/dist/chunk-WF6HC5U3.js +8 -0
  64. package/dist/chunk-WG5NCDS4.js +99 -0
  65. package/dist/{chunk-7LHXAEOZ.js → chunk-WUYHS6JZ.js} +6 -2
  66. package/dist/chunk-XNRY6NOC.js +120 -0
  67. package/dist/{chunk-57JGBNCS.js → chunk-XT47QZQ6.js} +10 -6
  68. package/dist/chunk-Y5CCNMJI.js +58 -0
  69. package/dist/chunk-YVVB6YMG.js +133 -0
  70. package/dist/chunk-ZZXTGVGN.js +131 -0
  71. package/dist/combat-ai.d.ts +21 -0
  72. package/dist/combat-ai.js +41 -0
  73. package/dist/{components-tct075-p.d.ts → components-ClmBORMP.d.ts} +1 -1
  74. package/dist/cooldown.d.ts +2 -8
  75. package/dist/cooldown.js +3 -2
  76. package/dist/coordinators/boundary-ricochet-3d.d.ts +3 -2
  77. package/dist/coordinators/boundary-ricochet.d.ts +3 -2
  78. package/dist/coordinators/boundary-ricochet.js +2 -2
  79. package/dist/coordinators/multidirectional-space-shooter.d.ts +2 -1
  80. package/dist/coordinators/multidirectional-space-shooter.js +2 -2
  81. package/dist/coordinators/top-down-shooter.d.ts +2 -1
  82. package/dist/coordinators/top-down-shooter.js +2 -2
  83. package/dist/core.d.ts +386 -25
  84. package/dist/core.js +1583 -6
  85. package/dist/destructible-3d.d.ts +2 -1
  86. package/dist/destructible-3d.js +3 -2
  87. package/dist/environmental-locomotion.d.ts +23 -0
  88. package/dist/environmental-locomotion.js +35 -0
  89. package/dist/first-person.d.ts +2 -1
  90. package/dist/first-person.js +24 -3
  91. package/dist/golf-racket.d.ts +21 -0
  92. package/dist/golf-racket.js +37 -0
  93. package/dist/index.d.ts +25 -3
  94. package/dist/index.js +763 -79
  95. package/dist/jumper-2d.d.ts +2 -1
  96. package/dist/jumper-2d.js +24 -3
  97. package/dist/jumper-3d.d.ts +2 -1
  98. package/dist/jumper-3d.js +24 -3
  99. package/dist/lane-defense.d.ts +21 -0
  100. package/dist/lane-defense.js +39 -0
  101. package/dist/life-simulation.d.ts +21 -0
  102. package/dist/life-simulation.js +39 -0
  103. package/dist/matching-pinball.d.ts +21 -0
  104. package/dist/matching-pinball.js +39 -0
  105. package/dist/melee-combat.d.ts +22 -0
  106. package/dist/melee-combat.js +45 -0
  107. package/dist/{moveable-tkFsn7mE.d.ts → moveable-CXK2wEZL.d.ts} +1 -1
  108. package/dist/particle-emitter.d.ts +2 -1
  109. package/dist/particle-emitter.js +3 -2
  110. package/dist/platformer-2d.d.ts +2 -1
  111. package/dist/platformer-2d.js +24 -3
  112. package/dist/platformer-3d.d.ts +2 -1
  113. package/dist/platformer-3d.js +24 -3
  114. package/dist/racing-vehicles.d.ts +21 -0
  115. package/dist/racing-vehicles.js +37 -0
  116. package/dist/rhythm-performance.d.ts +21 -0
  117. package/dist/rhythm-performance.js +39 -0
  118. package/dist/ricochet-2d.d.ts +2 -1
  119. package/dist/ricochet-2d.js +24 -3
  120. package/dist/ricochet-3d.d.ts +2 -1
  121. package/dist/ricochet-3d.js +24 -3
  122. package/dist/runtime-2d.d.ts +2 -1
  123. package/dist/runtime-2d.js +10 -1
  124. package/dist/screen-visibility.d.ts +2 -1
  125. package/dist/screen-visibility.js +3 -2
  126. package/dist/screen-wrap.d.ts +2 -7
  127. package/dist/screen-wrap.js +3 -2
  128. package/dist/shooter-2d.d.ts +2 -1
  129. package/dist/shooter-2d.js +3 -2
  130. package/dist/skate-snowboard.d.ts +21 -0
  131. package/dist/skate-snowboard.js +37 -0
  132. package/dist/spatial-puzzles.d.ts +21 -0
  133. package/dist/spatial-puzzles.js +35 -0
  134. package/dist/squad-rts.d.ts +21 -0
  135. package/dist/squad-rts.js +39 -0
  136. package/dist/stealth-city.d.ts +21 -0
  137. package/dist/stealth-city.js +41 -0
  138. package/dist/survival-resources.d.ts +21 -0
  139. package/dist/survival-resources.js +37 -0
  140. package/dist/tactical-grid.d.ts +21 -0
  141. package/dist/tactical-grid.js +39 -0
  142. package/dist/thruster.d.ts +2 -1
  143. package/dist/thruster.js +3 -2
  144. package/dist/top-down-movement.d.ts +2 -1
  145. package/dist/top-down-movement.js +24 -3
  146. package/dist/turn-based-rpg.d.ts +21 -0
  147. package/dist/turn-based-rpg.js +39 -0
  148. package/dist/weapon-systems.d.ts +22 -0
  149. package/dist/weapon-systems.js +45 -0
  150. package/dist/world-boundary-2d.d.ts +2 -1
  151. package/dist/world-boundary-2d.js +24 -3
  152. package/dist/world-boundary-3d.d.ts +2 -1
  153. package/dist/world-boundary-3d.js +24 -3
  154. package/package.json +87 -3
  155. package/dist/behavior-descriptor-Dr8qmQ20.d.ts +0 -914
  156. package/dist/chunk-GZ3DQIIZ.js +0 -888
  157. package/dist/{chunk-OSPQFWQF.js → chunk-4K37UL53.js} +3 -3
  158. package/dist/{chunk-DD4U42FG.js → chunk-AQB246W5.js} +3 -3
  159. package/dist/{chunk-UKGBQTHL.js → chunk-CXDNR4R4.js} +3 -3
@@ -0,0 +1,178 @@
1
+ // src/lib/behaviors/turn-based-rpg/types.ts
2
+ var BATTLE_ABILITIES = [
3
+ "priority-speed-turn-order",
4
+ "type-effectiveness-matrix",
5
+ "turn-duration-status",
6
+ "capture-attempt-resolution",
7
+ "conditional-evolution",
8
+ "timed-battle-action-command",
9
+ "active-partner-swap",
10
+ "budgeted-passive-loadout",
11
+ "field-first-strike",
12
+ "escape-attempt"
13
+ ];
14
+ var BATTLE_EVENTS = [
15
+ ...BATTLE_ABILITIES,
16
+ "action-command-timeout"
17
+ ];
18
+ function battleData(o) {
19
+ return [
20
+ o.swapCost ?? 1,
21
+ o.actionPoints ?? 3,
22
+ o.passiveBudget ?? 6,
23
+ o.captureItems ?? 3,
24
+ o.escapeCost ?? 1,
25
+ o.escapeBaseChance ?? 0.25,
26
+ o.escapeRetryBonus ?? 0.2,
27
+ 0,
28
+ 0,
29
+ 0,
30
+ 0,
31
+ 0,
32
+ 0,
33
+ 0,
34
+ 0,
35
+ 0
36
+ ];
37
+ }
38
+ function battleOperation(a) {
39
+ switch (a.type) {
40
+ case "queue-action":
41
+ return {
42
+ op: 0,
43
+ data: [a.row, a.actionId, a.priority, a.speed, a.tieKey]
44
+ };
45
+ case "freeze-order":
46
+ return { op: 1, data: [a.turn] };
47
+ case "next-action":
48
+ return { op: 2, data: [] };
49
+ case "clear-order":
50
+ return { op: 3, data: [] };
51
+ case "type-row":
52
+ return { op: 4, data: [a.attackType, a.defenderType, a.multiplier] };
53
+ case "resolve-type":
54
+ return {
55
+ op: 5,
56
+ data: [
57
+ a.attackType,
58
+ a.defenderType,
59
+ a.secondType ?? 4,
60
+ a.raw,
61
+ a.damageSerial
62
+ ]
63
+ };
64
+ case "status-apply":
65
+ return {
66
+ op: 8,
67
+ data: [a.id, a.turns, a.phaseMask, Number(a.restrict), a.amount]
68
+ };
69
+ case "status-phase":
70
+ return { op: 9, data: [a.turn, a.phase] };
71
+ case "status-remove":
72
+ return { op: 10, data: [a.id] };
73
+ case "capture":
74
+ return {
75
+ op: 12,
76
+ data: [
77
+ a.attemptSerial,
78
+ a.seed,
79
+ a.health,
80
+ a.maximumHealth,
81
+ a.catchRate,
82
+ a.itemBonus,
83
+ a.statusBonus,
84
+ Number(a.eligible),
85
+ a.itemId
86
+ ]
87
+ };
88
+ case "capture-stock":
89
+ return { op: 13, data: [a.count] };
90
+ case "creature":
91
+ return {
92
+ op: 16,
93
+ data: [a.species, a.level, a.friendship, ...a.stats, ...a.moves]
94
+ };
95
+ case "evolution-rule":
96
+ return {
97
+ op: 17,
98
+ data: [
99
+ a.row,
100
+ a.from,
101
+ a.to,
102
+ a.level,
103
+ a.item,
104
+ a.friendship,
105
+ a.context,
106
+ ...a.stats,
107
+ a.keepMovesMask
108
+ ]
109
+ };
110
+ case "evolve":
111
+ return { op: 18, data: [a.evolutionSerial, a.item, a.context] };
112
+ case "creature-progress":
113
+ return { op: 19, data: [a.level, a.friendship] };
114
+ case "timing-start":
115
+ return {
116
+ op: 20,
117
+ data: [
118
+ a.moveSerial,
119
+ a.count,
120
+ a.window,
121
+ a.bonus,
122
+ ...a.times,
123
+ ...a.buttons
124
+ ]
125
+ };
126
+ case "timing-input":
127
+ return { op: 21, data: [a.button, a.timestamp] };
128
+ case "timing-finish":
129
+ return { op: 22, data: [] };
130
+ case "partner-register":
131
+ return { op: 24, data: [a.row, a.health, a.maximumHealth] };
132
+ case "partner-swap":
133
+ return { op: 25, data: [a.row] };
134
+ case "partner-health":
135
+ return { op: 26, data: [a.row, a.health] };
136
+ case "partner-turn":
137
+ return { op: 27, data: [a.turn, a.points] };
138
+ case "passive-row":
139
+ return {
140
+ op: 28,
141
+ data: [
142
+ a.row,
143
+ a.id,
144
+ a.cost,
145
+ a.group,
146
+ a.stat,
147
+ a.amount,
148
+ a.maximumStacks
149
+ ]
150
+ };
151
+ case "passive-equip":
152
+ return { op: 29, data: [...a.counts] };
153
+ case "passive-budget":
154
+ return { op: 30, data: [a.budget] };
155
+ case "passive-clear":
156
+ return { op: 31, data: [] };
157
+ case "field-contact":
158
+ return { op: 32, data: [a.side, a.attackId] };
159
+ case "opening-transfer":
160
+ return { op: 33, data: [a.encounterSerial] };
161
+ case "escape":
162
+ return {
163
+ op: 36,
164
+ data: [a.seed, a.speed, a.enemySpeed, Number(a.eligible)]
165
+ };
166
+ case "escape-turn":
167
+ return { op: 37, data: [a.turn, a.points] };
168
+ case "battle-end":
169
+ return { op: 39, data: [a.outcome] };
170
+ }
171
+ }
172
+
173
+ export {
174
+ BATTLE_ABILITIES,
175
+ BATTLE_EVENTS,
176
+ battleData,
177
+ battleOperation
178
+ };
@@ -0,0 +1,107 @@
1
+ // src/lib/behaviors/rhythm-performance/types.ts
2
+ var RHYTHM_ABILITIES = [
3
+ "timestamped-rhythm-judgment",
4
+ "hold-release-rhythm",
5
+ "call-and-response-pattern",
6
+ "tempo-map-chart-player",
7
+ "fret-chord-strum",
8
+ "hammer-on-pull-off-chain",
9
+ "sustain-note-tracking",
10
+ "phrase-earned-score-power",
11
+ "rhythm-scene-remix",
12
+ "performance-failure-meter"
13
+ ];
14
+ var RHYTHM_EVENTS = [
15
+ ...RHYTHM_ABILITIES,
16
+ "chart-or-clock",
17
+ "note-result",
18
+ "failed",
19
+ "scene-changed",
20
+ "cue"
21
+ ];
22
+ function rhythmData(o) {
23
+ return [
24
+ o.perfectMs ?? 30,
25
+ o.goodMs ?? 80,
26
+ o.lateMs ?? 120,
27
+ o.latencyMs ?? 0,
28
+ 0,
29
+ 0,
30
+ 0,
31
+ 0,
32
+ 0,
33
+ 0,
34
+ 0,
35
+ 0,
36
+ 0,
37
+ 0,
38
+ 0,
39
+ 0
40
+ ];
41
+ }
42
+ function rhythmOperation(a) {
43
+ switch (a.type) {
44
+ case "hit":
45
+ return { op: 0, data: [a.note, a.timestamp, a.lanes, a.scene] };
46
+ case "hold-press":
47
+ return { op: 4, data: [a.note, a.timestamp, a.lanes, a.scene] };
48
+ case "hold-release":
49
+ return { op: 5, data: [a.note, a.timestamp, a.lanes, a.scene] };
50
+ case "call":
51
+ return { op: 8, data: [a.start, a.response, a.duration] };
52
+ case "cue":
53
+ return { op: 9, data: [a.offset, a.lanes] };
54
+ case "response":
55
+ return { op: 10, data: [a.note, a.timestamp, a.lanes, a.scene] };
56
+ case "tempo":
57
+ return { op: 12, data: [a.beat, a.bpm] };
58
+ case "beat-note":
59
+ return { op: 13, data: [a.beat, a.lanes, a.scene] };
60
+ case "chart-hit":
61
+ return { op: 14, data: [a.note, a.timestamp, a.lanes, a.scene] };
62
+ case "seek":
63
+ return { op: 15, data: [a.timestamp] };
64
+ case "strum":
65
+ return { op: 16, data: [a.note, a.timestamp, a.lanes, a.scene] };
66
+ case "chain-strum":
67
+ return { op: 20, data: [a.note, a.timestamp, a.lanes, a.scene] };
68
+ case "fret-edge":
69
+ return { op: 21, data: [a.note, a.timestamp, a.lanes, a.scene] };
70
+ case "sustain-press":
71
+ return { op: 24, data: [a.note, a.timestamp, a.lanes, a.scene] };
72
+ case "sustain-release":
73
+ return { op: 25, data: [a.note, a.timestamp, a.lanes, a.scene] };
74
+ case "phrase":
75
+ return { op: 28, data: [a.first, a.last, a.reward] };
76
+ case "activate-power":
77
+ return { op: 29, data: [a.timestamp] };
78
+ case "power-hit":
79
+ return { op: 30, data: [a.note, a.timestamp, a.lanes, a.scene] };
80
+ case "transition":
81
+ return { op: 32, data: [a.timestamp, a.scene] };
82
+ case "remix-hit":
83
+ return { op: 33, data: [a.note, a.timestamp, a.lanes, a.scene] };
84
+ case "performance":
85
+ return { op: 36, data: [a.initial, a.hitGain, a.missLoss, a.threshold] };
86
+ case "performance-hit":
87
+ return { op: 37, data: [a.note, a.timestamp, a.lanes, a.scene] };
88
+ case "note":
89
+ return {
90
+ op: 40,
91
+ data: [a.kind, a.timestamp, a.end, a.lanes, a.scene, a.eligible]
92
+ };
93
+ case "start":
94
+ return { op: 41, data: [] };
95
+ case "clock":
96
+ return { op: 42, data: [a.timestamp] };
97
+ case "pause":
98
+ return { op: 43, data: [a.paused] };
99
+ }
100
+ }
101
+
102
+ export {
103
+ RHYTHM_ABILITIES,
104
+ RHYTHM_EVENTS,
105
+ rhythmData,
106
+ rhythmOperation
107
+ };
@@ -0,0 +1,132 @@
1
+ import {
2
+ COMBAT_ABILITIES
3
+ } from "./chunk-V4M46BF6.js";
4
+ import {
5
+ defineBehavior
6
+ } from "./chunk-5SMXQ6AU.js";
7
+ import {
8
+ BUILTIN_BEHAVIORS
9
+ } from "./chunk-S44ZHYE6.js";
10
+
11
+ // src/lib/behaviors/melee-combat/index.ts
12
+ var CombatSystem = class {
13
+ constructor(key, abilities, runtime, links) {
14
+ this.key = key;
15
+ this.abilities = abilities;
16
+ this.runtime = runtime;
17
+ this.links = links;
18
+ }
19
+ key;
20
+ abilities;
21
+ runtime;
22
+ links;
23
+ attached = /* @__PURE__ */ new Map();
24
+ update() {
25
+ if (!this.runtime) return;
26
+ const links = [...this.links?.(this.key) ?? []];
27
+ for (const [entity, { slot, ref }] of this.attached) {
28
+ if (!links.some(
29
+ (link) => link.entity === entity && link.ref === ref
30
+ ) || entity.runtimeHandle !== slot)
31
+ this.detach({ entity, ref });
32
+ }
33
+ for (const link of links) {
34
+ const entity = link.entity;
35
+ entity.$combat ??= {};
36
+ entity.combatState ??= null;
37
+ const slot = entity.runtimeHandle;
38
+ if (!Number.isInteger(slot) || slot < 0) continue;
39
+ if (!this.attached.has(entity)) {
40
+ if (!this.runtime.attachCombat(
41
+ slot,
42
+ this.abilities,
43
+ link.ref.options
44
+ )) {
45
+ throw new Error(
46
+ "Combat requires exclusive motion ownership, a dynamic solid body with gravityScale=0, and compatible rotation locks."
47
+ );
48
+ }
49
+ this.attached.set(entity, { slot, ref: link.ref });
50
+ }
51
+ this.runtime.combatInput(slot, entity.$combat);
52
+ }
53
+ }
54
+ postUpdate() {
55
+ for (const [entity, { slot }] of this.attached)
56
+ entity.combatState = this.runtime?.queryCombat(slot) ?? null;
57
+ }
58
+ detach(link) {
59
+ const slot = this.attached.get(link.entity)?.slot;
60
+ if (slot !== void 0 && this.runtime && !this.runtime.detachCombat(slot) && this.runtime.queryCombat(slot))
61
+ throw new Error("Failed to release combat ownership.");
62
+ this.attached.delete(link.entity);
63
+ link.entity.combatState = null;
64
+ }
65
+ destroy() {
66
+ for (const [entity, { ref }] of this.attached)
67
+ this.detach({ entity, ref });
68
+ }
69
+ };
70
+ function descriptor(name, abilities) {
71
+ return defineBehavior({
72
+ name,
73
+ metadata: BUILTIN_BEHAVIORS[name],
74
+ defaultOptions: {
75
+ gravity: 18,
76
+ speed: 5
77
+ },
78
+ systemFactory: (ctx) => new CombatSystem(
79
+ /* @__PURE__ */ Symbol.for(`zylem:behavior:${name}`),
80
+ abilities,
81
+ ctx.wasmStage ?? null,
82
+ ctx.getBehaviorLinks
83
+ )
84
+ });
85
+ }
86
+ var MeleeCombatBehavior = descriptor("melee-combat", COMBAT_ABILITIES);
87
+ var AttackPhaseHitboxesBehavior = descriptor("attack-phase-hitboxes", [
88
+ "attack-phase-hitboxes"
89
+ ]);
90
+ var DamageScaledKnockbackBehavior = descriptor(
91
+ "damage-scaled-knockback",
92
+ ["damage-scaled-knockback"]
93
+ );
94
+ var CombatHitstopBehavior = descriptor("combat-hitstop", [
95
+ "combat-hitstop"
96
+ ]);
97
+ var DepletingShieldBehavior = descriptor("depleting-shield", [
98
+ "depleting-shield"
99
+ ]);
100
+ var TimedPerfectGuardBehavior = descriptor("timed-perfect-guard", [
101
+ "timed-perfect-guard"
102
+ ]);
103
+ var GrabHoldThrowBehavior = descriptor("grab-hold-throw", [
104
+ "grab-hold-throw"
105
+ ]);
106
+ var AirDodgeRecoveryBehavior = descriptor("air-dodge-recovery", [
107
+ "air-dodge-recovery"
108
+ ]);
109
+ var DirectionalInfluenceBehavior = descriptor(
110
+ "directional-influence",
111
+ ["directional-influence"]
112
+ );
113
+ var ImpactTechWindowBehavior = descriptor("impact-tech-window", [
114
+ "impact-tech-window"
115
+ ]);
116
+ var GroundedAttackChainBehavior = descriptor("grounded-attack-chain", [
117
+ "grounded-attack-chain"
118
+ ]);
119
+
120
+ export {
121
+ MeleeCombatBehavior,
122
+ AttackPhaseHitboxesBehavior,
123
+ DamageScaledKnockbackBehavior,
124
+ CombatHitstopBehavior,
125
+ DepletingShieldBehavior,
126
+ TimedPerfectGuardBehavior,
127
+ GrabHoldThrowBehavior,
128
+ AirDodgeRecoveryBehavior,
129
+ DirectionalInfluenceBehavior,
130
+ ImpactTechWindowBehavior,
131
+ GroundedAttackChainBehavior
132
+ };
@@ -0,0 +1,135 @@
1
+ import {
2
+ ENCOUNTER_ABILITIES
3
+ } from "./chunk-73MHJY6R.js";
4
+ import {
5
+ defineBehavior
6
+ } from "./chunk-5SMXQ6AU.js";
7
+ import {
8
+ BUILTIN_BEHAVIORS
9
+ } from "./chunk-S44ZHYE6.js";
10
+
11
+ // src/lib/behaviors/combat-ai/index.ts
12
+ var EncounterSystem = class {
13
+ constructor(key, abilities, runtime, links) {
14
+ this.key = key;
15
+ this.abilities = abilities;
16
+ this.runtime = runtime;
17
+ this.links = links;
18
+ }
19
+ key;
20
+ abilities;
21
+ runtime;
22
+ links;
23
+ attached = /* @__PURE__ */ new Map();
24
+ update() {
25
+ if (!this.runtime) return;
26
+ const links = [...this.links?.(this.key) ?? []];
27
+ for (const [entity, { slot, ref }] of this.attached) {
28
+ if (!links.some(
29
+ (link) => link.entity === entity && link.ref === ref
30
+ ) || entity.runtimeHandle !== slot)
31
+ this.detach({ entity, ref });
32
+ }
33
+ for (const link of links) {
34
+ const entity = link.entity;
35
+ entity.encounterState ??= null;
36
+ const slot = entity.runtimeHandle;
37
+ if (!Number.isInteger(slot) || slot < 0) continue;
38
+ if (!this.attached.has(entity)) {
39
+ if (!this.runtime.attachEncounters(
40
+ slot,
41
+ this.abilities,
42
+ link.ref.options
43
+ )) {
44
+ throw new Error(
45
+ "Encounter attachment requires valid options and an available AI component slot."
46
+ );
47
+ }
48
+ this.attached.set(entity, { slot, ref: link.ref });
49
+ }
50
+ }
51
+ }
52
+ postUpdate() {
53
+ for (const [entity, { slot }] of this.attached)
54
+ entity.encounterState = this.runtime?.queryEncounters(slot) ?? null;
55
+ }
56
+ detach(link) {
57
+ const slot = this.attached.get(link.entity)?.slot;
58
+ if (slot !== void 0 && this.runtime && !this.runtime.detachEncounters(slot) && this.runtime.queryEncounters(slot))
59
+ throw new Error("Failed to detach encounter policy.");
60
+ this.attached.delete(link.entity);
61
+ link.entity.encounterState = null;
62
+ }
63
+ destroy() {
64
+ for (const [entity, { ref }] of this.attached)
65
+ this.detach({ entity, ref });
66
+ }
67
+ };
68
+ function descriptor(name, abilities) {
69
+ return defineBehavior({
70
+ name,
71
+ metadata: BUILTIN_BEHAVIORS[name],
72
+ defaultOptions: {
73
+ health: 100,
74
+ team: 1
75
+ },
76
+ systemFactory: (ctx) => new EncounterSystem(
77
+ /* @__PURE__ */ Symbol.for(`zylem:behavior:${name}`),
78
+ abilities,
79
+ ctx.wasmStage ?? null,
80
+ ctx.getBehaviorLinks
81
+ )
82
+ });
83
+ }
84
+ var CombatAIBehavior = descriptor("combat-ai", ENCOUNTER_ABILITIES);
85
+ var SquadFlankAssignmentBehavior = descriptor(
86
+ "squad-flank-assignment",
87
+ ["squad-flank-assignment"]
88
+ );
89
+ var LeaderLossMoraleBehavior = descriptor("leader-loss-morale", [
90
+ "leader-loss-morale"
91
+ ]);
92
+ var GrenadeDangerEvasionBehavior = descriptor(
93
+ "grenade-danger-evasion",
94
+ ["grenade-danger-evasion"]
95
+ );
96
+ var CoverPeekCycleBehavior = descriptor("cover-peek-cycle", [
97
+ "cover-peek-cycle"
98
+ ]);
99
+ var ThreatTargetSelectionBehavior = descriptor(
100
+ "threat-target-selection",
101
+ ["threat-target-selection"]
102
+ );
103
+ var TacticalBurstSelectionBehavior = descriptor(
104
+ "tactical-burst-selection",
105
+ ["tactical-burst-selection"]
106
+ );
107
+ var LatentAmbushActivationBehavior = descriptor(
108
+ "latent-ambush-activation",
109
+ ["latent-ambush-activation"]
110
+ );
111
+ var BossPhaseControllerBehavior = descriptor("boss-phase-controller", [
112
+ "boss-phase-controller"
113
+ ]);
114
+ var LocalizedWeakPointDamageBehavior = descriptor(
115
+ "localized-weak-point-damage",
116
+ ["localized-weak-point-damage"]
117
+ );
118
+ var ShootableProjectileInterceptionBehavior = descriptor(
119
+ "shootable-projectile-interception",
120
+ ["shootable-projectile-interception"]
121
+ );
122
+
123
+ export {
124
+ CombatAIBehavior,
125
+ SquadFlankAssignmentBehavior,
126
+ LeaderLossMoraleBehavior,
127
+ GrenadeDangerEvasionBehavior,
128
+ CoverPeekCycleBehavior,
129
+ ThreatTargetSelectionBehavior,
130
+ TacticalBurstSelectionBehavior,
131
+ LatentAmbushActivationBehavior,
132
+ BossPhaseControllerBehavior,
133
+ LocalizedWeakPointDamageBehavior,
134
+ ShootableProjectileInterceptionBehavior
135
+ };
@@ -1,16 +1,19 @@
1
- import {
2
- SyncStateMachine,
3
- import_typescript_fsm
4
- } from "./chunk-CBQSC6W3.js";
5
1
  import {
6
2
  STAGE_INPUT_BUTTON_JUMP,
7
3
  STAGE_INPUT_BUTTON_RUN,
8
4
  StagePlatformerShapeSource,
9
5
  readBehaviorSnapshot
10
- } from "./chunk-GZ3DQIIZ.js";
6
+ } from "./chunk-BR33KT4Z.js";
7
+ import {
8
+ SyncStateMachine,
9
+ import_typescript_fsm
10
+ } from "./chunk-CBQSC6W3.js";
11
11
  import {
12
12
  defineBehavior
13
- } from "./chunk-YDLO5M7S.js";
13
+ } from "./chunk-5SMXQ6AU.js";
14
+ import {
15
+ BUILTIN_BEHAVIORS
16
+ } from "./chunk-S44ZHYE6.js";
14
17
 
15
18
  // src/lib/behaviors/platformer-2d/components.ts
16
19
  function createPlatformer2DMovementComponent(options = {}) {
@@ -313,6 +316,7 @@ var Platformer2DBehaviorSystem = class {
313
316
  };
314
317
  var Platformer2DBehavior = defineBehavior({
315
318
  name: "platformer-2d",
319
+ metadata: BUILTIN_BEHAVIORS["platformer-2d"],
316
320
  defaultOptions,
317
321
  systemFactory: (ctx) => new Platformer2DBehaviorSystem(
318
322
  ctx.wasmStage ?? null,
@@ -0,0 +1,126 @@
1
+ // src/lib/behaviors/survival-resources/types.ts
2
+ var SURVIVAL_ABILITIES = [
3
+ "escort-follow-wait",
4
+ "companion-abduction-objective",
5
+ "environmental-vault-action",
6
+ "stagger-finisher-opportunity",
7
+ "adaptive-encounter-pressure",
8
+ "spatial-inventory-packing",
9
+ "ingredient-combination",
10
+ "weapon-upgrade-track",
11
+ "encounter-clear-lock",
12
+ "save-point-checkpoint"
13
+ ];
14
+ function survivalData(o) {
15
+ return [
16
+ o.followDistance ?? 1.5,
17
+ o.maxTravelDistance ?? 20,
18
+ o.interactionRange ?? 3,
19
+ o.boundaryRadius ?? 1,
20
+ o.finisherRange ?? 2.5,
21
+ o.minPressure ?? 1,
22
+ o.maxPressure ?? 5,
23
+ o.columns ?? 6,
24
+ o.rows ?? 4,
25
+ o.pressureGain ?? 0.5,
26
+ 0,
27
+ 0,
28
+ 0,
29
+ 0,
30
+ 0,
31
+ 0
32
+ ];
33
+ }
34
+ function survivalOperation(a) {
35
+ switch (a.type) {
36
+ case "follow":
37
+ return { op: 0, data: [] };
38
+ case "wait":
39
+ return { op: 1, data: [] };
40
+ case "seek-safe":
41
+ return { op: 2, data: [...a.position] };
42
+ case "capture":
43
+ return { op: 3, data: [...a.boundary] };
44
+ case "rescue":
45
+ return { op: 4, data: [] };
46
+ case "vault":
47
+ return { op: 5, data: [...a.landing, a.height, a.duration] };
48
+ case "cancel-vault":
49
+ return { op: 6, data: [] };
50
+ case "stagger":
51
+ return { op: 7, data: [a.class, a.duration] };
52
+ case "finish":
53
+ return { op: 8, data: [a.eligibleMask] };
54
+ case "performance":
55
+ return { op: 9, data: [a.score] };
56
+ case "begin-encounter":
57
+ return { op: 10, data: [] };
58
+ case "pack":
59
+ return {
60
+ op: 11,
61
+ data: [
62
+ a.kind,
63
+ a.quantity,
64
+ a.limit,
65
+ a.shape,
66
+ a.x,
67
+ a.y,
68
+ Number(a.rotated ?? false)
69
+ ]
70
+ };
71
+ case "move-item":
72
+ return {
73
+ op: 12,
74
+ data: [a.item, a.x, a.y, Number(a.rotated ?? false)]
75
+ };
76
+ case "stack":
77
+ return { op: 13, data: [a.item, a.into, a.quantity] };
78
+ case "stock":
79
+ return { op: 14, data: [a.kind, a.quantity, a.limit] };
80
+ case "recipe":
81
+ return {
82
+ op: 15,
83
+ data: [
84
+ a.id,
85
+ a.first,
86
+ a.firstCount,
87
+ a.second,
88
+ a.secondCount,
89
+ a.output,
90
+ a.outputCount,
91
+ a.limit
92
+ ]
93
+ };
94
+ case "combine":
95
+ return { op: 16, data: [a.recipe] };
96
+ case "credit":
97
+ return { op: 17, data: [a.amount] };
98
+ case "upgrade-level":
99
+ return { op: 18, data: [a.level, a.cost, a.gate, a.value] };
100
+ case "purchase":
101
+ return { op: 19, data: [a.unlockedGate] };
102
+ case "expect-spawns":
103
+ return { op: 20, data: [a.count] };
104
+ case "track-enemy":
105
+ return { op: 21, data: [a.id] };
106
+ case "resolve-enemy":
107
+ return {
108
+ op: 22,
109
+ data: [a.id, a.resolution === "defeated" ? 1 : 2]
110
+ };
111
+ case "link-gate":
112
+ return { op: 23, data: [] };
113
+ case "save-permission":
114
+ return { op: 24, data: [Number(a.allowed)] };
115
+ case "request-save":
116
+ return { op: 25, data: [a.checkpoint] };
117
+ case "complete-save":
118
+ return { op: 26, data: [a.saveRequest, Number(a.success)] };
119
+ }
120
+ }
121
+
122
+ export {
123
+ SURVIVAL_ABILITIES,
124
+ survivalData,
125
+ survivalOperation
126
+ };