Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -34,18 +34,6 @@ MONSTERS = {
|
|
34 |
"Gorgon": {"Picture": "πποΈβπ¨οΈ", "Description": "A creature with the body of a lion and the head of a snake, whose gaze can turn people to stone.", "Attack": 6, "Defense": 4},
|
35 |
}
|
36 |
|
37 |
-
def get_random_monster_old():
|
38 |
-
monster_name = st.session_state.selected_monster
|
39 |
-
if monster_name:
|
40 |
-
monster = MONSTERS[monster_name]
|
41 |
-
st.write("Picture: ", monster["Picture"])
|
42 |
-
st.write("Description: ", monster["Description"])
|
43 |
-
st.write("Attack: ", monster["Attack"])
|
44 |
-
st.write("Defense: ", monster["Defense"])
|
45 |
-
return monster
|
46 |
-
else:
|
47 |
-
return None
|
48 |
-
|
49 |
def shuffle_monsters():
|
50 |
global MONSTERS
|
51 |
keys = list(MONSTERS.keys())
|
@@ -75,27 +63,10 @@ def save_data():
|
|
75 |
data.to_csv(filename)
|
76 |
st.write(f"Player data saved to {filename}")
|
77 |
|
78 |
-
def display_player_card(player_name, player_data):
|
79 |
-
st.write(f"**{player_name}**")
|
80 |
-
for key, value in player_data.items():
|
81 |
-
st.write(f"{key}: {value}")
|
82 |
-
|
83 |
-
def battle_player_card_old():
|
84 |
-
selected_player = st.session_state.selected_player
|
85 |
-
selected_monster = st.session_state.selected_monster
|
86 |
-
if not selected_player:
|
87 |
-
st.warning("Please select a player card.")
|
88 |
-
return
|
89 |
-
if not selected_monster:
|
90 |
-
st.warning("Please select a monster.")
|
91 |
-
return
|
92 |
-
player_data = PLAYERS[selected_player]
|
93 |
-
monster_data = MONSTERS[selected_monster]
|
94 |
-
if player_data["Attack"] > monster_data["Defense"]:
|
95 |
-
st.success("You defeated the monster!")
|
96 |
-
else:
|
97 |
-
st.error("The monster defeated you.")
|
98 |
-
save_data()
|
99 |
|
100 |
def battle_player_card():
|
101 |
selected_player = st.session_state.selected_player
|
@@ -122,21 +93,6 @@ def battle_player_card():
|
|
122 |
st.error("The monster defeated you.")
|
123 |
save_data()
|
124 |
|
125 |
-
def load_and_display_player_data_old():
|
126 |
-
player_data = pd.read_csv("player_data.csv")
|
127 |
-
st.write("## Player Data")
|
128 |
-
st.write(player_data)
|
129 |
-
|
130 |
-
fig = px.treemap(player_data,
|
131 |
-
path=['Player'],
|
132 |
-
values='Health Tokens',
|
133 |
-
color='Attack',
|
134 |
-
color_continuous_scale='Blues',
|
135 |
-
title='Player Attack Power and Health Tokens')
|
136 |
-
fig.update_traces(textinfo='label+value+percent entry',
|
137 |
-
hovertemplate='<b>%{label}</b><br>Attack: %{color}<br>Health: %{value}<br>Percent: %{percentEntry:.2f}%<extra></extra>')
|
138 |
-
fig.update_layout(margin=dict(t=50, b=0, l=0, r=0), height=400)
|
139 |
-
st.plotly_chart(fig)
|
140 |
|
141 |
def load_and_display_player_data():
|
142 |
if os.path.exists("player_data.csv"):
|
@@ -150,6 +106,10 @@ def load_and_display_player_data():
|
|
150 |
def get_history():
|
151 |
return []
|
152 |
|
|
|
|
|
|
|
|
|
153 |
def main():
|
154 |
st.set_page_config(page_title="Player Cards and Monsters")
|
155 |
st.title("Player Cards and Monsters")
|
|
|
34 |
"Gorgon": {"Picture": "πποΈβπ¨οΈ", "Description": "A creature with the body of a lion and the head of a snake, whose gaze can turn people to stone.", "Attack": 6, "Defense": 4},
|
35 |
}
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
def shuffle_monsters():
|
38 |
global MONSTERS
|
39 |
keys = list(MONSTERS.keys())
|
|
|
63 |
data.to_csv(filename)
|
64 |
st.write(f"Player data saved to {filename}")
|
65 |
|
66 |
+
#def display_player_card(player_name, player_data):
|
67 |
+
# st.write(f"**{player_name}**")
|
68 |
+
# for key, value in player_data.items():
|
69 |
+
# st.write(f"{key}: {value}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
def battle_player_card():
|
72 |
selected_player = st.session_state.selected_player
|
|
|
93 |
st.error("The monster defeated you.")
|
94 |
save_data()
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
def load_and_display_player_data():
|
98 |
if os.path.exists("player_data.csv"):
|
|
|
106 |
def get_history():
|
107 |
return []
|
108 |
|
109 |
+
def display_player_card(player_name, player_data):
|
110 |
+
st.write(f"{player_name} {player_data['Sketch']} {player_data['Character']} {player_data['Player Board']} {player_data['Action Dice']} {player_data['Health Tokens']}β€οΈ {player_data['Coin Tokens']} {player_data['Battle Tokens']} {player_data['Class']} Attack: {player_data['Attack']} Defense: {player_data['Defense']}")
|
111 |
+
|
112 |
+
|
113 |
def main():
|
114 |
st.set_page_config(page_title="Player Cards and Monsters")
|
115 |
st.title("Player Cards and Monsters")
|