def choicePhase(self, enemy): from Game.CommandFactory import CommandFactory cf = CommandFactory() if (cf.needsInput()): self.player.analyze() self.enemy.analyze() self.player.selectAction(enemy) action = cf.getNextCommand() out = action.execute() sorted(self.player.eventQueue, key=attrgetter('priority')) return out
''' 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 read == "y": texty.showPlayer("You approach the enemy and fight!") return enemy else: texty.showPlayer("You bravely flee from your foe!") # MAIN texty = Texty() texty.setUp("network") texty.getPlayerConnection() texty.showPlayer("Hello, and welcome to the Enrichment Center. The Device Has Been Modified.") playGame = True gameOverFlag = False cf = CommandFactory() savvy = Savvy() flagLoadedMidfight = False 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()