def display(self): u.clear() u.pheader() around = int((74 - len(self.name)) / 2) * ' ' if len(self.name) % 2: name = self.name + ' ' else: name = self.name print(' ║ ' + around + name + around + ' ║ ') u.phr() portrait = [(3, 2), u.gf('draw/races/' + self.__class__.__name__.lower())] characteristics = [(40, 2), u.gf("draw/skills").format(u.az(self.life), u.az(self.stamina), u.az(self.magic), u.az(self.attack), u.az(self.defense), u.az(self.strength), u.az(self.armour), u.az(self.intelligence), u.az(self.archery), u.az(self.invocation), u.az(self.defense), u.az(self.potion), u.az(self.heal))] u.pbody(u.ptiles(portrait, characteristics, dx=74, dy=30)) u.pfooter() input()
def displayQuests(self): u.clear() u.pheader() u.pbody(" Journal des quêtes :") u.phr() for q in self.perso.getQuests(): u.pbody(repr(q)) u.pfooter() input()
def displayHelp(self): u.clear() u.pheader() u.pbody(" Aide du jeu :") u.phr() u.pbody("Raccourcis :") u.pbody("? : afficher cette aide mais vous l'aurez compris") u.pbody("M : ouvrir le menu principal") u.pbody("C : ouvrir la carte") u.pbody("P : voir le personnage") u.pbody("J : consulter le journal des quêtes") u.pfooter() input()
def loopActs(self, act): while "invalid choice": acts = Acts.acts(self) u.clear() for i, scenario in enumerate(acts[act][0]): # Loop act texts txt = scenario[0] fmt = scenario[1] if fmt: u.pheader() u.pbody(txt) else: print(txt) if i == len(acts[act][0]): # last text in act if fmt: u.pbody() else: if fmt: u.pfooter() input() if acts[act][1][0][0] is not None: # Act has questions act = self.handleChoice(acts, act) else: act = acts[act][1][0][1]
def display(self): u.clear() u.pheader() u.pbody("Menu principal") u.phr() for c in self.choices: u.pbody(c) u.pfooter() c = input() if c == "3" or c == "C": self.displayMap() elif c == "2" or c == "S": print("sauvegarder") elif c == "1" or c == "J": self.displayQuests() elif c == "2" or c == "P": self.perso.display() elif c == "5" or c == "?": self.displayHelp() elif c == "6" or c == "Q": self.quit()
def handleChoice(self, acts, act): u.pheader() for i, interaction in enumerate(acts[act][1]): u.pbody("[%d] %s" % (i + 1, interaction[0])) choice = u.pinput() if choice == "M": self.displayMenu() elif choice == "C": self.menu.displayMap() elif choice == "J": self.menu.displayQuests() elif choice == "P": self.perso.display() elif choice == "?": self.menu.displayHelp() try: choice = int(choice) except: return act if choice in range(1, len(acts[act][1]) + 1): self.update(choice, act) act = acts[act][1][choice - 1][1] return act