def optionsScreen(data): while True: print(screenTop) title = "OPTIONS" printWithScreenSidesAndSpacing(title + getExtraSpace(title, 52)) optionsLines = [] count = 1 allSettings = data.settings.settings.copy() allSettings.append("Back") for setting in allSettings: if setting == "Back": toggleText = "" elif data.settings.settingsDict[setting] == True: toggleText = "Enabled" else: toggleText = "Disabled" settingText = str(count) + ' - ' + setting lineText = settingText + getExtraSpace(settingText, 20) + getExtraSpace(toggleText, 10) + toggleText printWithScreenSidesAndSpacing(lineText + getExtraSpace(lineText, 52)) count += 1 for _ in range(18 - count): print(screenEmp) print(screenMid) onlyTextBox("Which option would you like to toggle?") option = getOption(allSettings) if option == "Back": return else: toggleSetting(data, option) checkChecks(data)
def getMoveLearnReplace(data, pokemon, newMove, name): moveSet = pokemon.moveSet.copy() moveSet.append(newMove) moveToForget = "None" while moveToForget == "None": drawScreen(data) onlyTextBoxWithOptions( "Which move to forget? 5 - Don't learn " + newMove, pokemon.moveSet) moveToForget = getOption(moveSet, backWithE=False) if moveToForget == newMove: drawScreen(data) onlyTextBox(name + " did not learn " + newMove + "!", pauseAfter=True) else: drawScreen(data) onlyTextBox(name + " forgot " + moveToForget + " and learnt " + newMove + "!", pauseAfter=True) index = pokemon.moveSet.index(moveToForget) pokemon.moveSet[index] = newMove newPP = getOneMaxPP(newMove) pokemon.movePPMax[index] = newPP pokemon.movePPCurrent[index] = newPP
def gameModeScreen(): while True: print(screenTop) print(screenEmp) title = "GAME MODE" printWithScreenSidesAndSpacing(title + getExtraSpace(title, 52)) print(screenEmp) optionsLines = [] count = 1 allGameModes = ["Main Game: New Save","Main Game: Continue","Battle Trainer","Battle E4 with random team"] for gameMode in allGameModes: gameModeText = str(count) + ' - ' + gameMode printWithScreenSidesAndSpacing(gameModeText + getExtraSpace(gameModeText, 52)) count += 1 for _ in range(15 - count): print(screenEmp) print(screenMid) onlyTextBox("Which game mode would you like to play?") option = getOption(allGameModes) if option == "Main Game: New Save": topLevelNewMainGame() elif option == "Main Game: Continue": topLevelContinueMainGame() elif option == "Battle Trainer": topLevelBattleTrainer() elif option == "Battle E4 with random team": topLevelE4()
def openPokemonSelectionScreen( data, pokemonChosen=None, battle=False, selectionText="Which Pokemon would you like to select?", useOrGiveItem=False): if battle == True: team = data.player.team else: team = data.player.defaultTeam while True: pokemonData = [] for placeInParty in range(1, 7): if placeInParty <= len(team): pokemonData.append( compilePokemonData(team[placeInParty - 1], placeInParty)) else: pokemonData.append(drawEmptyPokemonScreen(placeInParty)) drawMainSelectionScreen(pokemonData) if pokemonChosen == None: pokemonChosen = choosePokemon(data, team, selectionText) if pokemonChosen == "Back": return "Back" if useOrGiveItem == True: return pokemonChosen else: onlyTextBoxWithOptions( "What would you like to do with " + pokemonChosen.name + "?", ["More Info", "Switch", "Use Item", "Back"]) option = getOption(["More Info", "Switch", "Use Item", "Back"]) if option == "More Info": moreInfoScreen(data, team, pokemonChosen) pokemonChosen = None elif option == "Switch": if battle == True: switchOutcome = getSwitchBattle(data, pokemonChosen) if switchOutcome == True: return True else: selectionText = switchOutcome pokemonChosen = None else: drawMainSelectionScreen(pokemonData) switchSelectionText = "Which Pokemon should you switch " + pokemonChosen.name + " with?" secondPokemon = choosePokemon(data, team, switchSelectionText) if secondPokemon != pokemonChosen and secondPokemon != "Back": index1 = team.index(pokemonChosen) index2 = team.index(secondPokemon) team[index1] = secondPokemon team[index2] = pokemonChosen pokemonChosen = None elif option == "Use Item": print("Item time") elif option == "Back": pokemonChosen = None
def chooseFromMenu(data): while True: choices = "Pokedex", "Pokemon", "Bag", "Player", "Save", "Options", "Exit" choice = getOption( ["Pokedex", "Pokemon", "Bag", "Player", "Save", "Options", "Exit"]) if choice == "Pokedex": print("Pokedex") worldText(data, "Sorry, this is not yet available!", menu=True, response=True) elif choice == "Pokemon": if data.story.startPokemonChosen or data.settings.settingsDict[ "WallClip"]: openPokemonSelectionScreen(data) drawOverworld(data, data.player.xCo, data.player.yCo, data.environment.location.map, text=False, menu=True) else: worldText(data, "You do not have any Pokemon yet!", menu=True, response=True) elif choice == "Bag": openBag(data) drawOverworld(data, data.player.xCo, data.player.yCo, data.environment.location.map, text=False, menu=True) elif choice == "Player": print("Player") worldText(data, "Sorry, this is not yet available!", menu=True, response=True) elif choice == "Save": saveGame(data) worldText(data, "Your game has been saved successfully!", menu=True, response=True) elif choice == "Options": optionsScreen(data) drawOverworld(data, data.player.xCo, data.player.yCo, data.environment.location.map, text=False, menu=True) elif choice == "Exit" or choice == "Back": print("Exit") return "Exit"
def getNamePokemon(data, pokemon, battle=True): if battle == False: choice = worldTextOptions(data, 'Would you like to name the ' + pokemon.name + '?', options=["Yes", "No"], response=True) else: drawScreen(data) onlyTextBoxWithOptions('Would you like to name the ' + pokemon.name + '?', options=["Yes", "No"]) choice = getOption(["Yes", "No"]) if choice == "Yes": if battle == False: worldText(data, "What would you like to name it?", response=True) else: drawScreen(data) onlyTextBox("What would you like to name it?") while True: choiceInput = input('-- ') if len(choiceInput) <= 10: if choiceInput == "": pokemon.name = pokemon.species return pokemon.name = choiceInput return else: print('That name is too long! 10 characters max!') #┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ #┃ │ a ╭╮ ╭╮ c ╭╮ d │ ┃ #┃ │ ITEMS ││ b ││ KEY ITEMS ││ BALLS │ ┃ #┃ ╰───────────╯│ HEALING │╰───────────╯╰───────────╯ ┃ #┃ ╰───────────╯ ┃ #┃ │ ┃ #┃ │ ┃ #┃ │ ┃ #┃ │ ┃ #┃ │ ┃ #┃ │ ┃ #┃ │ ┃ #┃ │ ┃ #┃ │ ┃ #┃ │ ┃ #┃ │ ┃ #┃ │ ┃ #┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ #┃ Which item would you like to choose? ┃ #┃ ┃ #┃ ┃ #┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
def worldTextOptions(data, *therest, options, menu=False, response=False): drawOverworld(data, data.player.xCo, data.player.yCo, data.environment.location.map, text=True, menu=menu) string = turnIntoOneString(therest) onlyTextBoxWithOptions(string, options) option = getOption(options) if response == False: input() return option
def moreInfoScreen(data, team, pokemon): print(screenTop) lineText = " " + pokemon.name printWithScreenSides(lineText + getExtraSpace(lineText, 26) + "│" + pokemon.sprite[0]) lineText = (" Level " + str(pokemon.level) + " " + pokemon.species) printWithScreenSides(lineText + getExtraSpace(lineText, 26) + "│" + pokemon.sprite[1]) lineText = "─[HEALTH]─────────────────│" printWithScreenSides(lineText + pokemon.sprite[2]) lineText = " " + str(pokemon.hp) + "/" + str( pokemon.maxhp) + " - " + getPokemonStatusText(pokemon) printWithScreenSides(lineText + getExtraSpace(lineText, 26) + "│" + pokemon.sprite[3]) lineText = " (" + drawBar(pokemon.hp, pokemon.maxhp, 20) + ") " printWithScreenSides(lineText + "│" + pokemon.sprite[4]) lineText = "─[EXP]────────────────────│" printWithScreenSides(lineText + pokemon.sprite[5]) lineText = " " + str(pokemon.exp) + " - " + getExpToNextLevel(pokemon) printWithScreenSides(lineText + getExtraSpace(lineText, 26) + "│" + pokemon.sprite[6]) lineText = " [" + drawBar(pokemon.exp - pokemon.lastLevelExp, pokemon.nextLevelExp - pokemon.lastLevelExp, 20, "-", finalBarDifferent=True) + "] " printWithScreenSides(lineText + "│" + pokemon.sprite[7]) lineText = "─[STATS]──────────────────│" printWithScreenSides(lineText + pokemon.sprite[8]) statText = [] emptyText = [] stats = [" HP", " Atk", " Def", " SpA", " SpD", " Spd"] for i in range(6): line = stats[i] + ": " + str(pokemon.stats[i]) statText.append(line) emptyText.append(getExtraSpace(line, 13)) printWithScreenSides(statText[0] + emptyText[0] + statText[3] + emptyText[3] + "│" + pokemon.sprite[9]) printWithScreenSides(statText[1] + emptyText[1] + statText[4] + emptyText[4] + "│" + pokemon.sprite[10]) printWithScreenSides(statText[2] + emptyText[2] + statText[5] + emptyText[5] + "│" + pokemon.sprite[11]) lineText = "─[MOVES]──────────────────│" printWithScreenSides(lineText + pokemon.sprite[12]) moveText = [] for i in range(4): if len(pokemon.moveSet) > i: movePPText = str(pokemon.movePPCurrent[i]) + "/" + str( pokemon.movePPMax[i]) + "PP" moveText.append(" " + pokemon.moveSet[i] + getExtraSpace(pokemon.moveSet[i], 15) + getExtraSpace(movePPText, 9) + movePPText) else: moveText.append(" ") printWithScreenSides(moveText[0] + " ╰──[OTHER]──────────────────") lineText = "Nature: " + pokemon.nature printWithScreenSides(moveText[1] + " │ " + lineText + getExtraSpace(lineText, 25)) lineText = "Ability: " + pokemon.ability printWithScreenSides(moveText[2] + " │ " + lineText + getExtraSpace(lineText, 25)) lineText = "Item: " + pokemon.item.name printWithScreenSides(moveText[3] + " │ " + lineText + getExtraSpace(lineText, 25)) print(screenMid) options = [ "View previous Pokemon", "View next Pokemon", "Use Item", "Back" ] onlyTextBoxWithOptions( "What would you like to do with " + pokemon.name + "?", options) option = getOption(options) if option == "View previous Pokemon": moreInfoScreen( data, team, returnNextOrPreviousInParty(data, team, pokemon, next=False)) return elif option == "View next Pokemon": moreInfoScreen( data, team, returnNextOrPreviousInParty(data, team, pokemon, next=True)) return elif option == "Use Item": print("Item time") elif option == "Back": return input("-- ")
def choosePokemon(data, team, selectionText): onlyTextBoxWithOptions(selectionText, [], backWithE=True) option = getOption(team) return option
def openBag(data, selectionText="Which item would you like to use?", battle=False, itemChosen=None, showOptions=True): itemDropped = False while True: print(screenTop) drawBagTabs(data) count = 1 for item in data.bag.openBag: itemText = str(count) + ' - ' + item.name + getExtraSpace( item.name, 20) + "x" + str(item.quantity) printWithScreenSidesAndSpacing(itemText + getExtraSpace(itemText, 52)) count += 1 for _ in range(14 - count): print(screenEmp) print(screenMid) if itemChosen == None: onlyTextBoxWithOptions(selectionText, [], backWithE=True) tabOptions = ["a", "b", "c", "d", "e"] allOptions = data.bag.openBag + tabOptions option = getOption(allOptions) if option == "Back": return "None" if option in tabOptions: switchTab(data, option) elif option in data.bag.openBag: print("You chose " + option.name) itemChosen = option else: itemOptions = ["Use Item", "Give Item", "Drop Item", "Back"] if showOptions == False: onlyTextBox(selectionText, pauseAfter=True) if itemChosen not in data.bag.openBag: itemChosen = None showOptions = True selectionText = "Which item would you like to use? e to exit." else: onlyTextBoxWithOptions( "What would you like to do with the " + itemChosen.name + "?", itemOptions) option = getOption(itemOptions) if option == "Use Item": if item.type == "Ball" and battle == False: openBag(data, "You can't use that right now!", battle=battle, itemChosen=itemChosen, showOptions=False) return if item.type == "Healing" and data.story.startPokemonChosen == False: openBag(data, "You don't have any Pokemon yet!", battle=battle, itemChosen=itemChosen, showOptions=False) return used = useItem(data, itemChosen, battle) if used == False: itemChosen = None else: if battle == True: return used elif option == "Give Item": if data.story.startPokemonChosen == False: openBag(data, "You don't have any Pokemon yet!", battle=battle, itemChosen=itemChosen, showOptions=False) return if battle == True: outcome = openBag( data, "You can't give that during a battle!", battle=battle, itemChosen=itemChosen, showOptions=False) return outcome giveItem(data, itemChosen) return elif option == "Drop Item": if battle == True: outcome = openBag( data, "You can't drop that during a battle!", battle=battle, itemChosen=itemChosen, showOptions=False) return outcome dropItem(data, itemChosen) outcome = openBag(data, "You dropped 1 " + itemChosen.name + "!", battle=battle, itemChosen=itemChosen, showOptions=False) return outcome else: itemChosen = None