Esempio n. 1
0
def goto_arena(character):
    """Enter the arena selection screen."""
    clear()
    print "Welcome to the:"
    print color("""
     _
    / \\   _ __ ___ _ __   __ _
   / _ \\ | '__/ _ \\ '_ \\ / _` |
  / ___ \\| | |  __/ | | | (_| |
 /_/   \\_\\_|  \\___|_| |_|\\__,_|
 """, "red")
    character.print_useful()
    arena_options = [make_option('Fight!', 'F', time=1, hp='?'),
                     make_option('Return to Town', 'T')]

    print nav_menu(arena_options)

    val = get_val("ft")

    clear()
    if val == "f":
        fight(character)
    elif val == "t":
        character.move("town", False)
    else:
        character.save_prompt()
        print "ERROR IN ARENA SELECT"
    return
def first(items):
    time_print(
        "You find yourself in front of a small wooden house surrounded by tall grass and giant oak trees."
    )
    if items['key'] == '1':
        lst = [
            "Boss isn't home right now.",
            "There doesn't seem to be much to do here.",
            "You head back into town."
        ]
        time_print_loop(lst)
        town(items)
    elif items['key'] == '2':
        lst = [
            "Boss comes out to greet you and notices '2' on you.",
            "She understands why you have come.",
            '''Boss- "I will not be intimidated by one of Boss's thugs."''',
            "Boss gets into a fighting stace and starts to glow bright green."
        ]
        time_print_loop(lst)
        fight(items)
    else:
        lst = [
            "Boss greets you.",
            "She peers curiously into your eyes and senses your pure heart.",
            "She asks you to be her student and to learn the ways of nature.",
            "Will you accept her offer?"
        ]
        time_print_loop(lst)
        answer = valid_input("Type (yes) or (no).\n", "yes", "no")
        if answer == "yes":
            lst1 = [
                "For the next year you spend every day with boss learning the ways of nature.",
                "You learn that she and the town have been under attack from Boss for many years.",
                "She wants you to end his reign of terror once and for all.",
                "She opens her hands, they glow bright green as she places them over your chest and says...",
                '"This is my most powerful technique name."',
                '"You are ready to face boss."', '"Go defeat him!"\n',
                "*You have gain the power of technique!*\n"
            ]
            time_print_loop(lst1)
            items['key'] = '1'
            time_print(
                "With the training from boss and the power of technique, you leave and head into town."
            )
            town(items)
        elif answer == "no":
            lst2 = [
                '''Boss - "I hope you will reconsider my offer." ''',
                "You leave the small house and return home."
            ]
            time_print_loop(lst2)
            town(items)
def second(items):
    time_print(
        "You find yourself in front of a large stone house surrounded by ancient sculpturs with characters carved into them."
    )
    if items['key'] == '2':
        lst = [
            "Boss isn't home right now.",
            "There doesn't seem to be much to do here.",
            "You head back into town."
        ]
        time_print_loop(lst)
        town(items)
    elif items['key'] == '1':
        lst = [
            "Boss comes out to greet you and notices '1' on you.",
            "He smiles at you and begins to glow bright red.",
            '''Boss- "I want the power of technique and i will crush you to take it."''',
            "Boss gets into a fighting stance."
        ]
        time_print_loop(lst)
        fight(items)
    else:
        lst = [
            "Boss greets you.",
            "He sizes you up and senses your desire for power.",
            "He asks you to be his student and to become a spiritual master.",
            "Will you accept his offer?"
        ]
        time_print_loop(lst)
        answer = valid_input("Type (yes) or (no).\n", "yes", "no")
        if answer == "yes":
            lst1 = [
                "For the next year you spend every day with boss learning spiritual techniques .",
                "You learn that he has been trying to take over the town and rule it for years.",
                "He wants you help him by defeating boss, the only peorson truly standing in his way.",
                "He opens his hands, they glow bright red as he places them over your chest and says...",
                '"This is my most powerful technique name."',
                '"You are ready to face boss."', '"Go defeat her!"\n',
                "*You have gain the power of technique!*\n"
            ]
            time_print_loop(lst1)
            items['key'] = '2'
            time_print(
                "With the training from boss and the power of technique, you leave and head into town."
            )
            town(items)
        elif answer == "no":
            lst2 = [
                '''Boss - "I hope you will reconsider my offer." ''',
                "You leave the large stone house and return home."
            ]
            time_print_loop(lst2)
            town(items)
