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)