# skill-system
> Implements skill mechanics, balancing, and player ability handling for L2J Interlude.
Use when: creating new skills, modifying skill effects, implementing balance changes, debugging skill execution, or adding skill handlers
- Author: valeriybaranyshyn-pixel
- Repository: valeriybaranyshyn-pixel/Tales-of-Aden
- Version: 20260202145225
- Stars: 0
- Forks: 0
- Last Updated: 2026-02-06
- Source: https://github.com/valeriybaranyshyn-pixel/Tales-of-Aden
- Web: https://mule.run/skillshub/@@valeriybaranyshyn-pixel/Tales-of-Aden~skill-system:20260202145225
---
---
name: skill-system
description: |
Implements skill mechanics, balancing, and player ability handling for L2J Interlude.
Use when: creating new skills, modifying skill effects, implementing balance changes, debugging skill execution, or adding skill handlers
allowed-tools: Read, Edit, Write, Glob, Grep, Bash
---
# Skill System
The L2J skill system uses a layered architecture: XML definitions → SkillTable registry → ISkillHandler execution → Effect application. Skills are parsed at startup, cached in memory with a composite key (`skillId * 256 + level`), and executed through type-based handler dispatch.
## Quick Start
### Define a Physical Damage Skill (XML)
```xml
25 27 30 39 42 46 60 65 70
10 10 11 13 13 14 17 18 19
```
### Create a Skill Handler
```java
// Files/java/net/sf/l2j/gameserver/handler/skillhandlers/MyHandler.java
public class MyHandler implements ISkillHandler {
private static final L2SkillType[] SKILL_IDS = { L2SkillType.MY_TYPE };
@Override
public void useSkill(Creature activeChar, L2Skill skill, L2Object[] targets) {
if (activeChar.isAlikeDead()) return;
for (L2Object obj : targets) {
if (!(obj instanceof Creature)) continue;
Creature target = (Creature) obj;
int damage = (int) Formulas.calcPhysDam(activeChar, target, skill, shld, crit, ss);
target.reduceCurrentHp(damage, activeChar, skill);
}
}
@Override
public L2SkillType[] getSkillIds() { return SKILL_IDS; }
}
```
### Balance a Skill (No Code Changes)
```xml
```
## Key Concepts
| Concept | Location | Purpose |
|---------|----------|---------|
| L2SkillType | `templates/skills/L2SkillType.java` | Enum mapping skill types to handlers |
| SkillTable | `datatables/SkillTable.java` | Singleton registry, loads XML at startup |
| ISkillHandler | `handler/ISkillHandler.java` | Strategy interface for skill execution |
| EffectTemplate | `skills/effects/EffectTemplate.java` | Reflection-based effect factory |
| Formulas | `skills/Formulas.java` | Damage, hit chance, critical calculations |
| SkillBalanceHolder | `balance/skills/SkillBalanceHolder.java` | Runtime balance modifiers |
## Common Patterns
### Add Buff Effect with Stat Modifier
```xml
```
### Apply Balance Multiplier in Handler
```java
// In skill execution code
double damage = baseDamage;
double powerMul = SkillBalanceHolder.getStat(skill.getId(), "powerMul", 1.0);
damage *= powerMul;
```
## See Also
- [patterns](references/patterns.md) - Handler patterns, effect creation, conditions
- [workflows](references/workflows.md) - Adding skills, balancing, debugging
## Related Skills
- **java** skill for Java coding conventions and singleton patterns
- **xml-data** skill for XML parsing and data file structure
- **ai-system** skill for how NPCs/summons cast skills via AI intentions
- **pvp-events** skill for event-specific skill restrictions
- **database-schema** skill for skill-related database tables