コード例 #1
0
ファイル: game.py プロジェクト: greenfox-academy/bodonyidani
def run_roll_stats_submenu():
    roll_stats_submenu.print_menu()
    userinput = roll_stats_submenu.store_selection()
    if userinput not in roll_stats_submenu.valid_inputs():
        print_error_message()
        return run_roll_stats_submenu()
    else:
        return roll_stats_submenu.choose(userinput)
コード例 #2
0
ファイル: game.py プロジェクト: greenfox-academy/bodonyidani
def run_new_game_submenu():
    new_game_submenu.print_menu()
    userinput = new_game_submenu.store_selection()
    if userinput not in new_game_submenu.valid_inputs():
        print_error_message()
        return run_new_game_submenu()
    else:
        return new_game_submenu.choose(userinput)
コード例 #3
0
ファイル: game.py プロジェクト: greenfox-academy/bodonyidani
def run_quit_submenu():
    quit_submenu.print_menu()
    userinput = quit_submenu.store_selection()
    if userinput not in quit_submenu.valid_inputs():
        print_error_message()
        return run_quit_submenu()
    else:
        return quit_submenu.choose(userinput)
コード例 #4
0
ファイル: game.py プロジェクト: greenfox-academy/bodonyidani
def run_main_menu():
    main_menu.print_menu()
    userinput = main_menu.store_selection()
    if userinput not in main_menu.valid_inputs():
        print_error_message()
        return run_main_menu()
    else:
        return main_menu.choose(userinput)
コード例 #5
0
def choose_option():
    display.print_menu(dict_menu_options)
    user_choice = display.get_user_input("What'cha wanna do?: ")

    if user_choice in dict_menu_options.keys():
        dict_menu_options[user_choice]["func"]()
    else:
        display.print_error_message("Hold your horses! No such option.")
コード例 #6
0
ファイル: game.py プロジェクト: greenfox-academy/bodonyidani
def run_begin_submenu():
    player.print_character()
    begin_submenu.print_menu()
    userinput = begin_submenu.store_selection()
    if userinput not in begin_submenu.valid_inputs():
        print_error_message()
        return run_begin_submenu()
    else:
        return begin_submenu.choose(userinput)
コード例 #7
0
ファイル: game.py プロジェクト: greenfox-academy/bodonyidani
def run_test_fight_submenu():
    player.print_character_in_fight()
    monster.print_monster_in_fight()
    test_fight_submenu.print_menu()
    userinput = test_fight_submenu.store_selection()
    if userinput not in test_fight_submenu.valid_inputs():
        print_error_message()
        return run_test_fight_submenu()
    else:
        return test_fight_submenu.choose(userinput)
コード例 #8
0
ファイル: game.py プロジェクト: greenfox-academy/bodonyidani
def run_strike_submenu():
    strike_submenu.print_menu()
    userinput = strike_submenu.store_selection()
    loser = battle.query_loser()
    if userinput not in strike_submenu.valid_inputs():
        print_error_message()
        return run_strike_submenu()
    elif loser == None:
        return run_test_fight_submenu()
    elif userinput == "C":
        loser.suffer_damage(2)
        return strike_submenu.choose(userinput)
    else:
        return strike_submenu.choose(userinput)
コード例 #9
0
ファイル: game.py プロジェクト: greenfox-academy/bodonyidani
def run_select_potion_submenu():
    select_potion_submenu.print_menu()
    userinput = select_potion_submenu.store_selection()
    if userinput not in select_potion_submenu.valid_inputs():
        print_error_message()
        return run_select_potion_submenu()
    else:
        if userinput == "D":
            player.set_potion("POTION OF DEXTERITY")
        elif userinput == "H":
            player.set_potion("POTION OF HEALTH")
        elif userinput == "L":
            player.set_potion("POTION OF LUCK")
        print_skulls()
        print(" Are you sure you don't want to change your mind?")
        print_skulls()
        return select_potion_submenu.choose(userinput)
コード例 #10
0
import sys
from analyse import analyse
from display import print_word_info, print_error_message

if len(sys.argv) < 2:
    print_error_message(
        'Ooops, something went wrong. Have you supplied a word to be approximated?'
    )
    exit(1)

actual_arguments = sys.argv[1:]
word = ' '.join(actual_arguments)

try:
    info = analyse(word)
    print_word_info(info)
except:
    print_error_message('Ooops, something went wrong internally!')