コード例 #1
0
ファイル: game.py プロジェクト: btbeabout/PythonTextRPG
    def action_with_sword(self):
        print "The blue armored creature from before continues to block your path to the next"
        print "room. However, your gleaming sword has caught its eye. Its armored head "
        print "noticably shifts in your direction..."
        print "Your best bet is to preemptively [attack] him!"

        preempt = raw_input("> ")

        if preempt == "attack":
            print "You decide to confront the being by pointing quite menacingly at it and shouting"
            print "'Hey you!'. The blue creature does not respond well to this. It juts out its"
            print "hand, in which a large sword suddenly appears. It lunges at you!\n"
            fights.fight_warrior(monsters.blue_warrior, player.Player)
            if fights.death == False:
                green_room()
        else:
            print "Instead of attacking, you decided to dawdle around; that'll cost you."
            print "He attacks you first!"
            print "The creature slashes at you!\n"
            player.Player.health = player.Player.health - 2
            fights.fight_warrior(monsters.blue_warrior, player.Player)
            if fights.death == False:
                green_room()
コード例 #2
0
ファイル: game.py プロジェクト: btbeabout/PythonTextRPG
    def action(self):
        print "What do? This creature in front of you blocks your path. It blocks your path,"
        print "yet does not respond to your presence."
        print "You have two choices: [1], sneak around it or [2], confront it. \n"

        decision = raw_input("> ")

        if decision == "1":
            print "You begin to sneak around the armored creature in front of you (which is no"
            print "simple task, as it's an empty room). But as you scan the room, you see a"
            print "small lever that with a color that is only a hint lighter than its surroundings."
            print "You slowly approach the lever and grasp it. Figuring, 'why not?' you begin"
            print "to pull the lever."
            pulling = True
            pull_count = 0
            while pulling == True:
                pull = raw_input("\nPull the lever! ")
                if pull.lower() == "pull":
                    pull_count += 1
                else:
                    print "Come on! Pull it!"
                    pull = raw_input("\nPull the lever! ")
                if pull_count < 5:
                    print "You're getting close! Keep at it!"
                else:
                    pulling = False
            else:
                print "You've opened a hidden door! You walk through."
                hidden_room()
                 
        if decision == "2":
            print "You decide to confront the being by pointing quite menacingly at it and shouting"
            print "'Hey you!'. The blue creature does not respond well to this. It juts out its"
            print "hand, in which a large sword suddenly appears. It lunges at you!\n"
            fights.fight_warrior(monsters.blue_warrior, player.Player)
            if fights.death == False:
                green_room()