dnd5-scripts/generate_npc/skills.py
2026-06-17 22:32:48 +03:00

55 lines
2.4 KiB
Python

# skills.py
import random
acrobatics = "Acrobatics"
animal_handling= "Animal Handling"
arcana = "Arcana"
athletics = "Athletics"
deception = "Deception"
history = "History"
insight = "Insight"
intimidation = "Intimidation"
investigation = "Investigation"
medicine = "Medicine"
nature = "Nature"
perception = "Perception"
performance = "Performance"
persuasion = "Persuasion"
religion = "Religion"
sleight_of_hand= "Sleight of Hand"
stealth = "Stealth"
survival = "Survival"
all_skills = [
acrobatics, animal_handling, arcana, athletics, deception,
history, insight, intimidation, investigation, medicine,
nature, perception, performance, persuasion, religion,
sleight_of_hand, stealth, survival,
]
CHARACTER_CLASS_SKILLS: dict[str, tuple[list[str], int]] = {
"bard": (all_skills, 3),
"barbarian": ([athletics, perception, survival, intimidation, nature, animal_handling], 2),
"fighter": ([acrobatics, athletics, perception, survival, intimidation, history, insight, animal_handling], 2),
"wizard": ([history, arcana, medicine, insight, investigation, religion], 2),
"druid": ([perception, survival, arcana, medicine, animal_handling, nature, insight, religion], 2),
"cleric": ([history, medicine, insight, religion, persuasion], 2),
"warlock": ([intimidation, history, arcana, deception, nature, investigation, religion], 2),
"monk": ([acrobatics, athletics, history, insight, religion, stealth], 2),
"paladin": ([athletics, intimidation, medicine, insight, religion, persuasion], 2),
"rogue": ([acrobatics, athletics, perception, performance, intimidation, sleight_of_hand,
deception, insight, investigation, stealth, persuasion], 4),
"ranger": ([athletics, perception, survival, nature, insight, investigation, stealth, animal_handling], 3),
"sorcerer": ([intimidation, arcana, deception, insight, religion, persuasion], 2),
"commoner": ([animal_handling, athletics, persuasion, insight, survival], 1),
}
def get_random_skills(skills_list: list[str], count: int) -> list[str]:
"""Возвращает `count` случайных навыков без повторений."""
available = list(skills_list)
selected = []
for _ in range(min(count, len(available))):
idx = random.randrange(len(available))
selected.append(available.pop(idx))
return selected