import random
import time
import os
min_health = 0
max_health = 30
player_health = max_health
bot_health = max_health
# spell = [spell_name, damage, healing]
simple_spells = [['fireball', 10, 0], ['metabolism', 0, 8], ['silence', 0, 0]]
complicated_spells = [['strength', 9, 3], ['vitality', 4, 8], ['Electric shock', 3,4]]
name = 0
damage = 1
heal = 2
# Img to ASCII
start_ascii = '''
_______.___________. ___ .______ .___________.
/ | | / \ | _ \ | |
| (----`---| |----` / ^ \ | |_) | `---| |----`
\ \ | | / /_\ \ | / | |
.----) | | | / _____ \ | |\ \----. | |
|_______/ |__| /__/ \__\ | _| `._____| |__|
____ __ ____ __ ________ ___ .______ _______ _______ __ __ _______ __
\ \ / \ / / | | | / / \ | _ \ | \ | \ | | | | | ____|| |
\ \/ \/ / | | `---/ / / ^ \ | |_) | | .--. | | .--. || | | | | |__ | |
\ / | | / / / /_\ \ | / | | | | | | | || | | | | __| | |
\ /\ / | | / /----./ _____ \ | |\ \----| '--' | | '--' || `--' | | |____ | `----.
\__/ \__/ |__| /________/__/ \__\ | _| `._____|_______/ |_______/ \______/ |_______||_______|
'''
gameover_ascii = '''
_______ ___ .___ ___. _______ ______ ____ ____ _______ .______
/ _____| / \ | \/ | | ____| / __ \ \ \ / / | ____|| _ \
| | __ / ^ \ | \ / | | |__ | | | | \ \/ / | |__ | |_) |
| | |_ | / /_\ \ | |\/| | | __| | | | | \ / | __| | /
| |__| | / _____ \ | | | | | |____ | `--' | \ / | |____ | |\ \----.
\______| /__/ \__\ |__| |__| |_______| \______/ \__/ |_______|| _| `._____|
'''
end_ascii = '''
.___________.__ __ _______ _______ .__ __. _______
| | | | | | ____| | ____|| \ | | | \
`---| |----| |__| | | |__ | |__ | \| | | .--. |
| | | __ | | __| | __| | . ` | | | | |
| | | | | | | |____ | |____ | |\ | | '--' |
|__| |__| |__| |_______| |_______||__| \__| |_______/
'''
level_up_ascii = '''
__ ___________ ____ _______ __ __ __ .______
| | | ____\ \ / / | ____|| | | | | | | _ \
| | | |__ \ \/ / | |__ | | | | | | | |_) |
| | | __| \ / | __| | | | | | | | ___/
| `----.| |____ \ / | |____ | `----. | `--' | | |
|_______||_______| \__/ |_______||_______| \______/ | _|
'''
new_round_ascii = '''
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||..||||||||||||||||||||||||||||||
|||||||^-||||||||||||||||||||.&!&-.|..||||||||||...-!^^^.|||||
|-||!%@@@$!||||||||||...||||.^^&&&!&!.|||||||.$##@$$@@@$!!-.!.
|&$@$&!--&!||||||||||-&!&--^-!%%^&^-..!!.|||||.&%%&%!%$%!.-@@&
||%@^--!..&|.-^&^^^^^%%%%%&&%%%%^^&^&&^&&--&%^^&&!&!!&@$@##%.|
||||.!$@$@@@$$@$!.||.-&%!-.!^&%^&--!&&&&!.|-&&@$$$$@@@#####^||
|||!#@%!@##$^$$#!|||||-&-.&--!%^&!-...!...||||||-%@@@@#^.!&.||
|||^##@!#@#@^||..||||||||..|.!&-!.|||||||.!^^&||||^$##@&||||||
||^#%.|%#@@@$$.|||||||||||||||.||||||||||&&-.$!|!$$@#$@@.|||||
|^^%^|&##$@@@$@.|||||||||||||||||||||||||!$-...$$$@##@@#&|||||
|^^!!$##@%!..$$!&||||||||||||||||||||||||||-&%^$^!%&.$@@$.||||
||||||-.||||||||||||||||||||||||||||||||||||||||||||||||||||||
'''
win_ascii = '''
____ ____ ______ __ __ ____ __ ____ __ .__ __.
\ \ / / / __ \ | | | | \ \ / \ / / | | | \ | |
\ \/ / | | | | | | | | \ \/ \/ / | | | \| |
\_ _/ | | | | | | | | \ / | | | . ` |
| | | `--' | | `--' | \ /\ / | | | |\ |
|__| \______/ \______/ \__/ \__/ |__| |__| \__|
'''
# ------------- Start -------------
while True:
# Player select
print(start_ascii, '\n[Y] - Yes\n[N] - No\n')
select = input('Start Wizard Duel? Your select: ')
if select == 'N' or select == 'n':
break
elif (not select == 'Y') and (not select == 'y'):
print('Error! Try again.')
else:
# --- create new list with spells ---
os.system('cls')
spells = simple_spells
a = len(simple_spells)
del spells[a:]
print('''
==========================================
================ OPTIONS =================
Spell Damage Healing''')
count = 1
for row in spells:
print(f'\n{[count]}', end=' - ')
count+=1
for elem in row:
print('\t', elem, end='')
print('''
==========================================
------- WIZARD DUEL -------''')
print(new_round_ascii)
# Start new game
for round in range(1, 6):
# User select
choice = True
while choice:
player_select = input('\nSelect spell: ')
if player_select > '0' and player_select <= str(len(spells)) and len(player_select)==1:
player_select = int(player_select)
player_select = player_select - 1
bot_select = random.randint(0, len(spells)-1)
choice = False
else:
print('Error! Try again.')
play_1 = spells[player_select][name] # The spell selected by the player
play_2 = spells[bot_select][name] # The spell selected by the bot
print(f'''
----ROUND № {round}----
{play_1.upper()} ----- {play_2.upper()}''')
# Use spell
if play_1 == 'silence' and play_2 == 'silence':
continue
elif play_1 == 'silence':
player_select = bot_select
player_health += spells[bot_select][damage]
elif play_2 == 'silence':
bot_select = player_select
bot_health += spells[player_select][damage]
player_health += spells[player_select][heal]
player_health -= spells[bot_select][damage]
bot_health += spells[bot_select][heal]
bot_health -= spells[player_select][damage]
# Max & min health
if player_health > max_health and bot_health > max_health:
player_health = max_health
bot_health = max_health
elif player_health > max_health:
player_health = max_health
elif bot_health > max_health:
bot_health = max_health
print(f'''
PLAYER vs BOT
{player_health} {bot_health}
''')
if player_health < min_health or bot_health < min_health:
break
# ----------- complicated spells ---------------
# ------------ Level Up -----------------
if round == 3:
os.system('cls')
print(f'''
{level_up_ascii}
==========================================
============== NEW FEATUES ===============
Spell Damage Healing''')
spells += complicated_spells
count = 1
for row in spells:
print(f'\n{[count]}', end=' - ')
count+=1
for elem in row:
print('\t', elem, end='')
print('\n==========================================')
# ------------- The end -------------
os.system('cls')
print(gameover_ascii)
if player_health > bot_health:
print('Congratulations! You win!\n', win_ascii)
elif player_health < bot_health:
print('Sorry... The computer wins!')
else:
print('Draw!')
time.sleep(5)
os.system('cls')
print(end_ascii)