Поработайте с кодом игры Wizard Duel, созданной на занятии. Выполните следующие шаги:
1. Измените значение максимального здоровья игрока и бота.
2. Добавьте новое заклинание в список spells.
3. Добавьте информацию о заклинаниях. Пусть по нажатию
кнопки i пользователю предоставляется описание всех
заклинаний.
4. Добавьте в код изображение в формате ASCII-кода. Выберите картинку на свое усмотрение.
import random
import time
import os
min_health = 0
max_health = 20
player_health = max_health
bot_health = max_health
simple_spells = [["fireball", 10, 0], ["metabolism", 0 , 8], ["silence", 0, 0 ]]
complicated_spells = [['strength', 9, 3], ['vitality', 4, 8]]
name = 0
damage = 1
heal = 2
start_ascii = '''
__ __ __ __ __
| \ _ | \| \ | \ | \ |
| $$ / \ | $$ \$$ | $$ | \ __ __ | $$
| $$/ $\| $$| \| \ \ / \ / $$ | $$ | $$| \ | \ / \ | $$
| $$ $$$\ $$| $$ \\\| \| | $$ | $$| $$ | $$| \| $$
| $$ $$\$$\$$| $$ / $$/ $$| $$ \$$| $$ | $$ | $$ | $$| $$ | $$| $$ $$| $$
| \| $$ / | | $$ | $$__| $$ | $$__/ $$| $$__/ $$| | $$
| $$$ \$$$| $$| $$ \$$ $$| $$ \$$ $$ | $$ $$ \$$ $$ \$$ \| $$
\$$ \$$ \$$ \\ \$$ \ \ \ \ \$$
'''
gameover_ascii = '''
__ __ __ __
/ \ / \ | \ / \| \ / \ | \ | \| \| \\
| \| \| $$\ / $$| | \| $$ | $$| | \\
| $$ __\$$| $$__| $$| $$$\ / $$$| $$__ | $$ | $$| $$ | $$| $$__ | $$__| $$
| $$| \| $$ $$| \ | $$ \ | $$ | $$ \$$\ / $$| $$ \ | $$ $$
| $$ \| | $$\$$ $$ $$| | $$ | $$ \$$\ $$ | | \\
| $$__| $$| $$ | $$| $$ \$$$| $$| $$ | $$__/ $$ \$$ $$ | $$ | $$ | $$
\$$ $$| $$ | $$| $$ \$ | $$| $$ \ \$$ $$ \$$$ | $$ \| $$ | $$
\ \$$ \$$ \$$ \$$ \ \ \$ \ \$$ \$$
'''
while True:
print(start_ascii)
print("Начать игру? [y] - Да / [n] - Нет")
select = input()
if select == 'n' or select == 'N':
break
elif select == 'y' or select == 'Y':
os.system('cls')
spells = simple_spells
a = len(simple_spells)
print("ПАРАМЕТРЫ")
print("\t Магия Урон Лечение")
count = 1
for row in spells:
print(f"\n{[count]}", end=" - ")
count = count + 1
for elem in row:
print("\t", elem, end = "")
print("\nНовый раунд")
for round in range (1, 6):
choice = True
while choice:
player_select = input("Выберите магию: ")
if player_select > '0' and player_select 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" ИГРОК vs БОТ ")
print(f" {player_health} \t {bot_health}")
if player_health bot_health:
print("Поздравляем! Вы выиграли!\n")
elif player_health < bot_health:
print("Извини...но ты проиграл!")
else:
print("Ничья!")
time.sleep(5)
od.system('cls')
print("КОНЕЦ!")