From 72c55d8f84bcf4254371a05571d1e8586aa37fdf Mon Sep 17 00:00:00 2001 From: DA SILVA Ethan Date: Mon, 11 Dec 2023 08:32:29 +0100 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'jdr.py'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jdr.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/jdr.py b/jdr.py index cd45b02..9f65cd6 100644 --- a/jdr.py +++ b/jdr.py @@ -23,7 +23,31 @@ class Personnage: self.inventaire = ["Dagues", "Potion de camouflage"] 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)