26-rarity-vs-weight #46

Merged
waifu merged 8 commits from 26-rarity-vs-weighing into dev 2025-06-06 22:12:13 -07:00
Showing only changes of commit 4c2b3f589f - Show all commits

View file

@ -26,14 +26,14 @@ def get_random_character() -> Character | None:
if not characters:
return None
weights = [c['weight'] for c in characters]
weights = [config.RARITY_TO_WEIGHT[c['rarity']] for c in characters]
chosen = choices(characters, weights=weights, k=1)[0]
return {
'id': chosen['id'],
'name': chosen['name'],
'rarity': chosen['rarity'],
'weight': chosen['weight'],
'weight': config.RARITY_TO_WEIGHT[chosen['rarity']],
'image_url': chosen['file_id']
}