def titleMenu(): global debug print ("\n" "\n\t Adventures of Grogg?" "\n\tWelcome to the greatest text-based" "\n\t adventure you have ever played." "\n\n") print (" 1. Start\n" " 2. Options\n" " 3. Exit\n\n") startSelected = False while not startSelected: choice = input(prompt) if choice.lower() in ("start", "s", "1"): startSelected = True elif choice.lower() in ("options", "o", "2"): optionsMenu() elif choice.lower() in ("exit", "e", "3"): con.clear_color() con.clear_screen() exit() elif choice.lower() == "debug": debug = True debugMsg("Debug messages enabled") else: print("\nThats not an option!\n") con.clear_screen()
def classSelect(name): valid = False while not valid: print (" Choose your path, %s!\n") % name print (" 1. Warrior\n" " 2. Knight\n" " 3. Royalty\n" " 4. Mage\n" " 5. Thief\n" " 6. Hunter\n\n") choice = input(prompt) if choice.lower() in ("warrior", "w", "1"): attr, gear = warriorAttr() valid = True elif choice.lower() in ("knight", "k", "2"): attr, gear = knightAttr() valid = True elif choice.lower() in ("royalty", "r", "3"): attr, gear = royaltyAttr() valid = True elif choice.lower() in ("mage", "m", "4"): attr, gear = mageAttr() valid = True elif choice.lower() in ("thief", "t", "5"): attr, gear = thiefAttr() valid = True elif choice.lower() in ("hunter", "h", "6"): attr, gear = hunterAttr() valid = True con.clear_screen() return attr, gear
def playGame(): player.spawnRandom() quitToMenu = False # Eventually add pause/quit feature while not quitToMenu: con.clear_screen() drawStatWindow() drawMap() drawGuideWindow() moveChar()
def create_game(): global game num_players = c.request_num_players() num_cards_each = c.request_num_cards_each() player_names = [] for i in range(num_players): player_name = c.request_player_name(i) player_names.append(player_name) game = Game(num_players, num_cards_each, player_names) game.deal() c.clear_screen() c.show_game(game) c.wait_user()
def openingStory(): print ("\n" "\n\t Adventures of Grogg?\n" "\n\t Eventually, there will be a short" "\n\tintroductory narrative here. For now," "\n\tyou'll just have to do without.\n" "\n\t No, no. Please don't cry. It won't" "\n\tbe too long - we promise! I know you" "\n\tcan't wait.\n" "\n\t ....." "\n\t" "\n\t") pause() con.clear_screen()
def optionsMenu(): con.clear_screen() print ("\n" "\n\t Options Menu!" "\n\n") print (" 1. Change default prompt (%s)\n") % prompt print (" 2. ...\n") print (" 3. Back to Main Menu\n\n") pause() # Temporary # TODO: # - Flesh out options # - If DEBUG, have options to change things # like battle constants. Options for all # the things! con.clear_screen()
def swap_cards(): global game for player in game.players: c.clear_screen() c.show_player_swap(player) swap = c.request_swap(player.name) while swap: c.clear_screen() c.show_player_swap(player) hCard = c.request_hand_swap() - 1 fCard = c.request_faceup_swap() - 1 player.swap(hCard, fCard) c.clear_screen() c.show_player_swap(player) swap = c.request_swap_more()
def welcome(): c.clear_screen() c.welcome()
def first_move(): global game game.first_move() c.clear_screen() c.show_game(game) c.line()
def continue_main_game(): global game c.clear_screen() c.show_game(game) c.line() main_game()
def allocStats(attr, name): points = 10 pvit = attr["vit"] pend = attr["end"] pint = attr["int"] pstr = attr["str"] pdex = attr["dex"] pmag = attr["mag"] pfth = attr["fth"] plck = attr["lck"] skillsMsg = ( 'Do you have any specific training?\n\n' ' This is where you can give your\n' 'character a name and allocate any\n' 'skill points you have. You start with\n' 'a total of 10 points to allocate to\n' 'any attributes you see fit.\n\n') skillValues = ( ' Name: %s\n\n' '1. Vitality ...... %d\n' '2. Intelligence .. %d\n' '3. Endurance ..... %d\n' '4. Strength ...... %d\n' '5. Dexterity ..... %d\n' '6. Magicka ....... %d\n' '7. Faith ......... %d\n' '8. Luck .......... %d\n\n' ' Points: %d\n\n') skillChoices = { 'vitality': ["vitality", "vit", "v", "1"], 'intelligence': ["intelligence", "int", "i", "2"], 'endurance': ["endurance", "end", "e", "3"], 'strength': ["strength", "str", "s", "4"], 'dexterity': ["dexterity", "dex", "d", "5"], 'magicka': ["magicka", "mag", "m", "6"], 'faith': ["faith", "fth", "fai", "f", "7"], 'luck': ["luck", "lck", "luc", "l", "8"]} print (skillsMsg) pause() charMenu = True while charMenu: con.clear_screen() print (skillValues) % ( name, pvit, pend, pint, pstr, pdex, pmag, pfth, plck, points) print ("1. Spend Points\n" "2. Remove Points\n" "3. Done!\n\n") choice = input(prompt) if choice.lower() in ("spend", "s", "1"): con.clear_screen() print (skillValues) % ( name, pvit, pend, pint, pstr, pdex, pmag, pfth, plck, points) statChoice = input(prompt) if statChoice in skillChoices['vitality']: points, pvit = changePoints(points, pvit, 'add') elif statChoice in skillChoices['intelligence']: points, pint = changePoints(points, pint, 'add') elif statChoice in skillChoices['endurance']: points, pend = changePoints(points, pend, 'add') elif statChoice in skillChoices['strength']: points, pstr = changePoints(points, pstr, 'add') elif statChoice in skillChoices['dexterity']: points, pdex = changePoints(points, pdex, 'add') elif statChoice in skillChoices['magicka']: points, pmag = changePoints(points, pmag, 'add') elif statChoice in skillChoices['faith']: points, pfth = changePoints(points, pfth, 'add') elif statChoice in skillChoices['luck']: points, plck = changePoints(points, plck, 'add') else: print("Invalid option.") pause() elif choice.lower() in ("remove", "rm", "r", "2"): con.clear_screen() print (skillValues) % ( name, pvit, pend, pint, pstr, pdex, pmag, pfth, plck, points) statChoice = input(prompt) if statChoice in skillChoices['vitality']: points, pvit = changePoints(points, pvit, 'remove') elif statChoice in skillChoices['intelligence']: points, pint = changePoints(points, pint, 'remove') elif statChoice in skillChoices['endurance']: points, pend = changePoints(points, pend, 'remove') elif statChoice in skillChoices['strength']: points, pstr = changePoints(points, pstr, 'remove') elif statChoice in skillChoices['dexterity']: points, pdex = changePoints(points, pdex, 'remove') elif statChoice in skillChoices['magicka']: points, pmag = changePoints(points, pmag, 'remove') elif statChoice in skillChoices['faith']: points, pfth = changePoints(points, pfth, 'remove') elif statChoice in skillChoices['luck']: points, plck = changePoints(points, plck, 'remove') else: print("Invalid option.") pause() elif choice.lower() in ("done", "d", "3"): charMenu = False else: print("Incorrect input") pause() con.clear_screen() attr["vit"] = pvit attr["end"] = pend attr["int"] = pint attr["str"] = pstr attr["dex"] = pdex attr["mag"] = pmag attr["fth"] = pfth attr["lck"] = plck return attr
def createName(): print (" What do you call yourself, adventurer?\n\n") name = input(prompt) con.clear_screen() return name
import os import platform import random import sys import time import console as con from player import * from classAttr import * from pycompat import * from mapData import * ############################ #### Set up environment #### con.set_text_color(con.darkgreen, con.black) con.clear_screen() ############################ ######## Constants ######### HP_BASE_MOD = 50 HP_MULT = 4.5 LUCK_MOD = 4.0 MISS_BASE = 10 MISS_MOD = 1 REROLL_MOD = .85 WPN_STAT_MOD = 800.0 ############################ ######### Globals ########## dirMap = {'w':[0,-1],'s':[0,1],'a':[-1,0],'d':[1,0]} prompt = ">>> " debug = False