def buying_menu(self, hero): print("Lets see what I have...") available_weapons = weapon_pile().get_weapon_pile() counter = 1 for aw in available_weapons: print( str(counter) + ". " + aw.name + " -- " + str(aw.low_damage) + "-" + str(aw.high_damage) + " -- $" + str(random.randrange(30, 200))) counter += 1 weapon_choice = input("Which one would you like to buy: ") if int(weapon_choice) >= 1 and int(weapon_choice) <= len( available_weapons): buying_weapon = Weapon(available_weapons[int(weapon_choice) - 1].name) if hero.char.money > buying_weapon.money: hero.GetWeapon().upgrade_weapon(buying_weapon.name) hero.char.decrease_money(buying_weapon.money) print(hero.char.name + " now has " + str(hero.char.money) + " gold.") else: print( "The shopkeep grimmaces and says, \"Sorry, you don't have enough money!\"" ) print("You leave the shop")
def inn_decision(self, hero): inn_keeper = NPC(weapon_pile().get_random_weapon()) inn_choices = ["Sleep for the night", "Leave"] counter = 1 for i in inn_choices: print(str(counter) + ". " + i) counter += 1 inn_decision = input("Your decision: ") if int(inn_decision) is 1: print(hero.char.health_display()) if hero.char.max_health - hero.char.current_health == 0: print("It will cost you 5 gold.") else: print("It will cost you " + str((hero.char.max_health - hero.char.current_health) * 2) + " gold.") if hero.char.money >= (hero.char.max_health - hero.char.current_health) * 2 or hero.char.money >= 5: sleep_yn = input("Would you like to stay the night: ") if sleep_yn.upper() is "Y": if hero.char.max_health - hero.char.current_health == 0: hero.char.decrease_money(5) else: hero.char.decrease_money((hero.char.max_health - hero.char.current_health) * 2) hero.char.current_health = hero.char.max_health print("The " + hero.char.name + " walks upstairs to the rented room, and sleeps for the night.") else: print("The innkeeper looks at you with a furrowed brow and says \"Sorry, it appears you don't have enough gold.\"") print(hero.char.name + " leaves the inn.")
def __init__(self, hero): print("You walk up to the castle") if random.randrange(0, 100) > 90: print("The guards determine you're a threat, and want to fight!") guard_greature = Enemy(weapon_pile().get_random_weapon()) Battle(hero, guard_greature) else: print("The guards stand stoically; watching your every move, as you move inside.") self.guard_speak(hero)
def entry(self, hero): print( "You find yourself in a clearing, looking at an entry to a forest." ) input() entryFight = random.randrange(0, 100) if entryFight >= 90: print( "You see a creature guarding the entrance, it wants to fight!") guard_creature = Enemy(weapon_pile().get_random_weapon()) # storeWeapons = WeaponPile().getWeapons() # guardCreature = guardCreature.enemyCreation(storeWeapons) Battle(hero, guard_creature) self.wandering_overview(hero)
def __init__(self, hero): print("\n" + hero.char.name + " currently has " + str(hero.char.money) + " gold.") print("The shopkeeper greets you") input() shopkeep = NPC(weapon_pile().get_random_weapon()) shopper_choice = input("Are you buying or selling?: ") if "B" in str(shopper_choice).upper(): self.buying_menu(hero) if "S" in str(shopper_choice).upper(): self.sellingMenu(hero) if "K" in str(shopper_choice).upper() or "A" in str( shopper_choice).upper(): print("\nYou lunge at the " + shopkeep.Name + " with your " + shopkeep.Weapon.name + "!\n") Battle(hero, shopkeep)
def guard_speak(self, hero): print("A guard stops you in your tracks and says; \"We don't let just anyone speak with the king.\"\nWhy are you here?"); castle_options = ["Ask for title increase", "Attack King", "Leave"] counter = 1 for co in castle_options: print(str(counter) + ". " + co) counter += 1 user_co = input("What would you like to do: ") if int(user_co) == 1: self.increase_title(hero) if int(user_co) == 2: are_you_sure = input("Are you sure you want to do this? This is a death sentence!: ") if str(are_you_sure).upper() == "Y": print("Fighting the guards and eventual king") guard_one = Enemy(weapon_pile().get_random_weapon()) Battle(hero, guard_one) Battle(hero, guard_one) Battle(hero, guard_one) print(hero.char.name + " leave the castle.")
def wandering_overview(self, hero): directions = ["north", "south", "east", "west", "Go Back to Town"] while self.is_plotter_zeroed() == False: print("What direction would you like to go: ") counter = 1 for dir in directions: print(str(counter) + ". " + dir) counter += 1 dir_choice = input("Your choice: ") # self.entryCount += 1 if dir_choice == "north" or dir_choice.upper() == "N": self.plotter[0] += 1 if dir_choice == "south" or dir_choice.upper() == "S": self.plotter[0] -= 1 if dir_choice == "east" or dir_choice.upper() == "E": self.plotter[1] += 1 if dir_choice == "west" or dir_choice.upper() == "W": self.plotter[1] -= 1 if "town" in dir_choice: self.plotter[0] = 0 self.plotter[1] = 0 deepness_range = random.randrange( self.plotter[0] * self.plotter[1], 100) # print("Deepness Range: " + str(deepnessRange)) if deepness_range > 50: available_weapons = weapon_pile().get_random_weapon() # enemy = Enemy(availableWeapons) print("As " + hero.char.name + " comes to a clearing") Battle(hero, Enemy(available_weapons)) if self.is_plotter_zeroed() == True: user_leave = input("Are you sure you want to leave the forest?: ") if str(user_leave) is "N" or str(user_leave) is "N": self.plotter[0] += 1 print(hero.Name + " walks back into the forest.") else: print(hero.Name + " walks out of the forest, towards the town")