コード例 #1
0
def run(player):
    x = Collector()
    print("""Opening the door, you peer cautiously into the room.
A hooded figure with three swords strapped to his back stands at its center.

""")
    while True:
        response0 = console.getInput(player, ["1"], "Press 1 to continue")
        if response0.lower() == "1":
            break
    print(""" The head swivels smoothly toward you, and a hollow voice says,

"Choose your death, or choose your glory
Blood and steel will write your story
If you fear a gruesome end
My farmer's blade will give and bend
Should you desire jewels and gold
My blade of kings is yours to hold
But if you fear not war or strife
My hero's blade will take your life

Choose wisely, adventurer. The blade I wield will be your reward should you best me."
Press 1 to choose the peasant's blade
Press 2 to choose the king's blade
Press 3 to choose the hero's blade (don't do it)
""")
    for objects in player.items:
        x.baseDamage += 2
        x.health += 30
        x.maxHp += 30
    enemylist = [x]
    while True:
        response = console.getInput(player, ["1", "2", "3"],
                                    "Make your choice")
        if response.lower() == "1":
            x.baseDamage += 2
            x.loot = [("Gold", random.randint(100, 120)), peasantsBlade()]
            baseM.runBasicFight(player, enemylist, 0, True)
            return player
        if response.lower() == "2":
            x.baseDamage += 8
            x.loot = [("Gold", random.randint(250, 300)), kingsBlade()]
            baseM.runBasicFight(player, enemylist, 0, True)
            return player
        if response.lower() == "3":
            x.baseDamage += 40
            x.loot = [("Gold", random.randint(120, 150)), herosBlade()]
            baseM.runBasicFight(player, enemylist, 0, True)
            return player
コード例 #2
0
def run(player):
    jabTrue = random.choice([True, False])
    print("""At brillig, you see slithy toves
gyring and gimbling in the wabe. 
All mimsy are the borogoves, 
And the mome raths outgrabe. 

You stop in uffish thought under a nearby Jubjub tree.
""")
    print(
        "You hear a faint yet vicious burbling from the bushes beyond the wabe... or is it just your imagination?"
    )
    response = console.getInput(
        player, ["1", "2", "3"], """What do you do?
[1] prepare to fight
[2] run away
[3] take a nap\n""")
    if response == "1":
        fight(player, jabTrue, True)

    elif response == "2":
        runAway(player, jabTrue)

    elif response == "3":
        nap(player, jabTrue)
    return player
コード例 #3
0
def shrine(player, swordOfStupidity):
    global stupidswordvar, lavadamage
    print ("""The shrine is on the far side of the cavern, and it feels like hours as you slog through the blistering heat.
You take """+str(lavadamage)+" damage from the heat")
    pScript.damage(player,lavadamage)
    lavadamage+=1
    print ("""You look back at the bridge. It still seems close enough to cross easily, and it's only getting hotter as you near the shrine.
Will you turn back?
Press 1 to continue to the shrine
Press 2 to turn back and cross the bridge""")
    while True:
        response1 = console.getInput(player, ["1", "2"], "Make your choice")
        if response1.lower() == "1":
            print ("As you approach the shrine,you notice that it appears to have been chiseled out of a solid block of obsidian.")
            print ("A huge sword is planted in the otherwise smooth obsidian near the edge of the lava.")
            print ("Since the entire shrine is made out of black rock, it radiates intense heat as you approach.")
            print ("Or maybe it's just because you're so close to the lava. Regardless, you take "+str(lavadamage)+" damage from the heat")
            pScript.damage(player,lavadamage)
            lavadamage+=1
            print ("As you stumble toward the shrine, you see an opening in the cavern wall behind it. Safety!")
            print ("But then you hesitate, looking back at the unclaimed sword. It would be a shame to just leave it there...")
            print ("Press 1 to go back for the sword")
            print ("Press 2 to head for the exit")
            while True:
                response2 = console.getInput(player, ["1", "2"], "Make your choice")
                if response2.lower() == "1":
                    print ("Feeling the heat of the lava singeing your hair and eyes, you stagger up to the sword")
                    print ("Etched into the glassy stone reads the inscription: SWORD OF STUPIDITY-A WEAPON TO EMPOWER THE IRRATIONAL AND FOOLHARDY")
                    print ("You yank the sword from its stone sheath and instantly feel the heat drain from your body into the sword.")
                    pScript.addItem(player,swordOfStupidity)
                    stupidswordvar = 3*lavadamage
                    swordOfStupidity.damage = stupidswordvar
                    print ("Your Sword of stupidity has "+str(swordOfStupidity.damage)+" strength")
                    #Sword of Stupidity is meant to increase your attack damage by the value of stupidswordvar
                    print ("Feeling empowered, you stride confidently to the exit")
                    return player
                if response2.lower() == "2":
                    print ("You stagger into the blessedly cool tunnel, and continue on your way without looking back.")
                    return player
        if response1.lower() == "2":
            crossbridge(player)   
            return player
