Spaces:
Runtime error
Runtime error
add approx talent stat
Browse filesadd approx talent stat (very crude)
app.py
CHANGED
|
@@ -72,8 +72,8 @@ def display_image(url, scale=0.5, enable_flag = False):
|
|
| 72 |
# st.image(image.resize(( int(image.width * scale), int(image.height * scale))))
|
| 73 |
|
| 74 |
|
| 75 |
-
#
|
| 76 |
-
#
|
| 77 |
st.image(url)
|
| 78 |
|
| 79 |
def display_heroes_from_df(df,display_cols=display_cols, show_df=True):
|
|
@@ -394,5 +394,26 @@ else:
|
|
| 394 |
lb_list = ['None', 'LB1', 'LB2']
|
| 395 |
lb_choice = st.selectbox(label='Limit Break:', options=lb_list, index=0)
|
| 396 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 397 |
df_ret = return_hero_stat(df_extra, name_choice, lb_choice=lb_choice, costume_choice=costume_choice)
|
| 398 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
# st.image(image.resize(( int(image.width * scale), int(image.height * scale))))
|
| 73 |
|
| 74 |
|
| 75 |
+
#The problem occur because imgur remove file extension e.g. 'jpg',
|
| 76 |
+
#so either url is wrong with urlopen or Image.open does not know image type if use requests/urllib3
|
| 77 |
st.image(url)
|
| 78 |
|
| 79 |
def display_heroes_from_df(df,display_cols=display_cols, show_df=True):
|
|
|
|
| 394 |
lb_list = ['None', 'LB1', 'LB2']
|
| 395 |
lb_choice = st.selectbox(label='Limit Break:', options=lb_list, index=0)
|
| 396 |
|
| 397 |
+
talent_list = ['None', 'Sword', 'Shield', 'Health']
|
| 398 |
+
# talent_choice = st.radio(
|
| 399 |
+
# "Approx. Talent",
|
| 400 |
+
# talent_list,
|
| 401 |
+
# captions = ["Default", "Talents stat are all cruded approximated. Visit heroplan.io for exact calculation."]
|
| 402 |
+
# )
|
| 403 |
+
talent_choice = st.selectbox(label='Approx. Talent (stat are all cruded approximated. Visit heroplan.io for exact calculation.) :', options=talent_list, index=0)
|
| 404 |
+
talent_tp, talent_attack, talent_defense, talent_health = 0, 0, 0, 0
|
| 405 |
+
if talent_choice == 'Sword':
|
| 406 |
+
talent_tp, talent_attack, talent_defense, talent_health = 100, 150, 50, 100
|
| 407 |
+
elif talent_choice == 'Shield':
|
| 408 |
+
talent_tp, talent_attack, talent_defense, talent_health = 100, 50, 150, 100
|
| 409 |
+
elif talent_choice == 'Health':
|
| 410 |
+
talent_tp, talent_attack, talent_defense, talent_health = 100, 75, 75, 200
|
| 411 |
+
|
| 412 |
+
|
| 413 |
df_ret = return_hero_stat(df_extra, name_choice, lb_choice=lb_choice, costume_choice=costume_choice)
|
| 414 |
+
df_ret.power.values[0] += talent_tp
|
| 415 |
+
df_ret.attack.values[0] += talent_attack
|
| 416 |
+
df_ret.defense.values[0] += talent_defense
|
| 417 |
+
df_ret.health.values[0] += talent_health
|
| 418 |
+
|
| 419 |
+
display_heroes_from_df(df_ret,display_cols=df_ret.columns[:-2]) # display all except special-skill text
|