Use when adding hero trait mod implementations in hero-trait-mods.ts - guides reading trait descriptions, creating mod factories, adding stackables/config, and wiring up the calculation engine (project)
Use when adding hero trait mod implementations in hero-trait-mods.ts - guides reading trait descriptions, creating mod factories, adding stackables/config, and wiring up the calculation engine (project)
Adding Hero Trait Mods
Overview
Hero traits are implemented as mod factories in src/tli/hero/hero-trait-mods.ts. Each factory takes a level index (0-4) and returns an array of Mod objects. The trait's description in src/data/hero-trait/hero-traits.ts is the source of truth for what mods and values to produce.
When to Use
Implementing a hero trait that isn't yet in heroTraitModFactories
Adding calculation support for a hero trait's mechanics
Step 0: Read the Trait Description
Always start here. Look up the trait in src/data/hero-trait/hero-traits.ts and read its affix field. This determines:
What mods to create and their types
The per-level values (formatted as (v1/v2/v3/v4/v5) for levels 1-5)
Whether it's a player buff or enemy debuff ("damage taken by the enemy" = isEnemyDebuff: true)
Whether it stacks and the max stack count
Any conditions for activation
Project File Locations
Purpose
File Path
Trait descriptions (source of truth)
src/data/hero-trait/hero-traits.ts
Trait mod factories
src/tli/hero/hero-trait-mods.ts
Mod type definitions
src/tli/mod.ts
Stackable types
src/tli/mod.ts (Stackables)
Condition types
src/tli/mod.ts (Conditions)
Configuration interface & defaults
src/tli/core.ts
Configuration schema
src/lib/schemas/config.schema.ts
Configuration UI
src/components/configuration/ConfigurationTab.tsx
Calculation engine
src/tli/calcs/offense.ts
Implementation Checklist
1. Add Mod Factory (src/tli/hero/hero-trait-mods.ts)
Add an entry to heroTraitModFactories. The key must match the trait's name field in hero-traits.ts exactly (it's typed as HeroTraitName).