def River(player): choice = '' while choice != 'y' and choice != 'n': printing.PrintOpt("Investigate river? (y/n?)") choice = input() if choice == 'y': printing.Print("You walk down closer to the river") printing.Print("You see a pebble") choice = '' while choice != 'y' and choice != 'n': printing.PrintOpt("Pick up pebble? (y/n?)") choice = input() if choice == 'y': printing.Print("You decide to pick up the pebble") player.AddToInv("pebble", 1) else: printing.Print("You do not need a pebble at this time") printing.Print("you investigate a bit further...") if random.randint(1,3) == 3: printing.Print("You see somthing shiny in the water...") printing.Print("Wow you found some gold coins!") player.AddToInv("gold coin", random.randint(1,5)) else: printing.Print("you don't find anything of interest") Idle(player) else: printing.Print("You decide to turn back") Idle(player)
def Crafting(): choices = [] choice = "" printing.Print("You decide to craft a...") if index.player.inventory['wood'] >= 2: printing.PrintOpt("Torch") choices.append("torch") printing.PrintOpt("Back") choices.append("back") choice = input() choice = choice.lower() if choice in choices: if choice == "torch" and "torch" in choices: Craft("torch") elif choice == "back": explore.Idle() else: Crafting()
def Cave(): choice = '' while choice != 'y' and choice != 'n': printing.PrintOpt("Investigate Cave? (y/n?)") choice = input() if choice == 'y': printing.Print("You light the torch and head inside") else: Idle()
def Fight(name, health, damage, player): enemy = enemypg.Enemy(name, health, damage) printing.Print("A wild " + enemy.name + " has appeared!") while enemy.health > 0: choice = '' printing.PrintHitByPlayer("Your health is " + str(player.health)) printing.PrintHitByEnemy(enemy.name + "'s health is " + str(enemy.health)) printing.PrintOpt("Attack") printing.PrintOpt("Counter") printing.PrintOpt("Run") choice = input().lower() if choice == "attack": enemy.Take(player, False) enemy.Deal(player, False) elif choice == "counter": enemy.Deal(player, True) elif choice == "run": printing.Print("You try to make a break for it...") if CanRun(): Run(player) else: printing.Print("The " + enemy.name + " catches up to you") enemy.Deal(player, False) else: printing.Print("You stumble giving the " + enemy.name + " a chance to attack") enemy.Deal(player, False) printing.Print("You defeated the " + enemy.name) printing.Print("Some coins appear infront of you") printing.Print("You pick them up") player.AddToInv("gold coin", random.randint(3, 6))
def Fight(name, health, damage): enemy = enemypg.Enemy(name, health, damage) printing.Print("A wild " + enemy.name + " has appeared!") while enemy.health > 0: choice = '' printing.PrintHitByPlayer("Your health is " + str(index.player.health)) printing.PrintHitByEnemy(enemy.name + "'s health is " + str(enemy.health)) printing.PrintOpt("Attack") printing.PrintOpt("Counter") printing.PrintOpt("Run") choice = input().lower() if choice == "attack": enemy.Take(False) enemy.Deal(False) elif choice == "counter": enemy.Deal(True) elif choice == "run": printing.Print("You try to make a break for it...") if CanRun(): Run() else: printing.Print("The " + enemy.name + " catches up to you") enemy.Deal(False) else: printing.Print("You stumble giving the " + enemy.name + " a chance to attack") enemy.Deal(False) printing.Print("You defeated the " + enemy.name) explore.Idle()
def Idle(): choice = "" choices = [] printing.Print("You are idle") printing.Print("What would you like to do?") if (index.player.inventory['wood'] > 2) == False: printing.PrintOpt("Collect wood") choices.append("collect wood") if craft.CanCraft(): printing.PrintOpt("Craft") choices.append("craft") printing.PrintOpt("Explore") choices.append("explore") printing.PrintOpt("Check inventory (inv)") choices.append("inv") choice = input() choice = choice.lower() if choice in choices: if choice == "collect wood" and "collect wood" in choices: CollectWood() elif choice == "explore" and "explore" in choices: Explore() elif choice == "inv": index.player.CheckInv() Idle() elif choice == "craft" and "craft" in choices: craft.Crafting() else: Idle() else: Idle()
def Equip(self): printing.Print("Which item would you like to equip?") choice = "" choices = [] for item in self.weapons: if item in self.inventory and self.inventory[item] > 0: printing.PrintOpt(item.lower()) choices.append(item.lower()) choice = input().lower() if choice in choices: self.equipped = choice printing.PrintItem(choice + " equipped!") return elif choice == "back": explore.Idle(self) else: self.Equip()
def Cave(player): choice = '' while choice != 'y' and choice != 'n': printing.PrintOpt("Investigate Cave? (y/n?) (will use 1 torch)") choice = input() if choice == 'y': printing.Print("You light a torch and head inside") if player.hasEnteredCave == False: player.hasEnteredCave = True player.RemoveFromInv("torch", 1) smallCave(player) else: pass else: printing.Print("You decide not to enter...") Idle(player)
def Idle(player): choice = "" choices = [] printing.Print("You are idle") printing.Print("What would you like to do?") if (player.inventory['wood'] > 2) == False: printing.PrintOpt("Collect wood") choices.append("collect wood") if craft.CanCraft(player): printing.PrintOpt("Craft") choices.append("craft") printing.PrintOpt("Explore") choices.append("explore") printing.PrintOpt("Check inventory (inv)") choices.append("inv") printing.PrintOpt("Check status (stats)") choices.append("stats") if player.health < player.maxhealth: printing.PrintOpt("Rest") choices.append("rest") choice = input() choice = choice.lower() if choice in choices: if choice == "collect wood" and "collect wood" in choices: CollectWood(player) elif choice == "explore" and "explore" in choices: Explore(player) elif choice == "inv": player.CheckInv() Idle(player) elif choice == "rest" and "rest" in choices: printing.Print("You rest for a bit") player.Heal(10) Idle(player) elif choice == "craft" and "craft" in choices: craft.Crafting(player) elif choice == "stats": player.PrintStatus() Idle(player) else: Idle(player) else: Idle(player)
def CheckInv(self): i = 0 for key, value in self.inventory.items(): if value < 1: pass else: printing.PrintItem(key + " x " + str(value) + " " + self.IsWeapon(key)) i+=1 if i < 1: printing.Print("You are not carrying anything") if self.CanEquip(): while True: choice = "" printing.PrintOpt("Equip a weapon? (y/n)") choice = input().lower() if choice == "y": self.Equip() explore.Idle(self) elif choice == "n": explore.Idle(self) else: pass
#made in python 3 from stuff import player as playerpg, printing, explore, fight printing.PrintTitle() printing.Print("You wake up, your head is hurting and you are cold") printing.Print("You struggle to remember your own name..") name = input().title() if name == "": name = "THE NAMELESS ONE" player = playerpg.Players(name) printing.Print("Thats right it's " + player.name) printing.Print("You look around") printing.Print("Nothing but trees and snow") #player.AddToInv("dagger", 1 ) answer = '' while answer != 'y' and answer != 'n': printing.PrintOpt("Should you go exploring? (y/n)") answer = input() if answer == 'y': explore.Explore(player) else: printing.Print("You decide to rest while until your head feels better") explore.Idle(player)