Example #1
0
    def enter(self, map_instance, player_instance, cheatcode):
        print '_' * 40
        print texts.get(type(self).__name__)
        a_guard = Guard()
        fight_result = player_instance.fight(a_guard.name,
                                             a_guard.characteristics,
                                             cheatcode)

        if fight_result == 'alive':
            print texts.get("Dormitory_armor")
            player_instance.characteristics['armor'] += 2
            player_instance.print_charac()
            map_instance.explored_scenes[type(self).__name__] = "explored"
            return Corridor()
        else:
            return Death()
Example #2
0
    def enter(self, map_instance, player_instance, cheatcode):
        print '_' * 40
        print texts.get("GuardsRoom_intro")

        for i in range(2):
            a_guard = Guard()
            fight_result = player_instance.fight(a_guard.name,
                                                 a_guard.characteristics,
                                                 cheatcode)

            if fight_result == 'alive':
                pass
            else:
                return Death()

        map_instance.explored_scenes[type(self).__name__] = "explored"
        player_instance.key = 'yes'
        player_instance.print_charac()
        print texts.get("GuardsRoom_outro")
        return Corridor()
Example #3
0
    def enter(self, map_instance, player_instance):
        print '_' * 40
        print texts.get("Cell_intro")

        if player_instance.key == 'yes':
            print texts.get("Cell_with_key")
            map_instance.explored_scenes['Cell'] = "explored"
        else:
            print texts.get("Cell_without_key")

        return Corridor()
Example #4
0
 def enter(self, map_instance, player_instance, cheatcode):
     print '_' * 40
     print texts.get(type(self).__name__)
     action = raw_input("Réponse> ")
     analysed_action = scan(action)
     if ((('verb', 'lancer') in analysed_action or
         ('verb', 'lance') in analysed_action or
         ('verb', 'lances') in analysed_action or
         ('verb', 'jeter') in analysed_action or
         ('verb', 'jetes') in analysed_action or
         ('verb', 'jete') in analysed_action)
             and (('noon', 'caillou') in analysed_action or
                  ('noon', 'gravier') in analysed_action)
             and (('noon', 'cheval') in analysed_action))\
             or (action == cheatcode):
         print texts.get("DungeonGate_cheval")
         return Corridor()
     elif (('verb', 'attaquer') in analysed_action or
           ('verb', 'attaque') in analysed_action or
           ('verb', 'attaques') in analysed_action or
           ('verb', 'frapper') in analysed_action or
           ('verb', 'frappes') in analysed_action or
           ('verb', 'frappe') in analysed_action)\
             and ('noon', 'garde') in analysed_action:
         a_guard = HeavyGuard()
         fight_result = player_instance.fight(a_guard.name,
                                              a_guard.characteristics,
                                              cheatcode)
         if fight_result == 'alive':
             player_instance.print_charac()
             print texts.get("DungeonGate_combat")
             map_instance.explored_scenes['DungeonGate'] = "explored"
             return Corridor()
         else:
             return Death()
     else:
         print colored(
             "Je ne comprends pas votre ordre. retour en début de scéne.",
             'red')
         return DungeonGate()
Example #5
0
    def enter(self, map_instance, player_instance, cheatcode):

        # if the player has released is wife when in open in the Corridor
        if map_instance.explored_scenes['Cell'] == "explored":
            enemies = []

            # Define the number of enemies in the corridor
            if map_instance.explored_scenes['DungeonGate'] == "explored":
                pass
            else:
                a_heavyguard = HeavyGuard()
                enemies.append(a_heavyguard)

            if map_instance.explored_scenes['Dormitory'] == "explored":
                pass
            else:
                a_guard = Guard()
                enemies.append(a_guard)

            if not enemies:
                return Victory()
            else:
                print '_' * 40
                print texts.get("Corridor_fight").format(len(enemies))

                for enemi in enemies:
                    fight_result = player_instance.fight(
                        enemi.name, enemi.characteristics, cheatcode)

                    if fight_result == 'alive':
                        pass
                    else:
                        return Death()

                player_instance.print_charac()
                return Victory()

        else:
            print '_' * 40
            print texts.get(type(self).__name__)
            answer = raw_input("Réponse> ")

            if answer == cheatcode:
                print colored("ORDRE DES SALLES:", attrs=['bold'])
                i = 1

                for scene in map_instance.corridor_scenes:
                    print i, "-", type(scene).__name__
                    i += 1

                return Corridor()
            next_scene = map_instance.corridor_scenes[int(answer) - 1]

            # check if the selected scene is already explored or not
            if map_instance.explored_scenes[type(
                    next_scene).__name__] == "unexplored":
                return next_scene
            elif map_instance.explored_scenes[type(
                    next_scene).__name__] == "explored":
                print colored("Salle déja explorée", 'magenta')
                return Corridor()
            else:
                print colored(
                    "Je ne comprends pas votre ordre. retour en début de scéne.",
                    'red')
                return Corridor()
Example #6
0
 def enter(self):
     print texts.get(type(self).__name__)
     return Corridor()
Example #7
0
    def enter(self, map_instance, player_instance, cheatcode):
        print '_' * 40
        print texts.get(type(self).__name__)
        answer = raw_input('Réponse? ')
        if answer == '1':
            enemies = []
            # Define the number of enemies in the room
            if map_instance.explored_scenes['GuardsRoom'] == "explored":
                pass
            else:
                for i in range(2):
                    a_guard = Guard()
                    enemies.append(a_guard)

            if map_instance.explored_scenes['Dormitory'] == "explored":
                pass
            else:
                a_guard = Guard()
                enemies.append(a_guard)

            if not enemies:
                print texts.get('Armory_weapon')
                player_instance.characteristics['weapon'] += 2
                player_instance.print_charac()
                map_instance.explored_scenes['Armory'] = "explored"
                return Corridor()
            else:
                print '_' * 40
                print texts.get("Armory_fight").format(len(enemies))
                for enemi in enemies:
                    fight_result = player_instance.fight(
                        enemi.name, enemi.characteristics, cheatcode)

                    if fight_result == 'alive':
                        pass
                    else:
                        return Death()

                player_instance.characteristics['weapon'] += 2
                player_instance.print_charac()
                map_instance.explored_scenes['Armory'] = "explored"
                return Corridor()

        elif answer == '2':
            attempts = 0
            code = "{}{}{}".format(randint(0, 9), randint(0, 9), randint(0, 9))
            while attempts < 10:
                answer = raw_input("Code? ")

                if answer == code or answer == cheatcode:
                    print texts.get('Armory_weapon')
                    player_instance.characteristics['weapon'] += 2
                    map_instance.explored_scenes['Armory'] = "explored"
                    player_instance.print_charac()
                    return Corridor()

                else:
                    attempts += 1
                    hint = ['*', '*', '*']
                    for character in answer:
                        for i in range(len(code)):
                            if character == code[i]:
                                hint[i] = character
                    print "Hint:", "".join(map(str, hint))

            print "vous avez fait trop de tentatives. Revenez plus tard."
            return Corridor()

        elif answer == '3':
            return Corridor()
        else:
            print colored(
                "Je ne comprends pas votre ordre. retour en début de scéne.",
                'red')
            return Armory()
Example #8
0
 def enter(self):
     print '_' * 40
     print texts.get(type(self).__name__)
     exit(0)
Example #9
0
 def enter(self):
     print '_' * 40
     print colored(texts.get(type(self).__name__), 'red')
     exit(0)