|
|
@ -1,5 +1,38 @@ |
|
|
|
import random |
|
|
|
from tkinter import * |
|
|
|
|
|
|
|
#--GUI |
|
|
|
fenetre = Tk() |
|
|
|
fenetre.title("Baldur's Bait") |
|
|
|
fenetre_width = 1024 |
|
|
|
fenetre_height = 1024 |
|
|
|
ScreenWidth = fenetre.winfo_screenwidth() |
|
|
|
Screenheight = fenetre.winfo_screenheight() |
|
|
|
fenetre.resizable(width=False, height=False) |
|
|
|
fenetre.configure(bg='white') |
|
|
|
|
|
|
|
#photo = PhotoImage(file="bait.png") |
|
|
|
|
|
|
|
canvas = Canvas(fenetre,width=1024, height=1024) |
|
|
|
#canvas.create_image(0, 0, anchor=NW, image=photo) |
|
|
|
canvas.pack() |
|
|
|
|
|
|
|
#bouton |
|
|
|
boutonfermer = Button(fenetre, text='Quitter', command = fenetre.destroy) |
|
|
|
boutonfermer.pack() |
|
|
|
|
|
|
|
def recupere(): |
|
|
|
showinfo("Alerte", entree.get()) |
|
|
|
|
|
|
|
value = StringVar() |
|
|
|
value.set("Valeur") |
|
|
|
entree = Entry(fenetre, textvariable=value, width=30) |
|
|
|
entree.pack() |
|
|
|
|
|
|
|
bouton = Button(fenetre, text="Valider", command=recupere) |
|
|
|
bouton.pack() |
|
|
|
|
|
|
|
#--class |
|
|
|
class Personne: |
|
|
|
def __init__(self, nom, cat): |
|
|
|
self.__nom = nom |
|
|
@ -61,7 +94,7 @@ class Personne: |
|
|
|
def get_coef_def(self): |
|
|
|
return self.__coefDef |
|
|
|
|
|
|
|
def set_nom(self): |
|
|
|
def set_nom(self, nom): |
|
|
|
self.__nom = nom |
|
|
|
|
|
|
|
def jet_attaque(self): |
|
|
@ -86,9 +119,11 @@ class Personne: |
|
|
|
def affiche_inventaire(self): |
|
|
|
print('\n votre inventaire: ', self.get_inv()) |
|
|
|
|
|
|
|
#--main |
|
|
|
nb_tour = 0 |
|
|
|
liste_tour = ['bot', 'joueur'] |
|
|
|
|
|
|
|
#--round |
|
|
|
def tour(attaquant, defenseur): |
|
|
|
global nb_tour |
|
|
|
nb_tour += 1 |
|
|
@ -165,6 +200,7 @@ def tour(attaquant, defenseur): |
|
|
|
|
|
|
|
liste = ['defenseur', 'attaquant'] |
|
|
|
|
|
|
|
#--game |
|
|
|
def jeu(joueur, bot): |
|
|
|
jhp = player.get_hp() |
|
|
|
bhp = enemy.get_hp() |
|
|
@ -192,6 +228,7 @@ def jeu(joueur, bot): |
|
|
|
joueur = Personne('joueur', 'guerrier') |
|
|
|
bot = Personne('bot', 'voleur') |
|
|
|
|
|
|
|
#--player character choice |
|
|
|
def choix(): |
|
|
|
n = input("\nquel est le nom de votre personnage? :") |
|
|
|
classe = input("\nappuyez sur: \n A pour guerrier, \n Z pour mage, \n E pour voleur, \n R pour elfe \n").upper() |
|
|
@ -204,6 +241,7 @@ def choix(): |
|
|
|
if classe == "R": |
|
|
|
return Personne(n, "elfe") |
|
|
|
|
|
|
|
#--random bot |
|
|
|
def rand(): |
|
|
|
name = ["Darius", "Garen", "Zac", "Ashe", "Elise", "Gwen"] |
|
|
|
cat = ["guerrier", "mage", "voleur", "elfe"] |
|
|
@ -216,3 +254,5 @@ player = joueur |
|
|
|
bot = rand() |
|
|
|
enemy = bot |
|
|
|
jeu(joueur, bot) |
|
|
|
|
|
|
|
fenetre.mainloop() |