-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
56 lines (48 loc) · 1.18 KB
/
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
import random, time
from player import *
from helper import *
from draw import *
from special import *
# gets valid player selection from user
def get_player():
options = {"Pikachu":Pikachu(), "Spiderman":Spiderman(), "Jedi":Jedi()}
print(" / ".join(options.keys()))
while True:
choice = input(">")
if choice in options:
return options[choice]
else:
print ("Invalid")
# game logic for the battle
def battle(user, bot, level):
print ("Your opponent will be...", bot.name)
status(user, bot)
while user.health > 0 and bot.health > 0:
user_move(user, bot)
time.sleep(2)
if bot.health > 0:
bot_move(user, bot)
if user.health < 0 and bot.health < 0:
print ("Tie!")
elif user.health < 0:
print ("You lose...")
else:
print ("You win!")
if level == 2:
return
else:
bot = Thanos()
show_bot(bot)
time.sleep(1)
print ("\nLevel up...\n")
time.sleep(1)
level += 1
battle(user, bot, level)
# setup
print("Get ready for battle...\nWho do you choose to play as?")
user = get_player()
bot = Voldemort()
show_user(user)
show_bot(bot)
level = 1
battle(user, bot, level)