Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import random
|
2 |
|
3 |
class DNDCharacter:
|
@@ -30,31 +31,41 @@ class DNDCharacter:
|
|
30 |
self.stats[stat] = random.randint(1, 20)
|
31 |
|
32 |
def show_stats(self):
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
|
40 |
def show_character_sheet(self):
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
self.show_stats()
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
|
57 |
-
#
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
import random
|
3 |
|
4 |
class DNDCharacter:
|
|
|
31 |
self.stats[stat] = random.randint(1, 20)
|
32 |
|
33 |
def show_stats(self):
|
34 |
+
st.write("Strength: ", self.stats["Strength"])
|
35 |
+
st.write("Dexterity: ", self.stats["Dexterity"])
|
36 |
+
st.write("Wisdom: ", self.stats["Wisdom"])
|
37 |
+
st.write("Charisma: ", self.stats["Charisma"])
|
38 |
+
st.write("Constitution: ", self.stats["Constitution"])
|
39 |
+
st.write("Intelligence: ", self.stats["Intelligence"])
|
40 |
|
41 |
def show_character_sheet(self):
|
42 |
+
st.write("Name: ", self.name)
|
43 |
+
st.write("Class: ", self.char_class)
|
44 |
+
st.write("Level: ", self.level)
|
45 |
+
st.write("Race: ", self.race)
|
46 |
+
st.write("Background: ", self.background)
|
47 |
+
st.write("Alignment: ", self.alignment)
|
48 |
self.show_stats()
|
49 |
+
st.write("Hit Points: ", self.hit_points)
|
50 |
+
st.write("Armor Class: ", self.armor_class)
|
51 |
+
st.write("Initiative: ", self.initiative)
|
52 |
+
st.write("Speed: ", self.speed)
|
53 |
+
st.write("Proficiencies: ", self.proficiencies)
|
54 |
+
st.write("Equipment: ", self.equipment)
|
55 |
+
st.write("Features and Traits: ", self.features_and_traits)
|
56 |
+
st.write("Spells: ", self.spells)
|
57 |
|
58 |
+
# Streamlit app
|
59 |
+
st.title("D&D Character Sheet")
|
60 |
+
|
61 |
+
name = st.text_input("Name")
|
62 |
+
char_class = st.text_input("Class")
|
63 |
+
level = st.number_input("Level", min_value=1, max_value=20, value=1)
|
64 |
+
race = st.text_input("Race")
|
65 |
+
background = st.text_input("Background")
|
66 |
+
alignment = st.text_input("Alignment")
|
67 |
+
|
68 |
+
if st.button("Roll Stats"):
|
69 |
+
character = DNDCharacter(name, char_class, level, race, background, alignment)
|
70 |
+
character.roll_stats()
|
71 |
+
character.show_character_sheet()
|