Beispiel #1
0
    def enter(self):
        text = ex43_45_game_text.laser_weapon_armory_enter
        text_output = ex45.TextOutput(text, 60, 40)
        text_output.display_text()
        code = "%d%d%d" % (randint(1, 9), randint(1, 9), randint(1, 9))

        guess = raw_input("Enter a code> ")
        guesses = 1
        while guess != code and guesses < 15:
            print "BZZZZEDDD!"
            guesses += 1
            correct = 0

            for i in range(0, len(code)):
                if guess[i] == code[i]:
                    correct += 1
                else:
                    continue

            print "You got %d right." % (correct)
            guess = raw_input("Enter a code> ")

        if guess == code:
            text = ex43_45_game_text.laser_weapon_armory_right_code
            text_output = ex45.TextOutput(text, 60, 40)
            text_output.display_text()
            return 'the_bridge'
        else:
            text = ex43_45_game_text.laser_weapon_armory_wrong_code
            text_output = ex45.TextOutput(text, 60, 40)
            text_output.display_text()
            return 'death'
Beispiel #2
0
    def play(self):
        choices = self.choose()
        result = self.get_result.get_result(choices)
        show_result = self.get_result.show_result(choices, result)
        end_result = self.check_hits(result)
        player_hits = str(3 - self.player.hits)
        gothon_hits = str(3 - self.gothon.hits)

        score = "\\n Player hits: {0} Gothon hits: {1}".format(
            player_hits, gothon_hits)
        text_output = ex45.TextOutput(show_result + score, 60, 40)
        text_output.display_text()

        while end_result == None:
            choices = self.choose()
            result = self.get_result.get_result(choices)
            show_result = self.get_result.show_result(choices, result)
            end_result = self.check_hits(result)
            player_hits = str(3 - self.player.hits)
            gothon_hits = str(3 - self.gothon.hits)

            score = "\\n Player hits: {0} Gothon hits: {1}".format(
                player_hits, gothon_hits)
            text_output = ex45.TextOutput(show_result + score, 60, 40)
            text_output.display_text()

        return end_result
Beispiel #3
0
    def enter(self):
        text = ex43_45_game_text.escape_pod_enter
        text_output = ex45.TextOutput(text, 60, 40)
        text_output.display_text()

        good_pod = randint(1, 5)

        guess = raw_input("[pod #]> ")
        if int(guess) != good_pod:
            bad_escape_pods = [1, 2, 3, 4, 5]
            bad_escape_pods.remove(good_pod)
            bad_escape_pods.remove(int(guess))
            second_choice = []
            second_choice.append(good_pod)
            second_choice.append(int(guess))
            second_choice.append(bad_escape_pods.pop(randint(0, 2)))
            second_choice.sort()

            text = """
            When you move to pod {0} the warning lights of pods {1} and {2} 
            start flashing. Seeing the pods fail right before your eyes makes 
            you doubt whether you have chosen the right pod. Pods {3}, {4} and 
            {5} are left.
            """.format(guess, bad_escape_pods[0], bad_escape_pods[1],
                       second_choice[0], second_choice[1], second_choice[2])

            text_output = ex45.TextOutput(text, 60, 40)
            text_output.display_text()

            guess = raw_input("[pod #]> ")
            if int(guess) != good_pod:
                text = """
                You jump into pod {0} and hit the eject button. The 
                pod escapes into the void of space, then implodes as the hull 
                ruptures, crushing your body into jam jelly.
                """.format(guess)
                text_output = ex45.TextOutput(text, 60, 40)
                text_output.display_text()
                return 'death'
            else:
                pass
        else:
            pass

        text = """
        You jump into pod {0} and hit the eject button. The pod 
        easily slides out into space heading to the planet below. As it flies 
        to the planet, you look back and see your ship implode then explode 
        like a bright star, taking out the Gothon ship at the same time.  \\n
        You won!
        """.format(guess)

        text_output = ex45.TextOutput(text, 60, 40)
        text_output.display_text()

        exit(1)
Beispiel #4
0
    def enter(self):
        text = ex43_45_game_text.centralcorridor_enter
        text_output = ex45.TextOutput(text, 60, 40)
        text_output.display_text()

        combat = CombatRound('central_corridor')
        if combat.play() == 'player':
            text = ex43_45_game_text.centralcorridor_win
            text_output = ex45.TextOutput(text, 60, 40)
            text_output.display_text()
            return 'laser_weapon_armory'
        else:
            return 'death'
Beispiel #5
0
    def enter(self):
        text = ex43_45_game_text.the_bridge_enter
        text_output = ex45.TextOutput(text, 60, 40)
        text_output.display_text()

        combat = CombatRound('the_bridge')
        if combat.play() == 'player':
            text = ex43_45_game_text.the_bridge_win
            text_output = ex45.TextOutput(text, 60, 40)
            text_output.display_text()
            return 'escape_pod'
        else:
            return 'death'
Beispiel #6
0
    def enter(self):
        text = Death.quips[randint(0, len(self.quips) - 1)]
        text_output = ex45.TextOutput(text, 60, 40)
        text_output.display_text()

        print "\n"
        print "Do you still want to go on?"

        answer = raw_input("y/n? >..")
        if answer == 'y':
            pass
        else:
            exit(1)