コード例 #4
0
def run(player):
    response = ""
    cost = random.randint(8,15)
    print("Out from the darkness, a man in a hood approaches you.")
    while True:
        response = console.getInput(player, ["yes", "no"], "Pay " + str(cost) + " to listen to his story? ")
        if response.lower() == "yes":
            if pScript.spendGold(player, cost) == False:
                badEnd()
                return player
            if story(player, cost) == False:
                badEnd()
                return player
        if response.lower() == "no":
            badEnd()
            return player
        goodEnd(player)
        break
コード例 #5
0
def goBack(player, tf, lost):
    response = console.getInput(player, ["yes", "no"],
                                ("Go back for " + lost.name + "?"))
    if response == "yes":
        if tf == True:
            fight(player, tf, False)
            if player.alive != True:
                return False
            print("Unfortunately, your " + lost.name +
                  " was lost in the fight.")
        else:
            print(
                "You find your " + lost.name +
                " peacefully resting at the base of the tree, seemingly mocking your cowardice."
            )
            pScript.addItem(player, lost)
    else:
        print("You figure it's not worth going back.")
コード例 #6
0
def story(player, cost):
    text = ["I met a traveller from an antique land, \nWho said—“Two vast and trunkless legs of stone \nStand in the desert....",
        "Near them, on the sand, \nHalf sunk a shattered visage lies, whose frown, \nAnd wrinkled lip, and sneer of cold command....",
        "Tell that its sculptor well those passions read \nWhich yet survive, stamped on these lifeless things, \nThe hand that mocked them, and the heart that fed;",
        "And on the pedestal, these words appear:",
        "My name is Ozymandias, King of Kings; \nLook on my Works, ye Mighty, and despair!",
        "Nothing beside remains. Round the decay \n Of that colossal Wreck, boundless and bare \nThe lone and level sands stretch far....",
        "away." ]
    for item in text:
        if item != text[0]:
            cost = round(cost * (random.random()+ 1))
            text = "Pay " + str(cost) + " to continue? "
            response = console.getInput(player, ["yes", "no"], text)
            if response == "no":
                return False
            if pScript.spendGold(player, cost) == False:
                return False
            print("\nThe hooded man continues his story:")
        else:
            print("\nThe hooded man begins:")
        print(item)
    return True
コード例 #7
0
def run(player):
    syord = itemStats.swordOfStupidity()
    global stupidswordvar, lavadamage
    print ("""As you enter the room, you feel hot air singe your eyebrows.
You find yourself in a vast cavern split by a river of lava.
A bridge of polished black stone stretches over the lava, and through the smoke you can barely see a door on the far side of the chamber.
Looking around the walls of the cavern, you see a strange, temple-like structure to the left, but it looks dangerously close to the lava.
How would you wish to proceed?
Press 1 to cross the bridge
Press 2 to approach the shrine
Press 3 to cower away from the heat""")
    while True:
        response = console.getInput(player, ["1", "2","3"], "Make your choice")
        if response.lower() == "1":
            crossbridge(player)
            lavadamage=1   
            return player
        if response.lower() == "2":
            shrine(player, syord)
            lavadamage=1
            return player
        if response.lower() =="3":
            vegetate(player)
コード例 #8
0
def game():
    Player = pScript.PChar()
    levels = easy
    consol = ""
    rounds = 0
    lastRoom = None

    baseM.initIntro(Player)
    while Player.alive:
        torchExists = False
        possibleLevels = copy.copy(levels)
        if Player.impossible:
            possibleLevels += impossible
        for itm in Player.items:
            if itm.name == "Zomboman Guts":
                possibleLevels.append(battleZombomanM)
            if itm.name =="Torch":
                torchExists = True
        if not torchExists:
            if random.randint(0,10)>6:
                print("You tripped in the dark and took 5 damage")
                Player.health-=5
        if rounds == 3:
            room = shopM
        else:
            room = random.choice(possibleLevels)
            while room == lastRoom:
                room = random.choice(possibleLevels)
        lastRoom = room
        consol = console.getInput(Player, ["yes", "y", "ok", "sure", "yeah", "yay", "no", "nay", "n", "nok"], "next room? ")
        if consol.lower() in ["yes", "y", "ok", "sure", "yeah", "yay"]:
            room.run(Player)
            rounds += 1
            Player.timeClimbing += 2
            for i in Player.items:
                try:
                    if issubclass(type(i), itemStats.basicItem):
                        i.onFloorClimb(Player)
                except TypeError:
                    pass
            for i in Player.curses:
                if issubclass(type(i), curseScript.basicCurse):
                    i.onFloorClimb(Player)
        else:
            break
        if Player.alive == False:
            print("You have died.")
        if rounds == 5:
            levels += med
        elif rounds == 20:
            levels += hard
    print("Game over.")
    print("rooms cleared:  " + str(rounds))
    print("Ending gold:    " + str(Player.gold))
    print("Ending items:")
    for i in Player.items:
        print("- {}".format(i))
    print("Your final score is: {}".format(baseM.calculateFinalScore(Player,rounds)))
    input()
    levels=easy
    game()