@reldens/skills 0.54.0 → 0.58.0

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 CHANGED
@@ -1,353 +1,353 @@
1
- [![Reldens - GitHub - Release](https://www.dwdeveloper.com/media/reldens/reldens-mmorpg-platform.png)](https://github.com/damian-pastorini/reldens)
2
-
3
- # Reldens - Skills
4
-
5
- ## About
6
- The idea behind this package is to provide a comprehensive skills and experience system that can be attached to any target owner.
7
- This opinionated yet flexible implementation includes class paths, leveling systems, skill trees, and experience management with full event-driven architecture.
8
-
9
- The package offers both client and server-side functionality, including automatic level progression, skill validation, damage calculations, physical attacks, effects system, and complete real-time synchronization via Sender/Receiver pattern.
10
-
11
-
12
- ---
13
-
14
- ## Features
15
-
16
- - **Level Sets & Experience System**: Automatic level progression with configurable experience requirements, level-based modifiers, and auto-fill ranges
17
- - **Class Paths & Skill Trees**: Skill progression with level-dependent skill unlocks, dynamic labeling per level, and skill management
18
- - **Multiple Skill Types**: Base skills, attacks with damage calculation, effects (buffs/debuffs), physical attacks and effects with collision detection
19
- - **Combat Mechanics**: Critical hits (chance/multiplier/fixed), dodge calculations, range validation, attack vs defense properties, and aim vs dodge systems
20
- - **Real-time Communication**: Built-in Sender/Receiver architecture for server-client synchronization with compressed message format
21
- - **Event-Driven Architecture**: Comprehensive event system with 30+ events for custom logic integration, all namespaced by owner
22
- - **Modular Design**: Flexible configuration with custom conditions, modifiers, extensible skill logic, and physics integration
23
- - **Standalone Package**: Can be used independently from main Reldens platform with any entity that implements `getPosition()` method
24
-
25
- Need something specific?
26
-
27
- [Request a feature here: https://www.reldens.com/features-request](https://www.reldens.com/features-request)
28
-
29
- ---
30
-
31
- ## Installation
32
-
33
- ```bash
34
- npm install @reldens/skills
35
- ```
36
-
37
- ## Quick Start
38
-
39
- ### Basic Skill Example
40
-
41
- ```javascript
42
- const { Skill } = require('@reldens/skills');
43
-
44
- // Create a simple skill
45
- let healSkill = new Skill({
46
- key: 'heal',
47
- owner: playerEntity, // Must have getPosition() method
48
- range: 100,
49
- castTime: 1000, // 1 second cast time
50
- skillDelay: 5000 // 5 second cooldown
51
- });
52
-
53
- // Execute the skill
54
- await healSkill.execute(targetEntity);
55
- ```
56
-
57
- ### Attack Skill with Damage
58
-
59
- ```javascript
60
- const { Attack } = require('@reldens/skills/lib/types/attack');
61
-
62
- let fireballSkill = new Attack({
63
- key: 'fireball',
64
- owner: playerEntity,
65
- affectedProperty: 'hp', // Property to damage
66
- hitDamage: 50,
67
- range: 200,
68
- attackProperties: ['atk', 'magicPower'], // Owner properties for attack
69
- defenseProperties: ['def', 'magicResist'], // Target properties for defense
70
- aimProperties: ['accuracy'],
71
- dodgeProperties: ['agility'],
72
- criticalChance: 20, // 20% chance
73
- criticalMultiplier: 2 // 2x damage on crit
74
- });
75
-
76
- await fireballSkill.execute(enemy);
77
- ```
78
-
79
- ### Level System with Auto-Progression
80
-
81
- ```javascript
82
- const { LevelsSet, Level } = require('@reldens/skills');
83
-
84
- let levels = {
85
- 1: new Level({key: 1, modifiers: [], requiredExperience: 0}),
86
- 5: new Level({key: 5, modifiers: [], requiredExperience: 1000})
87
- };
88
-
89
- let levelsSet = new LevelsSet({owner: playerEntity});
90
- await levelsSet.init({
91
- owner: playerEntity,
92
- levels: levels,
93
- currentLevel: 1,
94
- currentExp: 0,
95
- autoFillRanges: true, // Auto-generate levels 2, 3, 4
96
- increaseLevelsWithExperience: true // Auto level up
97
- });
98
-
99
- // Add experience (will auto-level up at 1000 XP)
100
- await levelsSet.addExperience(500);
101
- await levelsSet.addExperience(600); // Levels up to 5!
102
- ```
103
-
104
- ### Class Path with Skill Tree
105
-
106
- ```javascript
107
- const { ClassPath } = require('@reldens/skills');
108
-
109
- let classPath = new ClassPath({owner: playerEntity});
110
- await classPath.init({
111
- owner: playerEntity,
112
- key: 'warrior',
113
- label: 'Warrior',
114
- levels: levels,
115
- currentLevel: 1,
116
- labelsByLevel: {
117
- 1: 'Novice Warrior',
118
- 5: 'Experienced Warrior',
119
- 10: 'Master Warrior'
120
- },
121
- skillsByLevel: {
122
- 1: [swordSlashSkill],
123
- 5: [shieldBlockSkill, battleCrySkill],
124
- 10: [whirlwindSkill]
125
- }
126
- });
127
-
128
- // Player starts with swordSlashSkill
129
- // At level 5: gains shieldBlockSkill and battleCrySkill
130
- // At level 10: gains whirlwindSkill
131
- ```
132
-
133
- ### Server-Side with Client Sync
134
-
135
- ```javascript
136
- const { SkillsServer } = require('@reldens/skills');
137
-
138
- let skillsServer = new SkillsServer({
139
- owner: playerEntity,
140
- client: roomClient, // Colyseus client with send() and broadcast()
141
- key: 'mage',
142
- levels: levels,
143
- skillsByLevel: {
144
- 1: [fireballSkill, iceSpearSkill]
145
- }
146
- });
147
-
148
- // Automatically syncs to client:
149
- // - Initial class data (level, label, XP, skills)
150
- // - Level ups
151
- // - XP gains
152
- // - Skill casts
153
- // - Damage application
154
- ```
155
-
156
- ### Client-Side Receiver
157
-
158
- ```javascript
159
- const { Receiver } = require('@reldens/skills/lib/client/receiver');
160
-
161
- class SkillsUI extends Receiver
162
- {
163
- constructor(props)
164
- {
165
- super(props);
166
- }
167
-
168
- onLevelUp(message)
169
- {
170
- // message.data = {lvl: 5, lab: 'Experienced Warrior', skl: ['sword', 'shield'], ne: 2000}
171
- updateLevelDisplay(message.data.lvl);
172
- updateSkillBar(message.data.skl);
173
- }
174
-
175
- onLevelExperienceAdded(message)
176
- {
177
- // message.data = {exp: 1500}
178
- updateXPBar(message.data.exp);
179
- }
180
-
181
- onSkillAttackApplyDamage(message)
182
- {
183
- // message.data = {d: 85}
184
- showDamageNumber(message.data.d);
185
- }
186
- }
187
-
188
- let receiver = new SkillsUI({owner: playerEntity});
189
- gameClient.onMessage('*', (msg) => receiver.processMessage(msg));
190
- ```
191
-
192
- ### Event Hooks
193
-
194
- ```javascript
195
- const SkillsEvents = require('@reldens/skills/lib/skills-events');
196
-
197
- // Listen to level up
198
- classPath.listenEvent(SkillsEvents.LEVEL_UP, async (classPath) => {
199
- console.log(`Leveled up to ${classPath.currentLevel}!`);
200
- awardAchievement('level_up');
201
- }, 'levelUpListener', classPath.getOwnerEventKey());
202
-
203
- // Listen to skill execution
204
- skill.listenEvent(SkillsEvents.SKILL_AFTER_EXECUTE, async (skill, target) => {
205
- console.log(`Skill ${skill.key} executed on ${target.name}`);
206
- playAnimation(skill.key);
207
- }, 'skillExecListener', skill.getOwnerEventKey());
208
-
209
- // Listen to damage application
210
- attackSkill.listenEvent(SkillsEvents.SKILL_ATTACK_APPLY_DAMAGE, async (skill, target, damage) => {
211
- console.log(`Dealt ${damage} damage to ${target.name}`);
212
- showFloatingText(damage, target.position);
213
- }, 'damageListener', attackSkill.getOwnerEventKey());
214
- ```
215
-
216
- ---
217
-
218
- ## Core Concepts
219
-
220
- ### Skill Types
221
-
222
- 1. **Skill** (`lib/skill.js`): Base class with validation, range checking, cooldowns, cast time
223
- 2. **Attack** (`lib/types/attack.js`): Damage calculation with atk/def, aim/dodge, critical hits
224
- 3. **Effect** (`lib/types/effect.js`): Applies modifiers to target (buffs/debuffs)
225
- 4. **PhysicalAttack** (`lib/types/physical-attack.js`): Physics-enabled attack with collision detection
226
- 5. **PhysicalEffect** (`lib/types/physical-effect.js`): Physics-enabled effect with collision detection
227
-
228
- ### Level Progression
229
-
230
- - **Level**: Single level with modifiers and required XP
231
- - **LevelsSet**: Manages multiple levels, XP tracking, auto-leveling
232
- - **ClassPath**: Extends LevelsSet with skill trees and dynamic labels
233
-
234
- ### Communication
235
-
236
- - **Sender** (`lib/server/sender.js`): Broadcasts skill/level events to clients with compressed messages
237
- - **Receiver** (`lib/client/receiver.js`): Processes server messages and maps to handler methods
238
-
239
- ### Events
240
-
241
- 30+ events covering:
242
- - Level progression (level up/down, XP added, modifiers applied)
243
- - Class paths (init, skills added/removed)
244
- - Skill execution (validate, cast, execute, damage/effects applied)
245
- - Range checking, physical collisions
246
-
247
- All events are namespaced by owner for multiplayer support.
248
-
249
- ---
250
-
251
- ## API Reference
252
-
253
- ### Skill Class
254
-
255
- **Constructor Properties**:
256
- - `key` (required): Unique skill identifier
257
- - `owner` (required): Entity with `getPosition()` method
258
- - `target`: Target entity (or pass in execute)
259
- - `range`: Skill range (0 = infinite)
260
- - `rangeAutomaticValidation`: Validate range before execution
261
- - `allowSelfTarget`: Allow targeting owner
262
- - `castTime`: Cast time in milliseconds
263
- - `skillDelay`: Cooldown in milliseconds
264
- - `usesLimit`: Max uses (0 = unlimited)
265
- - `ownerConditions`: Array of Condition instances
266
- - `ownerEffects`: Array of modifiers for owner
267
- - `criticalChance`: 0-100 crit chance
268
- - `criticalMultiplier`: Damage multiplier on crit
269
- - `criticalFixedValue`: Fixed damage added on crit
270
-
271
- **Methods**:
272
- - `validate()`: Check if skill can be activated
273
- - `execute(target)`: Execute the skill
274
- - `runSkillLogic()`: Override for custom logic
275
- - `onExecuteConditions()`: Override for custom validation
276
- - `validateRange(target)`: Check if target in range
277
- - `applyModifiers(modifiers, target)`: Apply modifiers with critical
278
- - `fireEvent(eventName, ...args)`: Fire namespaced event
279
- - `listenEvent(eventName, callback, removeKey, masterKey)`: Listen to event
280
-
281
- ### Attack Class
282
-
283
- Extends Skill with additional properties:
284
- - `affectedProperty` (required): Property to damage (e.g., 'hp')
285
- - `hitDamage`: Base damage at 100%
286
- - `applyDirectDamage`: Skip calculations
287
- - `attackProperties`: Owner atk property names
288
- - `defenseProperties`: Target def property names
289
- - `aimProperties`: Owner aim property names
290
- - `dodgeProperties`: Target dodge property names
291
- - `dodgeFullEnabled`: Enable full dodge
292
- - `dodgeOverAimSuccess`: Dodge threshold multiplier
293
- - `damageAffected`: Apply dodge/aim to damage
294
- - `criticalAffected`: Apply dodge/aim to critical
295
- - `allowEffectBelowZero`: Allow negative values
296
-
297
- ### LevelsSet Class
298
-
299
- **Constructor Properties**:
300
- - `owner` (required): Entity with `getPosition()` method
301
- - `events`: EventsManager instance
302
-
303
- **Init Properties**:
304
- - `levels` (required): Object of Level instances
305
- - `currentLevel`: Starting level
306
- - `currentExp`: Starting XP
307
- - `autoFillRanges`: Auto-generate intermediate levels
308
- - `autoFillExperienceMultiplier`: XP multiplier for auto-gen (default: 1.5)
309
- - `increaseLevelsWithExperience`: Auto level up when XP threshold met
310
- - `levelsByExperience`: Custom level order array
311
- - `setRequiredExperienceLimit`: Cap XP at max level
312
-
313
- **Methods**:
314
- - `init(props)`: Initialize level set
315
- - `levelUp()`: Increase level, apply modifiers
316
- - `levelDown()`: Decrease level, revert modifiers
317
- - `addExperience(number)`: Add XP, auto-level if enabled
318
- - `getNextLevelExperience()`: Get XP for next level
319
- - `getLevelInstance(levelKey)`: Get Level by key
320
-
321
- ### ClassPath Class
322
-
323
- Extends LevelsSet with additional properties:
324
- - `key` (required): Class identifier
325
- - `label`: Display name
326
- - `labelsByLevel`: {levelKey: 'label'} object
327
- - `currentLabel`: Active label
328
- - `skillsByLevel`: {levelKey: [Skill instances]} object
329
- - `currentSkills`: Active skills object
330
- - `affectedProperty`: Property for class skills
331
-
332
- **Methods**:
333
- - `addSkills(skills)`: Add skills to current set
334
- - `removeSkills(skills)`: Remove skills by keys
335
- - `setOwnerSkills(skills)`: Initialize skills based on level
336
-
337
- ---
338
-
339
- ## Documentation
340
-
341
- [https://www.reldens.com/documentation/skills](https://www.reldens.com/documentation/skills)
342
-
343
- ---
344
-
345
- ## License
346
-
347
- MIT
348
-
349
- ---
350
-
351
- ### [Reldens](https://github.com/damian-pastorini/reldens/ "Reldens")
352
-
353
- ##### [By DwDeveloper](https://www.dwdeveloper.com/ "DwDeveloper")
1
+ [![Reldens - GitHub - Release](https://www.dwdeveloper.com/media/reldens/reldens-mmorpg-platform.png)](https://github.com/damian-pastorini/reldens)
2
+
3
+ # Reldens - Skills
4
+
5
+ ## About
6
+ The idea behind this package is to provide a comprehensive skills and experience system that can be attached to any target owner.
7
+ This opinionated yet flexible implementation includes class paths, leveling systems, skill trees, and experience management with full event-driven architecture.
8
+
9
+ The package offers both client and server-side functionality, including automatic level progression, skill validation, damage calculations, physical attacks, effects system, and complete real-time synchronization via Sender/Receiver pattern.
10
+
11
+
12
+ ---
13
+
14
+ ## Features
15
+
16
+ - **Level Sets & Experience System**: Automatic level progression with configurable experience requirements, level-based modifiers, and auto-fill ranges
17
+ - **Class Paths & Skill Trees**: Skill progression with level-dependent skill unlocks, dynamic labeling per level, and skill management
18
+ - **Multiple Skill Types**: Base skills, attacks with damage calculation, effects (buffs/debuffs), physical attacks and effects with collision detection
19
+ - **Combat Mechanics**: Critical hits (chance/multiplier/fixed), dodge calculations, range validation, attack vs defense properties, and aim vs dodge systems
20
+ - **Real-time Communication**: Built-in Sender/Receiver architecture for server-client synchronization with compressed message format
21
+ - **Event-Driven Architecture**: Comprehensive event system with 30+ events for custom logic integration, all namespaced by owner
22
+ - **Modular Design**: Flexible configuration with custom conditions, modifiers, extensible skill logic, and physics integration
23
+ - **Standalone Package**: Can be used independently from main Reldens platform with any entity that implements `getPosition()` method
24
+
25
+ Need something specific?
26
+
27
+ [Request a feature here: https://www.reldens.com/features-request](https://www.reldens.com/features-request)
28
+
29
+ ---
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ npm install @reldens/skills
35
+ ```
36
+
37
+ ## Quick Start
38
+
39
+ ### Basic Skill Example
40
+
41
+ ```javascript
42
+ const { Skill } = require('@reldens/skills');
43
+
44
+ // Create a simple skill
45
+ let healSkill = new Skill({
46
+ key: 'heal',
47
+ owner: playerEntity, // Must have getPosition() method
48
+ range: 100,
49
+ castTime: 1000, // 1 second cast time
50
+ skillDelay: 5000 // 5 second cooldown
51
+ });
52
+
53
+ // Execute the skill
54
+ await healSkill.execute(targetEntity);
55
+ ```
56
+
57
+ ### Attack Skill with Damage
58
+
59
+ ```javascript
60
+ const { Attack } = require('@reldens/skills/lib/types/attack');
61
+
62
+ let fireballSkill = new Attack({
63
+ key: 'fireball',
64
+ owner: playerEntity,
65
+ affectedProperty: 'hp', // Property to damage
66
+ hitDamage: 50,
67
+ range: 200,
68
+ attackProperties: ['atk', 'magicPower'], // Owner properties for attack
69
+ defenseProperties: ['def', 'magicResist'], // Target properties for defense
70
+ aimProperties: ['accuracy'],
71
+ dodgeProperties: ['agility'],
72
+ criticalChance: 20, // 20% chance
73
+ criticalMultiplier: 2 // 2x damage on crit
74
+ });
75
+
76
+ await fireballSkill.execute(enemy);
77
+ ```
78
+
79
+ ### Level System with Auto-Progression
80
+
81
+ ```javascript
82
+ const { LevelsSet, Level } = require('@reldens/skills');
83
+
84
+ let levels = {
85
+ 1: new Level({key: 1, modifiers: [], requiredExperience: 0}),
86
+ 5: new Level({key: 5, modifiers: [], requiredExperience: 1000})
87
+ };
88
+
89
+ let levelsSet = new LevelsSet({owner: playerEntity});
90
+ await levelsSet.init({
91
+ owner: playerEntity,
92
+ levels: levels,
93
+ currentLevel: 1,
94
+ currentExp: 0,
95
+ autoFillRanges: true, // Auto-generate levels 2, 3, 4
96
+ increaseLevelsWithExperience: true // Auto level up
97
+ });
98
+
99
+ // Add experience (will auto-level up at 1000 XP)
100
+ await levelsSet.addExperience(500);
101
+ await levelsSet.addExperience(600); // Levels up to 5!
102
+ ```
103
+
104
+ ### Class Path with Skill Tree
105
+
106
+ ```javascript
107
+ const { ClassPath } = require('@reldens/skills');
108
+
109
+ let classPath = new ClassPath({owner: playerEntity});
110
+ await classPath.init({
111
+ owner: playerEntity,
112
+ key: 'warrior',
113
+ label: 'Warrior',
114
+ levels: levels,
115
+ currentLevel: 1,
116
+ labelsByLevel: {
117
+ 1: 'Novice Warrior',
118
+ 5: 'Experienced Warrior',
119
+ 10: 'Master Warrior'
120
+ },
121
+ skillsByLevel: {
122
+ 1: [swordSlashSkill],
123
+ 5: [shieldBlockSkill, battleCrySkill],
124
+ 10: [whirlwindSkill]
125
+ }
126
+ });
127
+
128
+ // Player starts with swordSlashSkill
129
+ // At level 5: gains shieldBlockSkill and battleCrySkill
130
+ // At level 10: gains whirlwindSkill
131
+ ```
132
+
133
+ ### Server-Side with Client Sync
134
+
135
+ ```javascript
136
+ const { SkillsServer } = require('@reldens/skills');
137
+
138
+ let skillsServer = new SkillsServer({
139
+ owner: playerEntity,
140
+ client: roomClient, // Colyseus client with send() and broadcast()
141
+ key: 'mage',
142
+ levels: levels,
143
+ skillsByLevel: {
144
+ 1: [fireballSkill, iceSpearSkill]
145
+ }
146
+ });
147
+
148
+ // Automatically syncs to client:
149
+ // - Initial class data (level, label, XP, skills)
150
+ // - Level ups
151
+ // - XP gains
152
+ // - Skill casts
153
+ // - Damage application
154
+ ```
155
+
156
+ ### Client-Side Receiver
157
+
158
+ ```javascript
159
+ const { Receiver } = require('@reldens/skills/lib/client/receiver');
160
+
161
+ class SkillsUI extends Receiver
162
+ {
163
+ constructor(props)
164
+ {
165
+ super(props);
166
+ }
167
+
168
+ onLevelUp(message)
169
+ {
170
+ // message.data = {lvl: 5, lab: 'Experienced Warrior', skl: ['sword', 'shield'], ne: 2000}
171
+ updateLevelDisplay(message.data.lvl);
172
+ updateSkillBar(message.data.skl);
173
+ }
174
+
175
+ onLevelExperienceAdded(message)
176
+ {
177
+ // message.data = {exp: 1500}
178
+ updateXPBar(message.data.exp);
179
+ }
180
+
181
+ onSkillAttackApplyDamage(message)
182
+ {
183
+ // message.data = {d: 85}
184
+ showDamageNumber(message.data.d);
185
+ }
186
+ }
187
+
188
+ let receiver = new SkillsUI({owner: playerEntity});
189
+ gameClient.onMessage('*', (msg) => receiver.processMessage(msg));
190
+ ```
191
+
192
+ ### Event Hooks
193
+
194
+ ```javascript
195
+ const SkillsEvents = require('@reldens/skills/lib/skills-events');
196
+
197
+ // Listen to level up
198
+ classPath.listenEvent(SkillsEvents.LEVEL_UP, async (classPath) => {
199
+ console.log(`Leveled up to ${classPath.currentLevel}!`);
200
+ awardAchievement('level_up');
201
+ }, 'levelUpListener', classPath.getOwnerEventKey());
202
+
203
+ // Listen to skill execution
204
+ skill.listenEvent(SkillsEvents.SKILL_AFTER_EXECUTE, async (skill, target) => {
205
+ console.log(`Skill ${skill.key} executed on ${target.name}`);
206
+ playAnimation(skill.key);
207
+ }, 'skillExecListener', skill.getOwnerEventKey());
208
+
209
+ // Listen to damage application
210
+ attackSkill.listenEvent(SkillsEvents.SKILL_ATTACK_APPLY_DAMAGE, async (skill, target, damage) => {
211
+ console.log(`Dealt ${damage} damage to ${target.name}`);
212
+ showFloatingText(damage, target.position);
213
+ }, 'damageListener', attackSkill.getOwnerEventKey());
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Core Concepts
219
+
220
+ ### Skill Types
221
+
222
+ 1. **Skill** (`lib/skill.js`): Base class with validation, range checking, cooldowns, cast time
223
+ 2. **Attack** (`lib/types/attack.js`): Damage calculation with atk/def, aim/dodge, critical hits
224
+ 3. **Effect** (`lib/types/effect.js`): Applies modifiers to target (buffs/debuffs)
225
+ 4. **PhysicalAttack** (`lib/types/physical-attack.js`): Physics-enabled attack with collision detection
226
+ 5. **PhysicalEffect** (`lib/types/physical-effect.js`): Physics-enabled effect with collision detection
227
+
228
+ ### Level Progression
229
+
230
+ - **Level**: Single level with modifiers and required XP
231
+ - **LevelsSet**: Manages multiple levels, XP tracking, auto-leveling
232
+ - **ClassPath**: Extends LevelsSet with skill trees and dynamic labels
233
+
234
+ ### Communication
235
+
236
+ - **Sender** (`lib/server/sender.js`): Broadcasts skill/level events to clients with compressed messages
237
+ - **Receiver** (`lib/client/receiver.js`): Processes server messages and maps to handler methods
238
+
239
+ ### Events
240
+
241
+ 30+ events covering:
242
+ - Level progression (level up/down, XP added, modifiers applied)
243
+ - Class paths (init, skills added/removed)
244
+ - Skill execution (validate, cast, execute, damage/effects applied)
245
+ - Range checking, physical collisions
246
+
247
+ All events are namespaced by owner for multiplayer support.
248
+
249
+ ---
250
+
251
+ ## API Reference
252
+
253
+ ### Skill Class
254
+
255
+ **Constructor Properties**:
256
+ - `key` (required): Unique skill identifier
257
+ - `owner` (required): Entity with `getPosition()` method
258
+ - `target`: Target entity (or pass in execute)
259
+ - `range`: Skill range (0 = infinite)
260
+ - `rangeAutomaticValidation`: Validate range before execution
261
+ - `allowSelfTarget`: Allow targeting owner
262
+ - `castTime`: Cast time in milliseconds
263
+ - `skillDelay`: Cooldown in milliseconds
264
+ - `usesLimit`: Max uses (0 = unlimited)
265
+ - `ownerConditions`: Array of Condition instances
266
+ - `ownerEffects`: Array of modifiers for owner
267
+ - `criticalChance`: 0-100 crit chance
268
+ - `criticalMultiplier`: Damage multiplier on crit
269
+ - `criticalFixedValue`: Fixed damage added on crit
270
+
271
+ **Methods**:
272
+ - `validate()`: Check if skill can be activated
273
+ - `execute(target)`: Execute the skill
274
+ - `runSkillLogic()`: Override for custom logic
275
+ - `onExecuteConditions()`: Override for custom validation
276
+ - `validateRange(target)`: Check if target in range
277
+ - `applyModifiers(modifiers, target)`: Apply modifiers with critical
278
+ - `fireEvent(eventName, ...args)`: Fire namespaced event
279
+ - `listenEvent(eventName, callback, removeKey, masterKey)`: Listen to event
280
+
281
+ ### Attack Class
282
+
283
+ Extends Skill with additional properties:
284
+ - `affectedProperty` (required): Property to damage (e.g., 'hp')
285
+ - `hitDamage`: Base damage at 100%
286
+ - `applyDirectDamage`: Skip calculations
287
+ - `attackProperties`: Owner atk property names
288
+ - `defenseProperties`: Target def property names
289
+ - `aimProperties`: Owner aim property names
290
+ - `dodgeProperties`: Target dodge property names
291
+ - `dodgeFullEnabled`: Enable full dodge
292
+ - `dodgeOverAimSuccess`: Dodge threshold multiplier
293
+ - `damageAffected`: Apply dodge/aim to damage
294
+ - `criticalAffected`: Apply dodge/aim to critical
295
+ - `allowEffectBelowZero`: Allow negative values
296
+
297
+ ### LevelsSet Class
298
+
299
+ **Constructor Properties**:
300
+ - `owner` (required): Entity with `getPosition()` method
301
+ - `events`: EventsManager instance
302
+
303
+ **Init Properties**:
304
+ - `levels` (required): Object of Level instances
305
+ - `currentLevel`: Starting level
306
+ - `currentExp`: Starting XP
307
+ - `autoFillRanges`: Auto-generate intermediate levels
308
+ - `autoFillExperienceMultiplier`: XP multiplier for auto-gen (default: 1.5)
309
+ - `increaseLevelsWithExperience`: Auto level up when XP threshold met
310
+ - `levelsByExperience`: Custom level order array
311
+ - `setRequiredExperienceLimit`: Cap XP at max level
312
+
313
+ **Methods**:
314
+ - `init(props)`: Initialize level set
315
+ - `levelUp()`: Increase level, apply modifiers
316
+ - `levelDown()`: Decrease level, revert modifiers
317
+ - `addExperience(number)`: Add XP, auto-level if enabled
318
+ - `getNextLevelExperience()`: Get XP for next level
319
+ - `getLevelInstance(levelKey)`: Get Level by key
320
+
321
+ ### ClassPath Class
322
+
323
+ Extends LevelsSet with additional properties:
324
+ - `key` (required): Class identifier
325
+ - `label`: Display name
326
+ - `labelsByLevel`: {levelKey: 'label'} object
327
+ - `currentLabel`: Active label
328
+ - `skillsByLevel`: {levelKey: [Skill instances]} object
329
+ - `currentSkills`: Active skills object
330
+ - `affectedProperty`: Property for class skills
331
+
332
+ **Methods**:
333
+ - `addSkills(skills)`: Add skills to current set
334
+ - `removeSkills(skills)`: Remove skills by keys
335
+ - `setOwnerSkills(skills)`: Initialize skills based on level
336
+
337
+ ---
338
+
339
+ ## Documentation
340
+
341
+ [https://www.reldens.com/documentation/skills](https://www.reldens.com/documentation/skills)
342
+
343
+ ---
344
+
345
+ ## License
346
+
347
+ MIT
348
+
349
+ ---
350
+
351
+ ### [Reldens](https://github.com/damian-pastorini/reldens/ "Reldens")
352
+
353
+ ##### [By DwDeveloper](https://www.dwdeveloper.com/ "DwDeveloper")