feat(api): implement Diablo-style item affix system
Add procedural item generation with affix naming system: - Items with RARE/EPIC/LEGENDARY rarity get dynamic names - Prefixes (e.g., "Flaming") add elemental damage, material bonuses - Suffixes (e.g., "of Strength") add stat bonuses - Affix count scales with rarity: RARE=1, EPIC=2, LEGENDARY=3 New files: - models/affixes.py: Affix and BaseItemTemplate dataclasses - services/affix_loader.py: YAML-based affix pool loading - services/base_item_loader.py: Base item template loading - services/item_generator.py: Main procedural generation service - data/affixes/prefixes.yaml: 14 prefix definitions - data/affixes/suffixes.yaml: 15 suffix definitions - data/base_items/weapons.yaml: 12 weapon templates - data/base_items/armor.yaml: 12 armor templates - tests/test_item_generator.py: 34 comprehensive tests Modified: - enums.py: Added AffixType and AffixTier enums - items.py: Added affix tracking fields (applied_affixes, generated_name) Example output: "Frozen Dagger of the Bear" (EPIC with ice damage + STR/CON)
This commit is contained in:
@@ -50,6 +50,21 @@ class ItemRarity(Enum):
|
||||
LEGENDARY = "legendary" # Orange/gold - best items
|
||||
|
||||
|
||||
class AffixType(Enum):
|
||||
"""Types of item affixes for procedural item generation."""
|
||||
|
||||
PREFIX = "prefix" # Appears before item name: "Flaming Dagger"
|
||||
SUFFIX = "suffix" # Appears after item name: "Dagger of Strength"
|
||||
|
||||
|
||||
class AffixTier(Enum):
|
||||
"""Affix power tiers determining bonus magnitudes."""
|
||||
|
||||
MINOR = "minor" # Weaker bonuses, rolls on RARE items
|
||||
MAJOR = "major" # Medium bonuses, rolls on EPIC items
|
||||
LEGENDARY = "legendary" # Strongest bonuses, LEGENDARY only
|
||||
|
||||
|
||||
class StatType(Enum):
|
||||
"""Character attribute types."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user