@seamuswalden3/

King's Funeral

Python

A little game where a king dies and 1000 knights are invited to his funeral. You have to survive to be the one to claim his fortune.

fork
loading
Files
  • main.py
main.py
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import random

#A game about how the king dies
#and in his will he sets it out that
#the final person alive in his funeral
#would get all of his money
#You have to make decisions to try
#to survive

#The board is a 3x3 board and
#there is an option sometimes
#to fight people where this
#game turns more like into
#a RPG


#If anyone looks through my history
#and see's that there is a weird
#copy and paste of a bunch of things
#just know its because 2 reasons:
#1. The Repl.it console is running
#very slow for me right now
#2. I have progarmmed using the
#python IDLE for most of my time
#programming and its a bit weird
#to program on a website

class Player():
    def __init__(self):
        self.name = input("Oh my, I have forgetten your name\nWould you please tell me it?")
        self.health = 100

def Options(state, command, player, PeopleLeft):
    msg = ""
    choices = []
    if state == 1:
        if command == "1":
            msg = ("Dear Sir "  + player.name + ",\nIn the past couple of days there has been some unfortanate events.\n"
                   "The past king has fallen ill and has died to the black plague.\nTo remember and cherish our memories of him we "
                   "please ask that you partake in this event that is happening today in a few hours\nSincerely,\n    The Dead King\n"
                   "Do you wish to go to the funeral?\n1: Yes\n2: No")
            choices = ["1","2"]
            state = 2
        if command == "2":
            msg = ("You decide to put away the letter\n The person who gave you it says to you this\n'Either open the letter or I will force you'\n1: Open the letter"
                   "\n2: Don't open it")
            choices = ["1","2"]
            state = 3
    elif state == 2:
        if command == "1":
            msg = ("You feel time pass by weirdly as you are going to the funeral\nOnce you are seated down you see the person who gave you the letter"
                   "\nHe starts by saying how he's so sad that the king passed away\nFor most of the letter your spaced out as it isn't as important\n"
                   "He then says at the end something that startles you\n'Now is the time, Last to be alive gets the fortune'\n"
                   "1: Stand there in shock\n2: Grab a chair and smack someone with it\n3: Curl up on the floor and try to dodge all the chaos")
            choices = ["1","2","3"]
            state = 4
        if command == "2":
            print("You feel all the bones in your body shake as the person says this\n'Resist leads nowhere. You will now die.'")
            state = "dead"
            choices = ["1","2"]
    elif state == 3:
        if command == "1":
            msg = ("Dear Sir "  + player.name + ",\nIn the past couple of days there has been some unfortanate events.\n"
                   "The past king has fallen ill and has died to the black plague.\nTo remember and cherish our memories of him we "
                   "please ask that you partake in this event that is happening tomorrow at 6 AM\nSincerely,\n    The Dead King\n"
                   "Do you wish to go to the funeral?\n1: Yes\n2: No")
            choices = ["1","2"]
            state = 2
        if command == "2":
            msg = ("You feel weird and your vision is fading\n When you lost your whole vision you feel yourself moving"
                   "A few minutes later you regain your sight\nYou were taken to the kings funeral\nOnce you are seated down you see the person who gave you the letter"
                   "\nHe starts by saying how he's so sad that the king passed away\nFor most of the letter your spaced out as it isn't as important\n"
                   "He then says at the end something that startles you\n'Now is the time, Last to be alive gets the fortune'\n"
                   "1: Stand there in shock\n2: Grab a chair and smack someone with it\n3: Curl up on the floor and try to dodge all the chaos")
            choices = ["1","2","3"]
            state = 4
    elif state == 4:
        if command == "1":
            msg = ("You stand there as everyone just starts going beserk\nThere are chairs flying everywhere and bodies being flung\n")
            if random.randint(1,5) >= 4:
                dmg = random.randint(5,20)
                msg += "Out of nowhere a chair hits you on the side of your head hurting you, but you don't die\n"
                player.health -= dmg
                msg += "1: still just stand there\n2: Turn to face the guy who punched you and punch him\n3: Grab a chair and smack someone with it"
            else:
                msg += "Somehow amazingly you aren't hit at all by any of this\n"
                msg += "1: still just stand there\n2: Turn to face the guy who tried to punch you and punch him\n3: Grab a chair and smack someone with it"
            PeopleLeft -= random.randint(int(PeopleLeft/20)+1,(int(PeopleLeft/10)+1))
            state = 5
            choices = ["1","2","3"]
            
        if command == "2":
            msg = ("You pickup your chair and you attempt to smash it into someone elses faces\n")
            RanNum = random.randint(1,100)
            if RanNum == 1:
                msg += ("In an amazing action you manage to completely take out 10 men in one swoop\n1: Try to hurt another person"
                        "\n2: Run to another room")
                PeopleLeft -= 10
                state = 6
            elif RanNum <= 5:
                msg += ("Somehow you find the strength to wail around the chair and instantly smash through the guys head\n1: Try to hurt another person"
                        "\n2: Run to another room")
                PeopleLeft -= 1
                state = 6
            elif RanNum <= 35:
                msg += ("You swing at him and you make contact, but it seems like it didn't hurt him that much\n")
                RanNum2 = random.randint(1,5)
                if RanNum2 >= 4:
                    msg += ("The guy swings right back and hits you in the face")
                    player.health -= random.randint(3,7)
                    
                else:
                    msg += ("The guy tries to swing back at you, but misses")
                msg += ("\n1: Try to swing at the guy again\n2: Run away")
                state = 7
            else:
                msg += ("You completly fail to hit your target and the momentum of the chair spins you around\n1: Chuck the chair\n2: Spin around and smack the guy again")
                state = 8
            choices = ["1","2"]
    else:
        print("I'm Sorry, but I haven't gotten this far into making the game yet\nTry again later when there is more added")
        state = "dead"
        choices = []
        
            
            
    return state, msg, choices, PeopleLeft


def game_loop():
    #Defining a bunch of variables
    game_run = True
    player = Player()
    board = [[0] * 3 for _ in range(3)]
    Pos = [0,0]
    state = 1
    PeopleLeft = 1000
    msg = "Oh yes, I remember you\nHeres a letter that I was meant to give you\n1: Open it\n2: Leave it be"
    choices = ["1","2"]

    while game_run:
        command = ""
        while choices.count(command) == 0:
            command = str(input(msg))
            print("\n")
        state, msg, choices, PeopleLeft = Options(state, command, player, PeopleLeft)
        if state == "dead" or player.health <= 0:
            game_run = False
            if player.health <= 0:
                print("Your wounds are too much and you ended up dying")
        if PeopleLeft <= 0:
            print("Somehow, despite all the odds you managed to survive and you get the kings fortune!")

game_loop()