@ -72,32 +72,53 @@ class Animation:
class Personnage ( Animation ) :
class Personnage ( Animation ) :
""" Class de base du personnage """
""" Class de base du personnage """
def __init__ ( self , nom , x , y , categorie , xp = 1 ) :
def __init__ ( self , nom , x , y , categorie , xp = 1 , bot = False ) :
conn = sqlite3 . connect ( ' bdd.db ' )
self . bot = bot
c = conn . cursor ( )
c . execute ( " SELECT * from Personnage join Categorie on Personnage.categorie=Categorie.name join Profil on Categorie.profil=Profil.name where name = ? " , ( nom , ) )
data = c . fetchone ( )
print ( data )
if data is None :
c . execute ( " insert into Personnage(name, pdv, xp, max_pdv, categorie) Values(?, ?, ?, ?, ?) " , ( nom , " 20 " , str ( xp ) , " 20 " , categorie ) )
conn . commit ( )
c . execute ( " SELECT * from Personnage join Categorie on Personnage.categorie=Categorie.name join Profil on Categorie.profil=Profil.name where name = ? " , ( nom , ) )
data = c . fetchone ( )
conn . close ( )
data = data [ 0 ]
print ( data )
self . nom = nom
if not self . bot :
self . coef_attack = 1
conn = sqlite3 . connect ( ' bdd.db ' )
self . coef_defense = 1
c = conn . cursor ( )
self . pdv = data [ 1 ]
c . execute ( " SELECT * from Personnage join Categorie on Personnage.categorie=Categorie.name join Profil on Categorie.profil=Profil.name where Personnage.name = ? " , ( nom , ) )
self . max_pdv = data [ 3 ]
data = c . fetchone ( )
self . xp = data [ 2 ]
if data is None :
self . inv = [ ' potion ' for i in range ( 2 ) ]
c . execute ( " insert into Personnage(name, pdv, xp, max_pdv, potion, categorie) Values(?, ?, ?, ?, ?, ?) " , ( nom , " 20 " , str ( xp ) , " 20 " , " 2 " , categorie ) )
conn . commit ( )
c . execute ( " SELECT * from Personnage join Categorie on Personnage.categorie=Categorie.name join Profil on Categorie.profil=Profil.name where Personnage.name = ? " , ( nom , ) )
data = c . fetchone ( )
conn . close ( )
# Affectation du résultat de la requête aux attributs correspondants
self . nom = nom
self . pdv = data [ 1 ]
self . xp = data [ 2 ]
self . max_pdv = data [ 3 ]
self . weapon = data [ 7 ]
self . coef_attack = data [ 8 ]
self . coef_defense = data [ 9 ]
self . class_name = data [ 11 ] . split ( ' \n ' )
self . shape = [ data [ 13 ] . replace ( ' % ' , ' \n ' ) , data [ 14 ] . replace ( ' % ' , ' \n ' ) ]
self . potion = data [ 5 ]
else :
# récupération des attributs de la catégorie
conn = sqlite3 . connect ( ' bdd.db ' )
c = conn . cursor ( )
c . execute ( " SELECT * from Categorie join Profil on Categorie.profil=Profil.name where Categorie.name = ? " , ( categorie , ) )
data = c . fetchone ( )
conn . close ( )
self . nom = nom
self . pdv = 20
self . xp = xp
self . max_pdv = 20
self . weapon = data [ 1 ]
self . coef_attack = data [ 2 ]
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 . shape = [ ' ' , ' ' ]
self . x = x
self . x = x
self . y = y
self . y = y
super ( ) . __init__ ( self . x , self . y , self . shape )
super ( ) . __init__ ( self . x , self . y , self . shape )
@ -110,81 +131,49 @@ class Personnage(Animation):
def change_xp ( self , nb_xp ) :
def change_xp ( self , nb_xp ) :
self . xp + = nb_xp
self . xp + = nb_xp
if not self . bot :
conn = sqlite3 . connect ( ' bdd.db ' )
c = conn . cursor ( )
c . execute ( " UPDATE Personnage SET xp=? where name=? " , ( self . xp , self . nom ) )
conn . commit ( )
c . close ( )
def change_pdv ( self , nb_pdv ) :
def change_pdv ( self , nb_pdv ) :
self . pdv + = nb_pdv
self . pdv + = nb_pdv
if not self . bot :
conn = sqlite3 . connect ( ' bdd.db ' )
class Guerrier ( Personnage ) :
c = conn . cursor ( )
c . execute ( " UPDATE Personnage SET pdv=? where name=? " , ( self . pdv , self . nom ) )
def __init__ ( self , nom , x , y , xp = 1 ) :
conn . commit ( )
super ( ) . __init__ ( nom , x , y , xp )
c . close ( )
self . weapon = " épée "
def change_max_pdv ( self , pdv ) :
self . class_name = """ ██████ ██ ██ ███████ ██████ ██████ ██ ███████ ██████
self . max_pdv = pdv
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
if not self . bot :
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
conn = sqlite3 . connect ( ' bdd.db ' )
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
c = conn . cursor ( )
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ """ .split( ' \n ' )
c . execute ( " UPDATE Personnage SET max_pdv=? where name=? " , ( self . max_pdv , self . nom ) )
self . coef_attack = 10
conn . commit ( )
self . coef_defense = 8
c . close ( )
self . inv . append ( self . weapon )
self . shape = [ """ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⡤⠤⢶⣒⠢⢤⣤⡀⠀⠀⠀⠀⠀⠀⠀⣴⠛⡆ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡟⠁⠀⠀⢰⠛⠛⢶⣤⠟⠀⠀⠀⠀⠀⠀⢸⡏⠀⢹ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⡎⠀⠀⣀⣠⣞⣀⡔⠉⠀⠀⠀⠀⠀⠀⠀⠀⠸⣇⠀⡸ \n ⠀⠀⠀⠀⠀⢀⣀⣠⣤⣇⣴⢊⡵⠶⣵⣲⢧⣀⡀⠀⠀⠀⠀⠀⠀⠀⢠⣾⣿⣶ \n ⠀⠀⠀⠀⡠⠊⠉⠉⠑⢌⠻⡏⠀⡀⠈⠁⢀⡏⠙⢦⡀⠀⠀⠀⠀⠀⠈⣿⠉⡇ \n ⠀⠀⢠⡖⢅⠀⠀⠀⠀⡸⠀⡇⠀⠈⢹⢸⠁⣏⢢⣸⢷⠀⠀⠀⠀⠀⠀⣿⠀⡇ \n ⠀⠀⡾⠳⣤⣙⠲⢶⡴⠃⣾⠋⠲⢦⣼⣿⡴⠃⢧⣷⣧⢗⡶⠲⢦⣤⠶⠻⡶⡷ \n ⠀⢐⡶⢂⠀⠉⠙⢢⢄⡰⠁⠀⠀⠀⢸⣇⠀⠀⣜⣁⠁⡏⠀⠀⠀⠘⢴⣶⠤⢟ \n ⠀⡟⠐⣾⢄⡀⢀⢎⡀⡏⠓⠦⠒⣉⠡⠌⢉⠏⠁⠙⠦⣱⡀⢀⣠⠜⢼⣷⠭⡝ \n ⢀⣿⡿⠷⢦⣼⡏⢠⡿⣍⣛⣫⣭⣤⣤⣤⡾⡄⠀⠀⠀⠀⠈⠉⠀⠀⠀⣿⠉⡇ \n ⢇⠀⠀⠀⠀⢸⠃⢨⣏⣀⠀⢈⠑⢄⣠⣾⠳⡃⠀⠀⠀⠀⠀⠀⠀⠀⠀⣻⠀⡇ \n ⠀⣷⠀⠀⠀⠣⡀⣨⠋⠀⠻⣮⢦⠀⢹⢯⠀⢱⡀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⡇ \n ⠀⡇⠀⢀⠈⣞⡿⣇⡴⠶⣄⡼⢻⣠⣟⢈⣳⠋⢹⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⡇ \n ⠀⠻⢿⣷⣑⣌⡿⡸⣀⢀⣿⡇⠀⣀⠼⣽⢇⣀⠎⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⡇ \n ⠀⠀⠀⠀⠀⠀⠀⢧⠈⠋⣼⠇⠀⣳⣸⠃⡼⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⡇ \n ⠀⠀⠀⠀⠀⠀⠀⢏⡤⠤⣽⠇⠀⡿⣿⣻⣷⢄⣀⡀⠀⠀⠀⠀⠀⠀⠀⣿⠀⡇ \n ⠀⠀⠀⠀⠀⠀⢰⡟⠛⣽⢿⡇⠀⢱⣾⣿⣷⣷⣿⣿⡄⠀⠀⠀⠀⠀⠀⣿⣀⡇ \n ⠀⠀⠀⠀⠀⠀⠘⠿⣿⣭⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠀ """ ,
def add_potion ( self ) :
""" ⡆⠛⣴⠀⠀⠀⠀⠀⠀⠀⡀⣤⢤⠢⣒⢶⠤⡤⣠⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⢹⠀⡏⢸⠀⠀⠀⠀⠀⠀⠟⣤⢶⠛⠛⢰⠀⠀⠁⡟⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⡸⠀⣇⠸⠀⠀⠀⠀⠀⠀⠀⠀⠉⡔⣀⣞⣠⣀⠀⠀⡎⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⣶⣿⣾⢠⠀⠀⠀⠀⠀⠀⠀⡀⣀⢧⣲⣵⠶⡵⢊⣴⣇⣤⣠⣀⢀⠀⠀⠀⠀⠀ \n ⡇⠉⣿⠈⠀⠀⠀⠀⠀⡀⢦⠙⡏⢀⠁⠈⡀⠀⡏⠻⢌⠑⠉⠉⠊⡠⠀⠀⠀⠀ \n ⡇⠀⣿⠀⠀⠀⠀⠀⠀⢷⣸⢢⣏⠁⢸⢹⠈⠀⡇⠀⡸⠀⠀⠀⠀⢅⡖⢠⠀⠀ \n ⡷⡶⠻⠶⣤⢦⠲⡶⢗⣧⣷⢧⠃⡴⣿⣼⢦⠲⠋⣾⠃⡴⢶⠲⣙⣤⠳⡾⠀⠀ \n ⢟⠤⣶⢴⠘⠀⠀⠀⡏⠁⣁⣜⠀⠀⣇⢸⠀⠀⠀⠁⡰⢄⢢⠙⠉⠀⢂⡶⢐⠀ \n ⡝⠭⣷⢼⠜⣠⢀⡀⣱⠦⠙⠁⠏⢉⠌⠡⣉⠒⠦⠓⡏⡀⢎⢀⡀⢄⣾⠐⡟⠀ \n ⡇⠉⣿⠀⠀⠀⠉⠈⠀⠀⠀⠀⡄⡾⣤⣤⣤⣭⣫⣛⣍⡿⢠⡏⣼⢦⠷⡿⣿⢀ \n ⡇⠀⣻⠀⠀⠀⠀⠀⠀⠀⠀⠀⡃⠳⣾⣠⢄⠑⢈⠀⣀⣏⢨⠃⢸⠀⠀⠀⠀⢇ \n ⡇⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⡀⢱⠀⢯⢹⠀⢦⣮⠻⠀⠋⣨⡀⠣⠀⠀⠀⣷⠀ \n ⡇⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⢹⠋⣳⢈⣟⣠⢻⡼⣄⠶⡴⣇⡿⣞⠈⢀⠀⡇⠀ \n ⡇⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⠎⣀⢇⣽⠼⣀⠀⡇⣿⢀⣀⡸⡿⣌⣑⣷⢿⠻⠀ \n ⡇⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⡼⠃⣸⣳⠀⠇⣼⠋⠈⢧⠀⠀⠀⠀⠀⠀⠀ \n ⡇⠀⣿⠀⠀⠀⠀⠀⠀⠀⡀⣀⢄⣷⣻⣿⡿⠀⠇⣽⠤⡤⢏⠀⠀⠀⠀⠀⠀⠀ \n ⡇⣀⣿⠀⠀⠀⠀⠀⠀⡄⣿⣿⣷⣷⣿⣾⢱⠀⡇⢿⣽⠛⡟⢰⠀⠀⠀⠀⠀⠀ \n ⠀⠉⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠃⣿⣭⣿⠿⠘⠀⠀⠀ """ ]
""" Ajoute une potion à l ' invetaire et à la base de donnée """
self . potion + = 1
if not self . bot :
class Voleur ( Personnage ) :
conn = sqlite3 . connect ( ' bdd.db ' )
c = conn . cursor ( )
def __init__ ( self , nom , x , y , xp = 1 ) :
c . execute ( " UPDATE Personnage SET potion=? WHERE name=? " , ( self . potion , self . nom ) )
super ( ) . __init__ ( nom , x , y , xp )
c . close ( )
self . coef_attack = 3
def remove_potion ( self ) :
self . class_name = """ ██ ██ ██████ ██ ███████ ██ ██ ██████
""" Enlève une potion à l ' invetaire et à la base de donnée """
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
self . potion - = 1
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
if not self . bot :
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
conn = sqlite3 . connect ( ' bdd.db ' )
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ """ .split( ' \n ' )
c = conn . cursor ( )
self . coef_defense = 9
c . execute ( " UPDATE Personnage SET potion=? WHERE name=? " , ( self . potion , self . nom ) )
self . weapon = " dague "
conn . commit ( )
self . inv . append ( self . weapon )
c . close ( )
self . shape = [ """ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡤⠦⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡎⣀⣠⣤⠭⢶⡄⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠟⢉⣕⣒⣒⣪⢹⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢤⣣⠥⢔⡪⠤⣻⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⡈⢎⠒⠁⠈⢒⠎⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⢀⠔⠒⠉⠉⠀⠀⣈⢱⡣⢄⣠⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⢀⠇⠀⠀⠀⠀⠀⡜⢀⠏⠈⡆⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠘⡄⠀⠀⠀⠀⡜⠊⢁⠗⠊⠁⢠⢣⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠑⠢⣀⡠⡞⠤⠒⠁⠀⠀⢠⠣⡀⠱⡀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⡸⠑⠢⠤⣀⣀⣀⠎⠀⠑⢄⢈⠦⣀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⢠⠃⠀⠀⠀⠀⠀⠘⢄⠀⠀⠀⠹⣐⡤⢭⣢⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⡸⠉⠉⠢⡀⠀⠑⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⡎⠀⢰⠁⠀⠀⠀⠈⢢⠀⠘⡄⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⢰⠁⠀⡜⠀⠀⠀⠀⠀⢸⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⢸⠀⠀⡇⠀⠀⠀⠀⠀⢸⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⡸⡄⣀⡇⠀⠀⠀⠀⠀⡸⠒⠲⠃⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠙⣎⢹⣁⠀⠀⠀⠀⠀⠙⣆⢸⣀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠈⠶⠿⠀⠀⠀⠀⠀⠀⠈⠶⠿⠀ """ ,
""" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⠦⡤⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⡄⢶⠭⣤⣠⣀⡎⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⢹⣪⣒⣒⣕⢉⠟⢠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⣻⠤⡪⢔⠥⣣⢤⠘⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠎⢒⠈⠁⠒⢎⡈⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠃⣠⢄⡣⢱⣈⠀⠀⠉⠉⠒⠔⢀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⡆⠈⠏⢀⡜⠀⠀⠀⠀⠀⠇⢀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢣⢠⠁⠊⠗⢁⠊⡜⠀⠀⠀⠀⡄⠘⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⡀⠱⡀⠣⢠⠀⠀⠁⠒⠤⡞⡠⣀⠢⠑⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⣀⠦⢈⢄⠑⠀⠎⣀⣀⣀⠤⠢⠑⡸⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⣢⢭⡤⣐⠹⠀⠀⠀⢄⠘⠀⠀⠀⠀⠀⠃⢠⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⡄⠑⠀⡀⠢⠉⠉⡸⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⡄⠘⠀⢢⠈⠀⠀⠀⠁⢰⠀⡎⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⢸⠀⠀⠀⠀⠀⡜⠀⠁⢰⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⢸⠀⠀⠀⠀⠀⡇⠀⠀⢸⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠃⠲⠒⡸⠀⠀⠀⠀⠀⡇⣀⡄⡸⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⣀⢸⣆⠙⠀⠀⠀⠀⠀⣁⢹⣎⠙⠀⠀⠀⠀⠀⠀ \n ⠀⠿⠶⠈⠀⠀⠀⠀⠀⠀⠿⠶⠈⠀⠀ """ ]
class Magicien ( Personnage ) :
def __init__ ( self , nom , x , y , xp = 1 ) :
super ( ) . __init__ ( nom , x , y , xp )
self . coef_attack = 10
self . class_name = """ ███ ███ █████ ██████ ██ ██████ ██ ███████ ███ ██
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ """ .split( ' \n ' )
self . coef_defense = 7
self . weapon = " bâton "
self . inv . append ( self . weapon )
self . shape = [ """ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡄⣤⣤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡄⢣⠀⣤⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⡏⠉⠀⠀⡸⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡆⠁⣀⠶⠶⠷⡸⢀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⣀⠲⢦⠶⡰⢀⠀⠀⠀⠀⠀⡅⠀⣁⠖⠶⠶⠷⠾⠶⠔⢀⠀⠀⠀⠀⠀ \n ⣿⠀⠂⠐⠃⡜⠀⠀⠀⠀⡄⣧⠒⠀⠀⣤⠀⡤⣤⠀⣤⠘⠀⠀⠀⠀⠀ \n ⠀⠛⠛⡜⢠⡇⠀⠀⠀⡇⢸⠀⡄⣤⠛⢸⠀⡆⡿⠛⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠃⠜⣛⠤⣀⠀⠃⠛⡛⠤⣀⣀⣀⣀⢇⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠉⠶⣉⠰⣀⢆⠁⠀⠿⢉⠉⡏⢾⣀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠉⡱⢏⡸⠀⠀⠀⠸⠀⡇⢸⠉⠦⠶⠶⡢⠶⠶⣶ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⡄⢢⡔⠂⠒⣤⢸⠀⠇⢸⠀⠀⠀⠀⠀⡆⠂⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⢸⠃⡄⣤⠛⢠⠀⡃⢠⣿⠛⠘⢠⠀⡇⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡅⢘⠀⠀⣟⠢⠜⠠⠄⣿⠀⠀⠜⠠⠇⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⢸⠀⠀⣿⣁⣎⣱⢎⣿⠀⠀⠀⠁⠈⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⢸⠀⠀⣿⣉⣏⣹⣎⣉⠶⢀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢢⠑⠈⠀⠀⣿⠉⠋⠟⢹⠉⠒⣨⡔⢠⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠃⠛⠛⠛⠛⠛⠛⠛⠚⠋⠛⠛⠀⠛⠘ """ ,
""" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⣤⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⣤⠀⢣⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡸⠀⠀⠉⡏⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⢀⡸⠷⠶⠶⣀⠁⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⢀⠔⠶⠾⠷⠶⠶⠖⣁⠀⡅⠀⠀⠀⠀⠀⢀⡰⠶⢦⠲⣀ \n ⠀⠀⠀⠀⠀⠘⣤⠀⣤⡤⠀⣤⠀⠀⠒⣧⡄⠀⠀⠀⠀⡜⠃⠐⠂⠀⣿ \n ⠀⠀⠀⠀⠀⠀⠀⠛⡿⡆⠀⢸⠛⣤⡄⠀⢸⡇⠀⠀⠀⡇⢠⡜⠛⠛⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⢇⣀⣀⣀⣀⠤⡛⠛⠃⠀⣀⠤⣛⠜⠃⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⣀⢾⡏⠉⢉⠿⠀⠁⢆⣀⠰⣉⠶⠉⠀⠀⠀⠀⠀⠀ \n ⣶⠶⠶⡢⠶⠶⠦⠉⢸⡇⠀⠸⠀⠀⠀⡸⢏⡱⠉⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠂⡆⠀⠀⠀⠀⠀⢸⠇⠀⢸⣤⠒⠂⡔⢢⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⡇⠀⢠⠘⠛⣿⢠⡃⠀⢠⠛⣤⡄⠃⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠇⠠⠜⠀⠀⣿⠄⠠⠜⠢⣟⠀⠀⢘⡅⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠈⠁⠀⠀⠀⣿⢎⣱⣎⣁⣿⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⢀⠶⣉⣎⣹⣏⣉⣿⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⢠⡔⣨⠒⠉⢹⠟⠋⠉⣿⠀⠀⠈⠑⢢⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠘⠛⠀⠛⠛⠋⠚⠛⠛⠛⠛⠛⠛⠛⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀ """ ]
class Elfe ( Personnage ) :
def __init__ ( self , nom , x , y , xp = 1 ) :
super ( ) . __init__ ( nom , x , y , xp )
self . coef_attack = 8
self . class_name = """ ███████ ██ ███████ ███████
█ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ """ .split( ' \n ' )
self . coef_defense = 10
self . weapon = " arc "
self . inv . append ( self . weapon )
self . shape = [ """ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠎⠢⡀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠌⠀⠀⠙⣀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⢀⡀⢀⠀⠀⠀⠀⠀⠌⠀⠀⠀⠀⠐⡥⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⡠⢠⠁⢀⢀⢃⡀⠀⠀⠌⠀⠀⠀⠀⠀⠀⠐⡡⠀⠀⠀⠀ \n ⠀⡀⠄⠒⠈⠀⢠⠐⢫⠙⠼⠃⠀⡜⠀⠀⠀⠀⠀⠀⠀⠀⢁⢃⠀⠀⠀ \n ⡸⠮⡀⠄⣠⠀⠤⢐⡙⢵⢚⣵⣜⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠘⠀⠀⠀ \n ⠀⠀⠀⢈⡠⠐⢈⡡⢅⡤⠚⠸⣄⣍⣀⣐⣶⣶⣶⣶⡶⠤⡎⡕⣷⣀⠤ \n ⠀⠀⠀⠧⠀⠀⠨⠥⠌⠒⠮⠹⢸⠘⡀⠀⠀⠀⠀⠀⠀⠀⠈⡏⠃⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠀⠉⠳⡇⠀⠀⠀⠀⠀⠀⠀⢀⢰⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣃⣰⣶⡊⢄⠀⠀⠀⠀⠀⠀⠘⠆⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠜⠀⢀⣤⣈⠄⠢⡀⠀⠀⠀⢀⡛⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡟⣹⡿⣿⡋⠀⠀⠐⢄⠀⠀⡜⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣌⡺⠟⠀⡇⡄⠀⠀⠀⠈⠢⠜⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⠏⠀⠀⠇⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⣰⡿⠃⠀⠀⢠⣰⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⣰⡟⠁⠀⠀⠀⢸⡅⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⢀⡾⠏⠀⠀⠀⠀⠠⣾⠅⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⡀⠀⡐⠉⡼⠀⢀⠀⠀⠀⠰⣋⢒⡤⢰⡀⡀ """ ,
""" ⠀⠀⠀⠀⠀⠀⠀⡀⠢⠎⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⣀⠙⠀⠀⠌⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⡥⠐⠀⠀⠀⠀⠌⠀⠀⠀⠀⠀⢀⡀⢀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⡡⠐⠀⠀⠀⠀⠀⠀⠌⠀⠀⡀⢃⢀⢀⠁⢠⡠⠀⠀⠀⠀⠀ \n ⠀⠀⠀⢃⢁⠀⠀⠀⠀⠀⠀⠀⠀⡜⠀⠃⠼⠙⢫⠐⢠⠀⠈⠒⠄⡀⠀ \n ⠀⠀⠀⠘⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⣜⣵⢚⢵⡙⢐⠤⠀⣠⠄⡀⠮⡸ \n ⠤⣀⣷⡕⡎⠤⡶⣶⣶⣶⣶⣐⣀⣍⣄⠸⠚⡤⢅⡡⢈⠐⡠⢈⠀⠀⠀ \n ⠀⠀⠃⡏⠈⠀⠀⠀⠀⠀⠀⠀⡀⠘⢸⠹⠮⠒⠌⠥⠨⠀⠀⠧⠀⠀⠀ \n ⠀⠀⠀⢰⢀⠀⠀⠀⠀⠀⠀⠀⡇⠳⠉⠀⠘⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠆⠘⠀⠀⠀⠀⠀⠀⢄⡊⣶⣰⣃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⡛⢀⠀⠀⠀⡀⠢⠄⣈⣤⢀⠀⠜⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⡜⠀⠀⢄⠐⠀⠀⡋⣿⡿⣹⡟⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠜⠢⠈⠀⠀⠀⡄⡇⠀⠟⡺⣌⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠇⠇⠀⠀⠏⣿⣸⠀⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⢠⠀⠀⠃⡿⣰⠀⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡅⢸⠀⠀⠀⠁⡟⣰⠀⠀⠀⠀⠀⠀ \n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠅⣾⠠⠀⠀⠀⠀⠏⡾⢀⠀⠀⠀⠀ \n ⡀⡀⢰⡤⢒⣋⠰⠀⠀⠀⢀⠀⡼⠉⡐⠀⡀⠀ """ ]
class App :
class App :
@ -203,9 +192,9 @@ class App:
: , ' `-. ' ` :
: , ' `-. ' ` :
| |
| |
: ;
: ;
\ /
\\ /
` . ___ . ' " " " .split( ' \n ' )
` . ___ . ' " " " .split( ' \n ' )
self . opponent = [ Guerrier ( " Guerrier " , 80 , 45 ) , Voleur ( " Voleur " , 80 , 45 ) , Magicien ( " Magicien " , 80 , 45 ) , Elf e( " Elfe " , 80 , 45 ) ]
self . opponent = [ Personnage ( " Guerrier " , 80 , 45 , " guerrier " , 1 , True ) , Personnage ( " Voleur " , 80 , 45 , " voleur " , 1 , True ) , Personnage ( " Magicien " , 80 , 45 , " magicien " , 1 , True ) , Personnag e( " Elfe " , 80 , 45 , " elfe " , 1 , True ) ]
self . title = """ ██ ███████ ██ ██ ██████ ███████ ██████ ██████ ██ ███████
self . title = """ ██ ███████ ██ ██ ██████ ███████ ██████ ██████ ██ ███████
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
@ -252,14 +241,14 @@ class App:
gui . draw ( ' ' . join ( [ ' + ' + ' ' . join ( [ ' - ' for j in range ( 29 ) ] ) for k in range ( 4 ) ] ) , 0 , 1 + i )
gui . draw ( ' ' . join ( [ ' + ' + ' ' . join ( [ ' - ' for j in range ( 29 ) ] ) for k in range ( 4 ) ] ) , 0 , 1 + i )
else :
else :
gui . draw ( ' ' . join ( [ ' | ' + ' ' . join ( [ ' ' for j in range ( 29 ) ] ) for k in range ( 4 ) ] ) , 0 , 1 + i )
gui . draw ( ' ' . join ( [ ' | ' + ' ' . join ( [ ' ' for j in range ( 29 ) ] ) for k in range ( 4 ) ] ) , 0 , 1 + i )
for j in range ( self . character . inv . count ( ' potion' ) ) :
for j in range ( self . character . potion ) :
x = j % 4
x = j % 4
y = j / / 4
y = j / / 4
if [ x , y ] == position :
if [ x , y ] == position :
color_fill = ' YELLOW '
color_fill = ' YELLOW '
else :
else :
color_fill = ' WHITE '
color_fill = ' WHITE '
gui . draw ( ' Eau de vie ' , 30 * x + 10 , 17 * y + 2 , color = color_fill )
gui . draw ( ' Cidre fermier ' , 30 * x + 10 , 17 * y + 2 , color = color_fill )
for i in range ( len ( self . potion_shape ) ) :
for i in range ( len ( self . potion_shape ) ) :
gui . draw ( self . potion_shape [ i ] , 30 * x + 6 , 17 * y + 3 + i , color = color_fill )
gui . draw ( self . potion_shape [ i ] , 30 * x + 6 , 17 * y + 3 + i , color = color_fill )
gui . display ( )
gui . display ( )
@ -274,15 +263,16 @@ class App:
if self . opponent [ ennemi ] . pdv < = 0 :
if self . opponent [ ennemi ] . pdv < = 0 :
self . opponent [ ennemi ] . move ( 40 , 0 , 4 )
self . opponent [ ennemi ] . move ( 40 , 0 , 4 )
self . character . change_xp ( 1 )
self . character . change_xp ( 1 )
self . character . max_pdv + = 5
self . character . change_max_pdv ( self . character . max_pdv + 5 )
self . character . change_pdv ( round ( self . character . max_pdv * 0.2 ) )
self . character . change_pdv ( round ( self . character . max_pdv * 0.2 ) )
if random . randint ( 0 , 5 ) == 0 :
if random . randint ( 0 , 5 ) == 0 :
self . character . inv . append ( ' potion ' )
self . character . add_potion ( )
ennemi = random . randint ( 0 , 3 )
ennemi = random . randint ( 0 , 3 )
self . opponent [ ennemi ] . __init__ ( self . opponent [ ennemi ] . nom , 120 , 5 , random . randint ( 1 , self . character . xp + 1 ) )
cat = [ ' guerrier ' , ' elfe ' , ' magicien ' , ' voleur ' ]
self . opponent [ ennemi ] . max_pdv = 20 + 5 * ( self . opponent [ ennemi ] . xp - 1 )
self . opponent [ ennemi ] . __init__ ( self . opponent [ ennemi ] . nom , 120 , 5 , cat [ ennemi ] , random . randint ( max ( 1 , self . character . xp - 2 ) , self . character . xp + 1 , True ) )
self . opponent [ ennemi ] . pdv = self . opponent [ ennemi ] . max_pdv
self . opponent [ ennemi ] . change_max_pdv ( 20 + 5 * ( self . opponent [ ennemi ] . xp - 1 ) )
self . opponent [ ennemi ] . change_pdv ( self . opponent [ ennemi ] . max_pdv - self . opponent [ ennemi ] . pdv )
self . opponent [ ennemi ] . move ( - 40 , 0 , 4 )
self . opponent [ ennemi ] . move ( - 40 , 0 , 4 )
return ennemi
return ennemi
else :
else :
@ -299,15 +289,15 @@ class App:
if self . opponent [ ennemi ] . pdv < = 0 :
if self . opponent [ ennemi ] . pdv < = 0 :
self . opponent [ ennemi ] . move ( 40 , 0 , 4 )
self . opponent [ ennemi ] . move ( 40 , 0 , 4 )
self . character . change_xp ( 1 )
self . character . change_xp ( 1 )
self . character . max_pdv + = 5
self . character . change_max_pdv ( self . character . max_pdv + 5 )
self . character . change_pdv ( round ( self . character . max_pdv * 0.2 ) )
self . character . change_pdv ( round ( self . character . max_pdv * 0.2 ) )
if random . randint ( 0 , 5 ) == 0 :
if random . randint ( 0 , 5 ) == 0 :
self . character . inv . append ( ' potion ' )
self . character . add_potion ( )
ennemi = random . randint ( 0 , 3 )
ennemi = random . randint ( 0 , 3 )
self . opponent [ ennemi ] . __init__ ( self . opponent [ ennemi ] . nom , 120 , 5 , random . randint ( 1 , self . character . xp + 1 ) )
self . opponent [ ennemi ] . __init__ ( self . opponent [ ennemi ] . nom , 120 , 5 , random . randint ( max ( self . character . xp - 3 , 1 ) , self . character . xp + 1 ) , True )
self . opponent [ ennemi ] . max_pdv = 20 + 5 * ( self . opponent [ ennemi ] . xp - 1 )
self . opponent [ ennemi ] . change_max_pdv ( 20 + 5 * ( self . opponent [ ennemi ] . xp - 1 ) )
self . opponent [ ennemi ] . pdv = self . opponent [ ennemi ] . max_pdv
self . opponent [ ennemi ] . change_ pdv( self . opponent [ ennemi ] . max_pdv - self . opponent [ ennemi ] . max_pdv )
self . opponent [ ennemi ] . move ( - 40 , 0 , 4 )
self . opponent [ ennemi ] . move ( - 40 , 0 , 4 )
return ennemi
return ennemi
else :
else :
@ -323,6 +313,9 @@ class App:
self . character . move ( - 40 , 0 , 4 , color = ' BLUE ' )
self . character . move ( - 40 , 0 , 4 , color = ' BLUE ' )
ennemi = random . randint ( 0 , 3 )
ennemi = random . randint ( 0 , 3 )
self . opponent [ ennemi ] . xp = random . randint ( max ( 1 , self . character . xp - 3 ) , self . character . xp + 1 )
self . opponent [ ennemi ] . change_max_pdv ( 20 + 5 * ( self . opponent [ ennemi ] . xp - 1 ) )
self . opponent [ ennemi ] . pdv = self . opponent [ ennemi ] . max_pdv
self . opponent [ ennemi ] . move ( 0 , - 40 , 4 , color = ' GREEN ' )
self . opponent [ ennemi ] . move ( 0 , - 40 , 4 , color = ' GREEN ' )
choice = 0
choice = 0
@ -362,11 +355,11 @@ class App:
if position [ 0 ] > 0 :
if position [ 0 ] > 0 :
position [ 0 ] - = 1
position [ 0 ] - = 1
elif key == getkey . keys . ENTER :
elif key == getkey . keys . ENTER :
if self . character . inv . count ( ' potion' ) > 0 :
if self . character . potion > 0 :
self . character . pdv + = round ( ( self . character . max_pdv - self . character . pdv ) * 0.5 )
self . character . change_pdv ( round ( ( self . character . max_pdv - self . character . pdv ) * 0.5 ) )
if self . character . pdv > self . character . max_pdv :
if self . character . pdv > self . character . max_pdv :
self . character . pdv = self . character . max_ pdv
self . character . change_ pdv( self . character . max_pdv - self . character . pdv )
self . character . inv . remove ( ' potion ' )
self . character . remove_potion ( )
elif key == getkey . keys . ESCAPE :
elif key == getkey . keys . ESCAPE :
break
break
if choice == 2 :
if choice == 2 :
@ -377,6 +370,14 @@ class App:
gui . wipe ( )
gui . wipe ( )
#suppression du joueur de la bdd
conn = sqlite3 . connect ( ' bdd.db ' )
c = conn . cursor ( )
c . execute ( " DELETE FROM Personnage where name=? " , ( self . character . nom , ) )
conn . commit ( )
c . close ( )
game_over = """
game_over = """
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
@ -394,7 +395,7 @@ class App:
def setting ( self , name , number_char ) :
def setting ( self , name , number_char ) :
""" permet de choisir son type de personnage """
""" permet de choisir son type de personnage """
gui . wipe ( )
gui . wipe ( )
characters = [ Guerrier ( name , 0 , 5 ) , Voleur ( name , 0 , 5 ) , Magicien ( name , 0 , 5 ) , Elf e( name , 0 , 5 ) ]
characters = [ Personnage ( name , 0 , 5 , " guerrier " , 1 , True ) , Personnage ( name , 0 , 5 , " voleur " , 1 , True ) , Personnage ( name , 0 , 5 , " magicien " , 1 , True ) , Personnag e( name , 0 , 5 , " elfe " , 1 , True ) ]
for char in characters :
for char in characters :
char . x = 60 - len ( char . shape [ 0 ] . split ( ' \n ' ) [ 0 ] ) / / 2
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 ) ) :
@ -418,7 +419,8 @@ class App:
self . setting ( name , ( number_char - 1 ) % 4 )
self . setting ( name , ( number_char - 1 ) % 4 )
break
break
elif key == getkey . keys . ENTER :
elif key == getkey . keys . ENTER :
self . character = characters [ number_char ]
self . character = Personnage ( name , 0 , 5 , [ ' guerrier ' , ' voleur ' , ' magicien ' , ' elfe ' ] [ number_char ] )
self . character . x = 60 - len ( self . character . shape [ 0 ] . split ( ' \n ' ) [ 0 ] ) / / 2
del characters
del characters
self . play ( )
self . play ( )
break
break
@ -433,13 +435,20 @@ class App:
gui . draw ( ' < ' , 76 , 30 , color = ' RED ' )
gui . draw ( ' < ' , 76 , 30 , color = ' RED ' )
gui . display ( )
gui . display ( )
name = input ( ' => ' )
name = input ( ' => ' )
self . setting ( name , 0 )
# test si le joueur à déjà joué
conn = sqlite3 . connect ( " bdd.db " )
# app = App()
c = conn . cursor ( )
# gui = cli.Cli(width=app.width, height=app.height)
c . execute ( " SELECT * from Personnage join Categorie on Personnage.categorie=Categorie.name join Profil on Categorie.profil=Profil.name where Personnage.name = ? " , ( name , ) )
data = c . fetchone ( )
# app.menu()
c . close ( )
if data is None :
self . setting ( name , 0 )
else :
self . character = Personnage ( name , 0 , 5 , data [ 4 ] )
self . character . x = 60 - len ( self . character . shape [ 0 ] . split ( ' \n ' ) [ 0 ] ) / / 2
self . play ( )
# # guerrier.move(-10, 0)
app = App ( )
gui = cli . Cli ( width = app . width , height = app . height )
Personnage ( ' Georges ' , 0 , 0 , " guerrier " , 1 )
app . menu ( )