-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.py
More file actions
266 lines (242 loc) · 6.93 KB
/
game.py
File metadata and controls
266 lines (242 loc) · 6.93 KB
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
import sys
import os
import random
class Player:
def __init__(self, name):
self.name = name
self.maxhealth = 150
self.health = self.maxhealth
self.attack = 20
self.potion = 0
self.gold = 0
class Goblin:
def __init__(self, name):
self.name = name
self.maxhealth = 125
self.health = self.maxhealth
self.attack = 14
self.goldgain = 100
GoblinIG = Goblin("Goblin")
class Zombie:
def __init__(self, name):
self.name = name
self.maxhealth = 75
self.health = self.maxhealth
self.attack = 8
self.goldgain = 10
ZombieIG = Zombie("Zombie")
def name():
os.system('cls')
print("Whats Your Name? ")
option = input('>>> ')
global PlayerIG
PlayerIG = Player(option)
choose()
def choose():
os.system('cls')
print("""
Choose Your Class:
1. Warrior
2. Mage
3. Marksman""")
option = input(">>> ")
if option == '1':
prolog()
elif option == '2':
print("In Development")
choose()
elif option == '3':
print("In Development")
choose()
else:
invalidoption()
choose()
def prolog():
os.system('cls')
print("""
You are an Knight of Weldish being send to Verdant in the northern region of Kingdom of Weldish.
you are aoppointed there due to an order from the Duchy of Verdant because of the ongoing panic and unrest
after the Union of Thaloria attack the region.
1. Next
""")
option = input(">>> ")
if option == '1':
prolog1()
else:
invalidoption()
prolog()
def prolog1():
os.system('cls')
print("""
On the way to Verdant, you and the rest are being briefed on the current situation by your commander
1. Next """)
option = input(">>> ")
if option == '1':
prolog2()
else:
invalidoption()
prolog1()
def prolog2():
os.system('cls')
print("""
Commander: Before we arrive, i should mention that anything couuld happen, so prepare yourself.
anymore question?
1. Ask about Kingdom of Weldish
2. Ask about situation in Verdant
3. Ask about our assingment in Verdant
4. Ask about Union of Thaloria
5. all good """)
option = input(">>> ")
if option == '1':
weldishlore()
elif option == '2':
verdantsituation()
elif option == '3':
assingmentverdant()
elif option == '4':
thalorialore()
elif option == '5':
prolog3()
else:
invalidoption()
prolog2()
def weldishlore():
os.system('cls')
print("""
Kingdom of weldish is the 5th largest kingdom in the known land. The kingdom has been through
15 generation of great Leaders that lead the kingdom to great wealth, prosperity and peace.
Being the richest kingdom in the known land, we has been the main trade
center and education for merchants, wanderers and peoples looking for opportunity.
1. Next """)
option = input(">>> ")
if option == '1':
prolog2()
else:
invalidoption()
prolog2()
def verdantsituation():
os.system('cls')
print("""
During the border class with Union of Thaloria, Verdant suffer massive losses
and unrest across northern verdant territory. we are sent to aid the civilians
and amke negotioations with Union of Thaloria
1. Next """)
option = input(">>> ")
if option == '1':
prolog2()
else:
invalidoption()
prolog2()
def assingmentverdant():
os.system('cls')
print("""
Commander: Our assingment is to restore stability in verdant and investigate of why is
Thaloria attack verdant. the people's there know that we are sent
there to aid and give protections, as nuch as i hate to say it but,
we need to keep secret of our mission as there might spy sent to verdant to
gather inteligences.
1. Next """)
option = input(">>> ")
if option == '1':
prolog2()
else:
invalidoption()
prolog2()
def thalorialore():
os.system('cls')
print("""Will be added next udpate """)
prolog2()
def prolog3():
os.system('cls')
print("""
On the way to verdant, suddenly your group is attack by an goblin,
the suprise attack done by the goblin injured many of your fellow soldiers.
as you get up on your feet. you picked up your sword and begin to attack the goblin
1. Next """)
option = input(">>> ")
if option == '1':
precombat()
else:
invalidoption()
prolog3()
def precombat():
global enemy
enemynum = random.randint(1, 2)
if enemynum == 1:
enemy = GoblinIG
else:
enemy = GoblinIG
combat()
def combat():
os.system('cls')
print("%s Vs %s" % (PlayerIG.name, enemy.name))
print("%s's Health: %s/%s %s Health: %i/%i" % (PlayerIG.name, PlayerIG.health, PlayerIG.maxhealth, enemy.name, enemy.health, enemy.maxhealth ))
print("Potions %i\n" % PlayerIG.potion)
print("1. Attack")
print("2. Drink Potion")
option = input(">>> ")
if option == '1':
attack()
elif option == '2':
drinkpotion()
else:
invalidoption()
combat()
def attack():
os.system('cls')
PlayerAttack = random.randint(PlayerIG.attack // 2, PlayerIG.attack )
EnemyAttack = random.randint(enemy.attack // 2, enemy.attack )
if PlayerAttack == PlayerIG.attack // 2:
print('You miss!')
else:
enemy.health -= PlayerAttack
print("You deal %i damage" % PlayerAttack)
option = input(">>> ")
if enemy.health <= 0:
win()
os.system('cls')
if EnemyAttack == enemy.attack// 2:
print("The enemy missed")
else:
PlayerIG.health -= EnemyAttack
print("The enemy deals %i damage" % EnemyAttack)
option = input(">>> ")
if PlayerIG.health <= 0:
died()
else:
combat()
def win():
os.system('cls')
enemy.health = enemy.maxhealth
PlayerIG.gold == enemy.goldgain
print("You have succesfully defeated the %s" % enemy.name)
print("You found %i gold! " % enemy.goldgain)
option = input(">>> ")
prolog4()
def died():
os.system('cls')
print("""
You Have Died.
Try again? """)
option = input(">>> ")
combat()
def drinkpotion():
print("You have %s Potions" % (PlayerIG.potion))
option = input(">>> ")
combat()
def prolog4():
print("""
Future update soon.
Play Again?
1. Yes
2. No
""")
option = input(">>> ")
if option == '1':
name()
else:
print("Thanks For Playing!")
exit
def invalidoption():
print("Invalid Option")
name()