|
|
@ -24,6 +24,30 @@ class Personnage: |
|
|
|
self.coefAtk = 9 |
|
|
|
self.coefDef = 5 |
|
|
|
|
|
|
|
def table_personnages(): |
|
|
|
conn = sqlite3.connect('personnages.db') |
|
|
|
c = conn.cursor() |
|
|
|
|
|
|
|
c.execute('''CREATE TABLE IF NOT EXISTS personnages |
|
|
|
(nom TEXT, pdv INTEGER, exp INTEGER, cat TEXT, inventaire TEXT, coefAtk INTEGER, coefDef INTEGER)''') |
|
|
|
conn.commit() |
|
|
|
conn.close() |
|
|
|
|
|
|
|
|
|
|
|
def ajouter_personnage(personnage): |
|
|
|
conn = sqlite3.connect('personnages.db') |
|
|
|
c = conn.cursor() |
|
|
|
|
|
|
|
c.execute("INSERT INTO personnages VALUES (?, ?, ?, ?, ?, ?, ?)", |
|
|
|
(personnages.nom, personnages.pdv, personnages.exp, personnages.cat, personnages.coefAtk, personnages coefDef ', '.join(personnage.inventaire))) |
|
|
|
|
|
|
|
conn.commit() |
|
|
|
conn.close() |
|
|
|
|
|
|
|
|
|
|
|
table_personnages() |
|
|
|
|
|
|
|
|
|
|
|
def jet_attaque(self): |
|
|
|
"""renvoie jet d'attaque""" |
|
|
|
atkPoints = randint(1, 20) |
|
|
|