def main(): Screen.main_menu_screen() choice = input('\n\nSELECT A NUMBER:> ') if choice == '1': char_creation() elif choice == '2': print('NOT AN OPTION YET') ##-- LOADED AND SAVE --## time.sleep(2) main() elif choice == '3': print('NOT AN OPTION YET') ##-- Help --## time.sleep(2) main() elif choice == '4': ChangeLog.change_log_print() pause() main() elif choice == '5': sys.exit() else: print("Not an Option.") input("Press Enter to Continue:> ") main()
def main(): choice = None # Initializes variable while choice != '1': # Continues loop while choice is not to start the game - will change later Screen.main_menu_screen() choice = input('\n\nSELECT A NUMBER:> ') if choice == '1': # Starts Game main_game_loop(char_creation(), opening=True) elif choice == '2': # LOADED AND SAVE print('NOT AN OPTION YET') time.sleep(2) elif choice == '3': # Help print('NOT AN OPTION YET') time.sleep(2) elif choice == '4': ChangeLog.change_log_print() pause() elif choice == '5': sys.exit() else: print("Not an Option.") pause()
def intro_story(name): intro = f"\tThere was smoke coming from over the hill...... That was strange to {name} because it wasn't time for dinner and it was to hot to just have a\ fire going. {name}'s mind started to race thinking maybe the Bandits have come back? No, no {he_she} gave them a good beating last time. It was to far for\ {him_her} to run do to the large deer on {his_her} back. {he_she.capitalize()} reasured {him_her} self that other people in the village would keep {his_her}\ village safe. But when {name} finally made it over the hill {he_she} didn't believe {his_her} eyes........." Screen.display(intro)
def main_game_loop(): ##-- This is for navigating the map --## global opening, x, y if os.path.getsize('Worldmap.db') == 8192: Engine.map_builder() # while os.path.getsize('Worldmap.db') != 10000: # print('Loading...........') if opening == True: Story.intro_story(player_in_game.name) input("Press Enter to continue: ") opening = False map_info = Engine.get_tile(x, y) Screen.display(f"Location: {map_info[0][2]}") move_to = input( "Which way do you want to travel?\n\n(1): North\n(2): South\n(3): East\n(4): West\n(5): Quit\nInput a Number:> " ) ##-- NORTH = 1, SOUTH = 2, EAST = 3, & WEST = 4 if move_to == '1': ##-- UP --## if y > 0: y -= 1 encounter() else: print('NEED TO MAKE THE PLAYER TO TELEPORT TO OTHER SIDE OF MAP') pause() main_game_loop() elif move_to == '2': ##-- DOWN --## if y < small: y += 1 encounter() else: print('NEED TO MAKE THE PLAYER TO TELEPORT TO OTHER SIDE OF MAP') pause() main_game_loop() elif move_to == '3': ##-- RIGHT --## if x > 0: x += 1 encounter() else: print('NEED TO MAKE THE PLAYER TO TELEPORT TO OTHER SIDE OF MAP') pause() main_game_loop() elif move_to == '4': ##-- LEFT --## if x < small: x -= 1 encounter() else: print('NEED TO MAKE THE PLAYER TO TELEPORT TO OTHER SIDE OF MAP') pause() main_game_loop() elif move_to == '5': ##-- QUIT, I'll take this out after testing --## sys.exit()
def intro_story(player): pronouns = gender_struct(player.gender) intro = f"\tThere was smoke coming from over the hill...... That was strange to {player.name} because it wasn't time " \ f"for dinner and it was too hot to just have a fire going. {player.name}'s mind started to race thinking maybe the " \ f"Bandits have come back? No, no {pronouns.he_she} gave them a good beating last time. It was too far for {pronouns.him_her} " \ f"to run due to the large deer on {pronouns.his_her} back. {pronouns.he_she.capitalize()} reassured {pronouns.him_her}self that other " \ f"people in the village would keep {pronouns.his_her} village safe. But when {player.name} finally made it over the " \ f"hill {pronouns.he_she} didn't believe {pronouns.his_her} eyes........." Screen.display(intro)
def player_select_gender(__pname, __pclass): while True: message = f"{__pname} the {__pclass}, has a nice ring to\ it I think. I know it is obvious but just let me know what gender you are." Screen.display(message) option = input('\n\n' '(1): Male\n' '(2): Female\n' 'Enter A Number:> ') if option == '1': return 'male' elif option == '2': return 'female'
def player_select_name(__pclass): while True: a_an = "An" if __pclass[0] in "AEIOU" else "A" message = f"{a_an} {__pclass} is a good choice I think. What shall I call you?" Screen.display(message) option = input("\n\nENTER YOUR NAME:> ") if len(option) == 0: print('\nYou need to enter a name to continue\n') else: yes_no = input("Are you Sure You Want To Keep This Name?\n" "(1): Yes\n" "(2): No\n" "Enter A Number:> ") if yes_no == '1': return option
def player_select_class(): player_options = ('Mage', 'Warrior', 'Archer', 'Assassin') Screen.char_options() while True: choice = input('\n\n' 'SELECT A NUMBER OR TYPE HELP THEN NUMBER:> ') if choice in ['1', '2', '3', '4']: return player_options[int(choice) - 1] # lore is the story and it is found in InfoDics elif choice[0:4].lower() == 'info': lore = InfoDics.info_on_classes[player_options[int(choice[5]) - 1]] Screen.display(lore) pause() else: print("Not An Option.")
def inventory_mode(player): while True: Screen.display('INVENTORY') print('Stored inventory:\n\n' + '\n'.join([f'({i+1}) {item}' for i, item in enumerate(player.inventory)])) print('\nEquipped weapon: ' + str(player.equipped_weapon)) print('\nEquipped armor: ' + str(player.equipped_armor)) option = input('\n\n' '(1): Examine item\n' '(2): Drop item\n' '(3): Equip Weapon\n' '(4): Equip Armor\n' '(x): Exit inventory screen\n' 'Enter your choice:> ') if option in ['1', '2', '3', '4']: num = input('\n\nWhich item? ' 'Enter item number: ') if num.isdigit() and int(num) in range(1, len(player.inventory) + 1): index = int(num)-1 item = player.inventory[index] if option == '1': clear() print(item.desc()) pause() elif option == '2': player.remove_from_inv(index) elif option == '3': if isinstance(item, Items.Weapon): player.remove_from_inv(index) if player.equipped_weapon is not None: player.add_to_inv(player.equipped_weapon) player.equipped_weapon = item else: print('Not a weapon!') pause() elif option == '4': if isinstance(item, Items.Armor): player.remove_from_inv(index) if player.equipped_armor is not None: player.add_to_inv(player.equipped_armor) player.equipped_armor = item else: print('Not an armor item!') pause() elif option == 'x': break
def gender_call(): global gender message = f"{player_name} the {player_class_choice}, has a nice ring to\ it I think. I know it is obvious but just let me know what gender you are." Screen.display(message) option = input('\n\n(1): Male\n(2): Female\nEnter A Number:> ') if option == '1': gender = 'male' elif option == '2': gender = 'female' else: gender_call() Story.set_gender(gender)
def name_player(): global player_name message = f"A {player_class_choice} is a good choice I think. What shall I call you?" Screen.display(message) option = input("\n\nENTER YOUR NAME:> ") if len(option) == 0: print('\nYou need to enter a name to continue\n') name_player() else: option1 = input("Are you Sure You Want To Keep This Name?\ \n(1): Yes\n(2): No\n Enter A Number:> ") if option1 == '1': player_name = option else: name_player()
def combat(): clear() Screen.vs_screen(player_in_game, mob) Screen.stat_screen(player_in_game, player_inventory, mob) option = input( '\n(1): Attack\n(2): Magic\n(3): Use Item\n(4): Run\nChoose A Number:> ' ) if option == '1': attack() elif option == '2': magic() elif option == '3': use_item() elif option == '4': run()
def class_selection(): global player_class_choice player_options = ('Mage', 'Warrior', 'Archer', 'Assassin') Screen.char_options() choice = input('\n\nSELECT A NUMBER OR TYPE HELP THEN NUMBER:> ') if choice == '1': player_class_choice = player_options[int(choice) - 1] elif choice == '2': player_class_choice = player_options[int(choice) - 1] elif choice == '3': player_class_choice = player_options[int(choice) - 1] elif choice == '4': player_class_choice = player_options[int(choice) - 1] ##-- lore is the story and it is found in InfoDics --## elif choice[0:4].lower() == 'info': lore = InfoDics.info_on_classes[player_options[int(choice[5]) - 1]] Screen.display(lore) input("\n\nPress Enter to Continue:> ") class_selection() else: print("Not An Option.") class_selection()
def attack(): player_melee_attack = random.randint( round(player_in_game.melee_attack / 2), player_in_game.melee_attack + player_inventory.equiped_weapon.melee_damage) player_magic_attack = random.randint( round(player_in_game.magic_attack / 2), player_in_game.magic_attack + player_inventory.equiped_weapon.magic_damage) enemy_attack = random.randint(round(mob.melee_attack / 2), mob.melee_attack) clear() Screen.vs_screen(player_in_game, mob) Screen.stat_screen(player_in_game, player_inventory, mob) attack_type = input( '\n(1): Melee Attack\n(2): Magic Attack\nChoose A Number:> ') if attack_type == '1': if player_melee_attack == player_in_game.melee_attack / 2: ##-- Player Attack --## print( f"\n{player_in_game.name} {player_inventory.in_hand.action_word}" ) ##-- finish me --## else: mob.health -= player_melee_attack clear() print(f'\nYou just dealed {player_melee_attack} damage.') input('\nPess Enter To Continue:> ') if mob.health <= 0: win() if enemy_attack == round(mob.melee_attack / 2): ##-- Mob Attack --## clear() print(f'\n{mob.name} missed!') else: player_in_game.health -= enemy_attack clear() print(f'\n{mob.name} just dealed {enemy_attack} damage to you.') input('\nPess Enter To Continue:> ') if player_in_game.health <= 0: dead() else: combat() elif attack_type == '2': if player_magic_attack == player_in_game.magic_attack / 2: ##-- Player Attack --## clear() print('\nYou Missed!') else: mob.health -= player_magic_attack clear() print(f'\nYou just dealed {player_magic_attack} damage.') input('\nPress Enter To Continue:> ') if mob.health <= 0: win() if enemy_attack == round(mob.magic_attack / 2): ##-- Mob Attack --## clear() print(f'\n{mob.name} missed!') else: player_in_game.health -= enemy_attack clear() print(f'\n{mob.name} just dealed {enemy_attack} damage to you.') input('\nPess Enter To Continue:> ') if player_in_game.health <= 0: dead() else: combat()
def sub_map_move(): global biome_or_subBiome, x, y, sub_x, sub_y clear() biome_or_subBiome = True map_info = Engine.get_tile(x, y) sub_map_info = Engine.get_subTile(x, y, sub_x, sub_y) Engine.update_subTile(x, y, sub_x, sub_y, True) Screen.display( f"Biome in: {sub_map_info[0][4]} Room: {sub_map_info[0][5]}") if sub_x == map_info[0][8] and sub_y == map_info[0][9]: options = "Which way do you want to move?\n\n(1): North\n(2): South\n(3): East\n(4): West\n(5): Look For Resources\n(6): Inventory\n(7): Exit\nInput a Number:> " else: options = "Which way do you want to move?\n\n(1): North\n(2): South\n(3): East\n(4): West\n(5): Look For Resources\n(6): Inventory\nInput a Number:> " move_to = input(options) ##-- NORTH = 1, SOUTH = 2, EAST = 3, & WEST = 4 if move_to == '1': ##-- UP --## if sub_y > 0: sub_y -= 1 encounter() else: print('Looks Like It Dead Ends Here') pause() main_game_loop() elif move_to == '2': ##-- DOWN --## if sub_y < small: sub_y += 1 encounter() else: print('Looks Like It Dead Ends Here') pause() main_game_loop() elif move_to == '3': ##-- RIGHT --## if sub_x > 0: sub_x += 1 encounter() else: print('Looks Like It Dead Ends Here') pause() main_game_loop() elif move_to == '4': ##-- LEFT --## if sub_x < small: sub_x -= 1 encounter() else: print('Looks Like It Dead Ends Here') pause() main_game_loop() elif move_to == '5': get_resouces() elif move_to == '6': look_in_inventory() elif move_to == '7' and sub_x == map_info[0][8] and sub_y == map_info[0][9]: main_game_loop() elif move_to == 'Quit': ##-- QUIT, I'll take this out after testing --## sys.exit()
def main_game_loop(): ##-- This is for navigating the map --## global opening, x, y, sub_x, sub_y, biome_or_subBiome biome_or_subBiome = False if os.path.getsize('Worldmap.db') == 12288: Engine.map_builder() # while os.path.getsize('Worldmap.db') != 10000: # print('Loading...........') if opening == True: Story.intro_story(player_in_game.name) input("Press Enter to continue: ") opening = False map_info = Engine.get_tile(x, y) sub_x = map_info[0][8] sub_y = map_info[0][9] Engine.update_tile(x, y, True) Screen.display(f"Location: {map_info[0][3]}") move_to = input( "Which way do you want to travel?\n\n(1): North\n(2): South\n(3): East\n(4): West\n(5): Inspect Area\n(6): Inventory\n(7): Look For Resources\nInput a Number:> " ) ##-- NORTH = 1, SOUTH = 2, EAST = 3, & WEST = 4 if move_to == '1': ##-- UP --## if y > 0: y -= 1 encounter() else: print('NEED TO MAKE THE PLAYER TO TELEPORT TO OTHER SIDE OF MAP') pause() main_game_loop() elif move_to == '2': ##-- DOWN --## if y < small: y += 1 encounter() else: print('NEED TO MAKE THE PLAYER TO TELEPORT TO OTHER SIDE OF MAP') pause() main_game_loop() elif move_to == '3': ##-- RIGHT --## if x > 0: x += 1 encounter() else: print('NEED TO MAKE THE PLAYER TO TELEPORT TO OTHER SIDE OF MAP') pause() main_game_loop() elif move_to == '4': ##-- LEFT --## if x < small: x -= 1 encounter() else: print('NEED TO MAKE THE PLAYER TO TELEPORT TO OTHER SIDE OF MAP') pause() main_game_loop() elif move_to == '5': inspect_area(map_info[0][2]) elif move_to == '6': look_in_inventory() elif move_to == '7': get_resouces() elif move_to == 'Quit': ##-- QUIT, I'll take this out after testing --## sys.exit() else: print("Not an option.") pause() main_game_loop()
def encounter(): ##-- num is subject to change as I add possible encounters --## num = random.randint(1, 6) random_enemy() if num is 1: clear() Screen.display("You see a Deer/Animal.") input("Press Enter to continue: ") combat() elif num is 2: clear() Screen.display("You came accoss some treaser") input("Press Enter to continue: ") main_game_loop() elif num is 3: clear() Screen.display("A mob attacks you!") input("Press Enter to continue: ") combat() elif num is 4: clear() Screen.display("You see a person aproching! Do you hide?") input("Press Enter to continue: ") main_game_loop() elif num is 5: clear() Screen.display('Some bandits attack you') input("Press Enter to continue: ") combat() elif num is 6: clear() Screen.display(" This area is infested with blah blah") input("Press Enter to continue: ") main_game_loop()