Esempio n. 4
0
    def update_story(self, player, inventory):
        flag_quit = False
        locations = ['Castle', 'Cave', 'Shore', 'Mountains', 'Fortress']

        while (not (player.is_dead()) and not (flag_quit)):
            options = ['Quit the game', 'Explore the neighborhood', 'Rest and restore health']
            user_input = get_user_input(options)
            if (user_input == 1):  # Quit
                flag_quit = True
                print('Your adventure is terminated')
                print('')
            elif (user_input == 2):  # Esplora
                probability = 0.5
                go_into_battle = random.random() < probability
                if go_into_battle:
                    print('!!! You''ve found an opponent !!!')
                    fight(player, inventory, self)
                    print('')
                else:
                    random_location = random.choice(locations)
                    if (random_location == self.location):
                        random_location = random.choice(locations)
                    self.location = random_location
                    print('No one''s around. You''re moving to ' + self.location)
                    print('')

            elif (user_input == 3):  # Return
                player.rest()
                self.location = 'Home'
                print('')

            else:  # comando sbagliato
                print('Wrong command, retry')
                print('')

        if player.is_dead():
            print('Wasted')
Esempio n. 5
0
def execute_command(command):
    """This function takes a command (a list of words as returned by
    normalise_input) and, depending on the type of action (the first word of
    the command: "go", "take", or "drop"), executes either execute_go,
    execute_take, or execute_drop, supplying the second word as the argument.
    """
    #Clear the screen first!
    clear = lambda: os.system('cls')
    clear()
    if command:
        if command[0] == "go":
            if len(command) > 1:
                execute_go(command[1:])
            else:
                print("Go where?")

        elif command[0] == "take":
            if len(command) > 1:
                execute_take(command[1:])
            else:
                print("Take what?")

        elif command[0] == "equip":
            if len(command) > 1:
                equip_item(command[1:])
            else:
                print("Equip what?")

        elif command[0] == "unequip":
            if len(command) > 1:
                unequip_item(command[1:])
            else:
                print("Unequip what?")

        elif command[0] == "drop":
            if len(command) > 1:
                execute_drop(command[1:])
            else:
                if len(inventory) > 0:
                    for item in inventory:
                        name = str(item['id']).upper()
                        desc = str(item['name']).lower()
                        print("DROP %s to drop %s" % (name, desc))
                else:
                    print("You don't have anything to drop!")

        elif command[0] == "equipped":
            if len(command) == 1:
                equipped_items()

        elif command[0] == "examine":
            if len(command) == 1:
                print("Use EXAMINE followed by item name e.g. EXAMINE RUSTY SWORD")
            else:
                examine_item(command[1:])

        elif command[0] == "stats":
            if len(command) == 1:
                show_stats()

        elif command[0] == "inventory":
            if len(command) == 1:
                print_inventory_items(inventory)

        elif command[0] == "fight":
            if current_room['spawned']:
                fight(current_room['spawned']['id'], current_room)
            else:
                print("There is nothing to fight!")

        elif len(command) > 1:
            if command[0] == "open" and command[1] == "chest":
                if current_room['chest']:
                    open_chest()
                else:
                    print("There is chest to open!")

        else:
            print("This makes no sense.")
Esempio n. 6
0
 def test_three_on_one(self):
     joe = Player("Joe")
     steve = Player("Steve")
     mark = Player("Mark")
     darf = Mob("Darf")
     fight(joe, darf, steve, mark)
Esempio n. 7
0
 def test_one_on_one(self):
     joe = Player("Joe")
     darf = Mob("Darf")
     fight(joe, darf)
Esempio n. 8
0
        joueurlan.main()

    while Avancement.get_lancement() != True and Avancement.get_jeux(
    ) and Avancement.get_combat() != True and Avancement.get_pokedex(
    ) == False and Avancement.get_sac() == False and Avancement.get_shop(
    ) == False:
        for event in pygame.event.get():
            if event.type == pygame.QUIT: sys.exit()

        game.main()

    while Avancement.get_combat() == True:
        for event in pygame.event.get():
            if event.type == pygame.QUIT: sys.exit()

        combat = fight(screen, Avancement, player, game)
        combat.main()

    while Avancement.get_pokedex() == True:
        for event in pygame.event.get():
            if event.type == pygame.QUIT: sys.exit()

        affpokedex = pokedex(player, screen, Avancement)
        affpokedex.main()

    while Avancement.get_sac() == True:
        for event in pygame.event.get():
            if event.type == pygame.QUIT: sys.exit()
        sac = inventaire(screen, Avancement, player)
        sac.main()
Esempio n. 9
0
from fight import *

stop_program = False    

while stop_program != True:
    if fight(fp, sp) == True or fight(sp, fp) == True:
        stop_program = True
    
if fp.get_health() > sp.get_health():
    print('\n' + '[' + fp.get_nickname() + '] victory with ' + str(fp.get_health()) + ' health')
else:
    print('\n' + '['  + sp.get_nickname() + '] victory with ' + str(sp.get_health()) + ' health')
Esempio n. 10
0
def print_board(board, skills):
    move()
    take_item(item, skills)
    fight(live, skills)