import uuid from typing import Dict, List, Any, Tuple from app.game.utils.common import Dice from app.game.models.entities import Entity from app.game.loaders.races_loader import RaceRepository from app.game.loaders.profession_loader import ProfessionRepository from app.game.generators.level_progression import DEFAULT_LEVEL_PROGRESSION from app.game.systems.leveling import set_level dice = Dice() # tuning knobs level_growth = 1.25 def build_char(name:str, origin_story:str, race_id:str, profession_id:str, fame:int=0, level:int=1) -> Entity: races = RaceRepository() professions = ProfessionRepository() progression = DEFAULT_LEVEL_PROGRESSION race = races.get(race_id) profession = professions.get(profession_id) e = Entity( uuid = str(uuid.uuid4()), name = name, origin_story = origin_story, fame = fame, race =race, profession = profession ) # apply race ability scores for stat, delta in vars(race.ability_scores).items(): # Get current score (default to 10 if missing) current = getattr(e.ability_scores, stat, 10) # Apply modifier new_value = current + int(delta) # Update the stat setattr(e.ability_scores, stat, new_value) set_level(e,level,progression) return e