Пример #1
0
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)
Пример #2
0
def Craft(player, item):
    item = item.lower()
    printing.Print("You crafted a " + str(item))
    if item == "torch":
        player.inventory['wood'] = player.inventory['wood'] - 2
        player.AddToInv("Torch", 1)
        if player.inventory['torch'] > 100:
            printing.Print("OMG STOP MAKING TORCHES")
            printing.Print("FINE HERE,")
            printing.Print("You win!! yay now go do something else ffs")

    explore.Idle(player)
Пример #3
0
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)
Пример #4
0
def Craft(item):
    item = item.lower()
    printing.Print("You crafted a " + str(item))
    if item == "torch":
        index.player.inventory['wood'] = index.player.inventory['wood'] - 2
        index.player.AddToInv("Torch", 1)
        
    explore.Idle()
Пример #5
0
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)
Пример #6
0
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()
Пример #7
0
    def Deal(self, counter):
        damage = self.damage
        if counter:
            if random.randint(1,2) == 1:
                self.Take(True)
                return
            else:   
                damage = damage * 1.5
                printing.Print("You mess up the counter")

        index.player.health = index.player.health - damage
        printing.PrintHitByEnemy(self.name + self.flavour[random.randint(0,len(self.flavour) - 1)] + index.player.name + " for " + str(damage))
        if index.player.health < 0:
            index.player.HasDied()
Пример #8
0
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()
Пример #9
0
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()
Пример #10
0
 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()
Пример #11
0
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()
Пример #12
0
 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
Пример #13
0
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))
Пример #14
0
def Run():
    printing.Print("You manage to lose them")
    printing.Print(
        "you rest for a little bit after running so far and for so long")
    explore.Idle()
Пример #15
0
def Explore(player):
    num = random.randint(0,10)
    printing.Print("You walk around for a bit")
    if num == 6:
        printing.Print("You come across a small river")
        printing.Print("You cant see a way across and it's too cold to swim")
        River()
    elif num == 7:
        printing.Print("you come across a strange rock...")
        printing.Print("On closer inspection it is just a normal rock")
        Idle()
    elif num == 5 or num == 4:
        printing.Print("You stumble across a small cave")
        printing.Print("It looks dark inside")
        if "torch" in player.inventory:
            printing.Print("Explore cave?")
        else:
            printing.Print("Hmm, it looks too dark to explore")
            printing.Print("Maybe if you had a torch...")
            Idle()
    elif num == 8:
        fight.Fight("Wolf", random.randint(20,25), random.randint(2,5))
    else:
        printing.Print("You find nothing of interest")
        printing.Print("You seem more lost now...")
        Idle()
Пример #16
0
#patrick Fennell z5218631
#12/04/18
#A small snowy forest
#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:
Пример #17
0
 def HasDied(self):
     printing.Print("Well...")
     printing.Print("Looks like you have died")
     printing.Print("That sucks huh :/")
     exit()
Пример #18
0
def Explore(player):
    num = random.randint(0,6)
    printing.Print("You walk around for a bit")
    if num == 1:
        printing.Print("You come across a small river")
        printing.Print("You cant see a way across and it's too cold to swim")
        River(player)
    elif num == 2:
        printing.Print("you come across a strange rock...")
        printing.Print("On closer inspection it is just a normal rock")
        if ("dagger" in player.inventory) == False:
            printing.Print("Oh there is a dagger lying on the ground near the rock!")
            player.AddToInv("dagger", 1)
            printing.PrintHitByPlayerCrit("HINT: you can equip this! (check inv)")
        Idle(player)
    elif num == 3:
        printing.Print("You stumble across a small cave")
        printing.Print("It looks dark inside")
        if player.inventory['torch'] > 0:
            Cave(player)
        else:
            printing.Print("Hmm, it looks too dark to explore")
            printing.Print("Maybe if you had a torch...")
            Idle(player)
    elif num == 5:
        fight.Fight("Wolf", random.randint(20,25), random.randint(2,5), player)
        Idle(player)
    elif num == 6:
        fight.Fight("Bear", random.randint(45,55), random.randint(5,6), player)
        Idle(player)
    else:
        printing.Print("You find nothing of interest")
        printing.Print("You seem more lost now...")
        Idle(player)
Пример #19
0
def smallCave(player):
    printing.Print("The cave is slightly wet and has moss on the walls")
    printing.Print("You keep walking deeper into the cave")
    printing.Print("You come across a steel sword laying at the end of the cave!")
    player.AddToInv("steel sword", 1)
    printing.Print("You equip the steel sword")
    printing.PrintItem("steel sword equipped!")
    player.equipped = "steel sword"
    printing.Print("As tou turn around a small glowing object catches your eye")
    printing.Print("You investigate the small object...")
    printing.Print("It seems to be some sort of glowing green rock")
    printing.Print("Suddenly your body fills with massive amounts of energy and the glow disapears")
    printing.Print("You feel more powerful!")
    printing.PrintItem("You health has increased to 150!")
    player.maxhealth = 150
    player.health = 150
    printing.Print("You exit the cave")
    printing.Print("As you exit the cave something lands infront of you and looks quite angry")
    fight.Fight("Large Angry Dragon", 200, 10, player)
    printing.Print("After the battle you rest")
    Idle(player)
Пример #20
0
def CollectWood(player):
    printing.Print("You go to collect wood")
    printing.Print("Amazingly in a forrest of trees you find some!")
    player.AddToInv("wood", random.randint(1,3))
    Idle(player)