def SelectHeroes(): nHeroes=cm.GetInt("How many players are there? (Max 4)",1,4) allowedHeroes=['Harry','Hermione','Ron','Neville','Random'] selectedHeroes=[] for i in range(nHeroes): message="Select a hero from: " for x in allowedHeroes: message+=x+" " message+="\n" while True: txt=input(message) if txt in allowedHeroes: if txt=='Random': txt=allowedHeroes[randint(0,len(allowedHeroes)-2)] print("You got",txt) selectedHeroes.append(Hero(txt,False)) allowedHeroes.remove(txt) break else: print("Not a valid option!!") return selectedHeroes
def NewGame(self): #Select Level self.Level = cm.GetInt("Select Level", 1, 1) #Select Heroes: self.Heroes = Hero.SelectHeroes() #Build Locations self.LocationDeck = Locations.BuildLocations(self.Level, False) self.CurrentLocation = self.LocationDeck[0] #Build Dark Arts self.DarkArtsDeck = DarkArts.BuildDarkArts(self.Level, False) #Build Villains self.VillainDeck, self.NVillains = Villains.BuildVillainDeck( self.Level, False) self.CurrentVillains = self.VillainDeck[0:self.NVillains] self.CurrentVillainsNames = [ i.Name for i in self.VillainDeck[0:self.NVillains] ] #Build Buy Deck self.BuyDeck = Card.BuildBuyDeck(self.Level, False)