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:
155
api/app/data/affixes/suffixes.yaml
Normal file
155
api/app/data/affixes/suffixes.yaml
Normal file
@@ -0,0 +1,155 @@
|
||||
# Item Suffix Affixes
|
||||
# Suffixes appear after the item name: "Dagger of Strength"
|
||||
#
|
||||
# Suffix naming convention:
|
||||
# - Minor tier: "of [Stat]" (e.g., "of Strength")
|
||||
# - Major tier: "of the [Animal/Element]" (e.g., "of the Bear")
|
||||
# - Legendary tier: "of the [Mythical]" (e.g., "of the Titan")
|
||||
|
||||
suffixes:
|
||||
# ==================== STAT SUFFIXES (MINOR) ====================
|
||||
of_strength:
|
||||
affix_id: "of_strength"
|
||||
name: "of Strength"
|
||||
affix_type: "suffix"
|
||||
tier: "minor"
|
||||
description: "Grants physical power"
|
||||
stat_bonuses:
|
||||
strength: 2
|
||||
|
||||
of_dexterity:
|
||||
affix_id: "of_dexterity"
|
||||
name: "of Dexterity"
|
||||
affix_type: "suffix"
|
||||
tier: "minor"
|
||||
description: "Grants agility and precision"
|
||||
stat_bonuses:
|
||||
dexterity: 2
|
||||
|
||||
of_constitution:
|
||||
affix_id: "of_constitution"
|
||||
name: "of Fortitude"
|
||||
affix_type: "suffix"
|
||||
tier: "minor"
|
||||
description: "Grants endurance"
|
||||
stat_bonuses:
|
||||
constitution: 2
|
||||
|
||||
of_intelligence:
|
||||
affix_id: "of_intelligence"
|
||||
name: "of Intelligence"
|
||||
affix_type: "suffix"
|
||||
tier: "minor"
|
||||
description: "Grants magical aptitude"
|
||||
stat_bonuses:
|
||||
intelligence: 2
|
||||
|
||||
of_wisdom:
|
||||
affix_id: "of_wisdom"
|
||||
name: "of Wisdom"
|
||||
affix_type: "suffix"
|
||||
tier: "minor"
|
||||
description: "Grants insight and perception"
|
||||
stat_bonuses:
|
||||
wisdom: 2
|
||||
|
||||
of_charisma:
|
||||
affix_id: "of_charisma"
|
||||
name: "of Charm"
|
||||
affix_type: "suffix"
|
||||
tier: "minor"
|
||||
description: "Grants social influence"
|
||||
stat_bonuses:
|
||||
charisma: 2
|
||||
|
||||
of_luck:
|
||||
affix_id: "of_luck"
|
||||
name: "of Fortune"
|
||||
affix_type: "suffix"
|
||||
tier: "minor"
|
||||
description: "Grants favor from fate"
|
||||
stat_bonuses:
|
||||
luck: 2
|
||||
|
||||
# ==================== ENHANCED STAT SUFFIXES (MAJOR) ====================
|
||||
of_the_bear:
|
||||
affix_id: "of_the_bear"
|
||||
name: "of the Bear"
|
||||
affix_type: "suffix"
|
||||
tier: "major"
|
||||
description: "Grants the might and endurance of a bear"
|
||||
stat_bonuses:
|
||||
strength: 4
|
||||
constitution: 2
|
||||
|
||||
of_the_fox:
|
||||
affix_id: "of_the_fox"
|
||||
name: "of the Fox"
|
||||
affix_type: "suffix"
|
||||
tier: "major"
|
||||
description: "Grants the cunning and agility of a fox"
|
||||
stat_bonuses:
|
||||
dexterity: 4
|
||||
luck: 2
|
||||
|
||||
of_the_owl:
|
||||
affix_id: "of_the_owl"
|
||||
name: "of the Owl"
|
||||
affix_type: "suffix"
|
||||
tier: "major"
|
||||
description: "Grants the wisdom and insight of an owl"
|
||||
stat_bonuses:
|
||||
intelligence: 3
|
||||
wisdom: 3
|
||||
|
||||
# ==================== DEFENSIVE SUFFIXES ====================
|
||||
of_protection:
|
||||
affix_id: "of_protection"
|
||||
name: "of Protection"
|
||||
affix_type: "suffix"
|
||||
tier: "minor"
|
||||
description: "Offers physical protection"
|
||||
defense_bonus: 3
|
||||
|
||||
of_warding:
|
||||
affix_id: "of_warding"
|
||||
name: "of Warding"
|
||||
affix_type: "suffix"
|
||||
tier: "major"
|
||||
description: "Wards against physical and magical harm"
|
||||
defense_bonus: 5
|
||||
resistance_bonus: 3
|
||||
|
||||
# ==================== LEGENDARY SUFFIXES ====================
|
||||
of_the_titan:
|
||||
affix_id: "of_the_titan"
|
||||
name: "of the Titan"
|
||||
affix_type: "suffix"
|
||||
tier: "legendary"
|
||||
description: "Grants titanic strength and endurance"
|
||||
stat_bonuses:
|
||||
strength: 8
|
||||
constitution: 4
|
||||
required_rarity: "legendary"
|
||||
|
||||
of_the_wind:
|
||||
affix_id: "of_the_wind"
|
||||
name: "of the Wind"
|
||||
affix_type: "suffix"
|
||||
tier: "legendary"
|
||||
description: "Swift as the wind itself"
|
||||
stat_bonuses:
|
||||
dexterity: 8
|
||||
luck: 4
|
||||
crit_chance_bonus: 0.05
|
||||
required_rarity: "legendary"
|
||||
|
||||
of_invincibility:
|
||||
affix_id: "of_invincibility"
|
||||
name: "of Invincibility"
|
||||
affix_type: "suffix"
|
||||
tier: "legendary"
|
||||
description: "Grants supreme protection"
|
||||
defense_bonus: 10
|
||||
resistance_bonus: 8
|
||||
required_rarity: "legendary"
|
||||
Reference in New Issue
Block a user