File size: 2,065 Bytes
203dc14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import random

class DNDCharacter:
    def __init__(self, name, char_class, level, race, background, alignment):
        self.name = name
        self.char_class = char_class
        self.level = level
        self.race = race
        self.background = background
        self.alignment = alignment
        self.stats = {
            "Strength": 0,
            "Dexterity": 0,
            "Wisdom": 0,
            "Charisma": 0,
            "Constitution": 0,
            "Intelligence": 0
        }
        self.hit_points = 0
        self.armor_class = 0
        self.initiative = 0
        self.speed = 0
        self.proficiencies = []
        self.equipment = []
        self.features_and_traits = []
        self.spells = []
        
    def roll_stats(self):
        for stat in self.stats:
            self.stats[stat] = random.randint(1, 20)
            
    def show_stats(self):
        print("Strength: ", self.stats["Strength"])
        print("Dexterity: ", self.stats["Dexterity"])
        print("Wisdom: ", self.stats["Wisdom"])
        print("Charisma: ", self.stats["Charisma"])
        print("Constitution: ", self.stats["Constitution"])
        print("Intelligence: ", self.stats["Intelligence"])
        
    def show_character_sheet(self):
        print("Name: ", self.name)
        print("Class: ", self.char_class)
        print("Level: ", self.level)
        print("Race: ", self.race)
        print("Background: ", self.background)
        print("Alignment: ", self.alignment)
        self.show_stats()
        print("Hit Points: ", self.hit_points)
        print("Armor Class: ", self.armor_class)
        print("Initiative: ", self.initiative)
        print("Speed: ", self.speed)
        print("Proficiencies: ", self.proficiencies)
        print("Equipment: ", self.equipment)
        print("Features and Traits: ", self.features_and_traits)
        print("Spells: ", self.spells)

# Example usage
character = DNDCharacter("John", "Fighter", 1, "Human", "Soldier", "Lawful Good")
character.roll_stats()
character.show_character_sheet()