''' Created on 24 de sept. de 2015 @author: Micosil ''' from Game.CommandFactory import CommandFactory from Interfacer.Savvy import Savvy cf = CommandFactory() command1 = cf.create("newPlayer", ["Player", "Warrior"]) command2 = cf.create("doNothing", ["potato", "bagel"]) commandList = [command1, command2] sv = Savvy() sv.saveCommand(commandList) commandList2 = sv.loadCommand() print(commandList2)
if savvy.isMidFight(): texty.showPlayer("Do you want to resume the fight?") read = texty.readOneKeyFromPlayer() if read == "y": cf.load() flagLoadedMidfight = True if not flagLoadedMidfight: texty.showPlayer("Do you want to load a game?") read = texty.readOneKeyFromPlayer() if read == "y": texty.showPlayer("Please write the name of the player") read = texty.readOneKeyFromPlayer() playerchar = savvy.loadPickle(read) else: playerchar = cf.create("newPlayer", ["Player", "Warrior"]) playerchar = cf.getNextCommand().execute() while playGame: if cf.needsInput(): enemy = analysisPhase(playerchar) combat = cf.create("fight", [playerchar, enemy]) wonCombat, playerchar = cf.getNextCommand().execute() if not wonCombat: texty.showPlayer("You lose! Play again?") playerchar = Player.Player("Player", "test") else: texty.showPlayer("You win! Save and quit?")