|
|
@ -1,3 +1,9 @@ |
|
|
|
""" |
|
|
|
C'est joli, mais il y aurait moyen de factoriser pas mal de choses! |
|
|
|
Note : 10 / 10 |
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
import random |
|
|
|
import cli |
|
|
|
import time |
|
|
@ -117,7 +123,7 @@ class Personnage(Animation): |
|
|
|
self.coef_defense = data[3] |
|
|
|
self.class_name = data[5].split('\n') |
|
|
|
self.shape = [data[7].replace('%', '\n'), data[8].replace('%', '\n')] |
|
|
|
self.potion = 2 |
|
|
|
self.potion = 2 |
|
|
|
|
|
|
|
self.x = x |
|
|
|
self.y = y |
|
|
@ -195,10 +201,10 @@ class App: |
|
|
|
\\ / |
|
|
|
`.___.' """.split('\n') |
|
|
|
self.opponent = [Personnage("Guerrier", 80, 45, "guerrier", 1, True), Personnage("Voleur", 80, 45, "voleur", 1, True), Personnage("Magicien", 80, 45, "magicien", 1, True), Personnage("Elfe", 80, 45, "elfe", 1, True)] |
|
|
|
self.title = """ ██ ███████ ██ ██ ██████ ███████ ██████ ██████ ██ ███████ |
|
|
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ |
|
|
|
██ █████ ██ ██ ██ ██ █████ ██████ ██ ██ ██ █████ |
|
|
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ |
|
|
|
self.title = """ ██ ███████ ██ ██ ██████ ███████ ██████ ██████ ██ ███████ |
|
|
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ |
|
|
|
██ █████ ██ ██ ██ ██ █████ ██████ ██ ██ ██ █████ |
|
|
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ |
|
|
|
█████ ███████ ██████ ██████ ███████ ██ ██ ██████ ███████ ███████ """.split('\n') |
|
|
|
|
|
|
|
def draw_arena(self, ennemi, choice): |
|
|
@ -207,14 +213,14 @@ class App: |
|
|
|
|
|
|
|
self.character.display('right', color='BLUE') |
|
|
|
self.opponent[ennemi].display('left', color='GREEN') |
|
|
|
|
|
|
|
|
|
|
|
gui.draw_bar(self.character.pdv * 100 // self.character.max_pdv, 5, 25, 30, color='RED') |
|
|
|
gui.draw_bar(self.character.xp * 100 // 20, 5, 27, 30, color='GREEN') |
|
|
|
gui.draw(self.character.nom, 15, 2, weight='BOLD') |
|
|
|
gui.draw(str(self.character.pdv), 38, 25, color='RED') |
|
|
|
gui.draw(str(self.character.xp), 38, 27, color='GREEN') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gui.draw_bar(self.opponent[ennemi].pdv * 100 // self.opponent[ennemi].max_pdv, 75, 25, 30, color='RED') |
|
|
|
gui.draw_bar(self.opponent[ennemi].xp * 100 // 20, 75, 27, 30, color='GREEN') |
|
|
|
gui.draw(self.opponent[ennemi].nom, 90, 2) |
|
|
@ -339,7 +345,7 @@ class App: |
|
|
|
if choice == 1: |
|
|
|
# affichage de l'inventaire |
|
|
|
position = [0, 0] |
|
|
|
|
|
|
|
|
|
|
|
while True: |
|
|
|
self.show_inventory(position) |
|
|
|
key = getkey.getkey() |
|
|
@ -380,13 +386,13 @@ class App: |
|
|
|
c.close() |
|
|
|
|
|
|
|
game_over = """ |
|
|
|
██████ █████ ███ ███ ███████ ██████ ██ ██ ███████ ██████ |
|
|
|
██ ██ ██ ████ ████ ██ ██ ██ ██ ██ ██ ██ ██ |
|
|
|
██ ███ ███████ ██ ████ ██ █████ ██ ██ ██ ██ █████ ██████ |
|
|
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ |
|
|
|
██████ ██ ██ ██ ██ ███████ ██████ ████ ███████ ██ ██ |
|
|
|
|
|
|
|
|
|
|
|
██████ █████ ███ ███ ███████ ██████ ██ ██ ███████ ██████ |
|
|
|
██ ██ ██ ████ ████ ██ ██ ██ ██ ██ ██ ██ ██ |
|
|
|
██ ███ ███████ ██ ████ ██ █████ ██ ██ ██ ██ █████ ██████ |
|
|
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ |
|
|
|
██████ ██ ██ ██ ██ ███████ ██████ ████ ███████ ██ ██ |
|
|
|
|
|
|
|
|
|
|
|
""".split('\n') |
|
|
|
for i in range(len(game_over)): |
|
|
|
gui.draw(game_over[i], 60 - len(game_over[i])//2, 12+i, color='RED') |
|
|
@ -399,7 +405,7 @@ class App: |
|
|
|
characters = [Personnage(name, 0, 5, "guerrier", 1, True), Personnage(name, 0, 5, "voleur", 1, True), Personnage(name, 0, 5, "magicien", 1, True), Personnage(name, 0, 5, "elfe", 1, True)] |
|
|
|
for char in characters: |
|
|
|
char.x = 60 - len(char.shape[0].split('\n')[0])//2 |
|
|
|
for i in range(len(characters[number_char].class_name)): |
|
|
|
for i in range(len(characters[number_char].class_name)): |
|
|
|
gui.draw(characters[number_char].class_name[i], 60-(len(characters[number_char].class_name[0])//2), 25+i, color='RED', weight='BOLD') |
|
|
|
for i in range(2): |
|
|
|
gui.draw('/', 4-i, 17+i) |
|
|
@ -410,7 +416,7 @@ class App: |
|
|
|
gui.draw('Utilisez les flèche pour changer de personnage puis appuyez sur entrée', 30, 1) |
|
|
|
|
|
|
|
gui.display() |
|
|
|
|
|
|
|
|
|
|
|
while True: |
|
|
|
key = getkey.getkey() |
|
|
|
if key == getkey.keys.RIGHT: |
|
|
@ -425,7 +431,7 @@ class App: |
|
|
|
del characters |
|
|
|
self.play() |
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
def menu(self): |
|
|
|
"""permet de choisir son nom""" |
|
|
|
for i in range(len(self.title)): |
|
|
|