File size: 2,634 Bytes
3c096f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
62
63
64
65
66
67
68
69
70
import streamlit as st
import random
import pandas as pd

# Initialize session state for game variables and characters
if 'current_step' not in st.session_state:
    st.session_state.current_step = 0
if 'player_strength' not in st.session_state:
    st.session_state.player_strength = 10
if 'swordsmen_recruited' not in st.session_state:
    st.session_state.swordsmen_recruited = []

# Characters data
characters = [
    {"name": "Alden", "strength": 7, "wisdom": 5, "loyalty": 8},
    {"name": "Briar", "strength": 6, "wisdom": 9, "loyalty": 7},
    {"name": "Cade", "strength": 8, "wisdom": 4, "loyalty": 6},
    {"name": "Dara", "strength": 5, "wisdom": 8, "loyalty": 9},
    {"name": "Evan", "strength": 9, "wisdom": 3, "loyalty": 5},
]

# Function to roll dice
def roll_dice():
    emoji_dice = ["βš€", "⚁", "βš‚", "βšƒ", "βš„", "βš…"]
    roll = random.randint(1, 6)
    st.markdown(f"Dice roll: {emoji_dice[roll-1]} ({roll})")
    return roll

# Function to progress in the story
def next_step():
    st.session_state.current_step += 1

# Function to recruit a swordsman
def recruit_swordsman(swordsman):
    if swordsman not in st.session_state.swordsmen_recruited:
        st.session_state.swordsmen_recruited.append(swordsman)
        st.success(f"{swordsman['name']} has been recruited!")
    else:
        st.info(f"{swordsman['name']} is already part of your team.")

# Title and story progression
st.title("The Six Swordsman")

if st.session_state.current_step == 0:
    st.markdown("## Introduction")
    st.markdown("You are the last of the legendary Six Swordsmen. πŸ—‘οΈ Seek out your brethren to reform the brotherhood.")
    if st.button("Begin your quest"):
        next_step()

elif st.session_state.current_step == 1:
    st.markdown("## Quest")
    st.markdown("Choose a swordsman to investigate and potentially recruit.")

    for character in characters:
        if st.button(f"Recruit {character['name']}"):
            recruit_swordsman(character)
            st.session_state.player_strength += roll_dice()  # Gain strength
            next_step()

# Display recruited swordsmen and player stats
st.sidebar.markdown("### πŸ›‘οΈ Player Stats")
st.sidebar.markdown(f"- Strength: {st.session_state.player_strength}")
st.sidebar.markdown(f"- Swordsmen Recruited: {len(st.session_state.swordsmen_recruited)}/5")

# Display character stats in an expander
with st.expander("View Characters Stats"):
    df = pd.DataFrame(characters)
    st.dataframe(df)

# Future steps can include more complex decision trees, battles with dice rolls, and dynamic story elements based on player choices and character stats.