Beispiel #1
0
def ask_about_resurrection(game, selected_player):
    player_cards = []
    for card in game.players[selected_player].cards:
        player_cards.append(card.name)
    if "Fresh Stert Club" in player_cards and test_game.will_you_protect(selected_player):
        test_game.on_play_card("Fresh Stert Club", selected_player)
        test_game.on_action_make("text")
        del (game.players[selected_player].cards[player_cards.index("Fresh Stert Club")])
        selected_region = test_game.select_region(list(range(0, 12)), selected_player)
        test_game.on_new_servant(selected_region, game.playing_player)
        game.players[selected_player].servants += 1
        game.desk.regions[selected_region].servants.append(selected_player)
        if len(game.desk.regions[selected_region].servants) > 1:
            test_game.on_new_problem(selected_region)
            game.desk.regions[selected_region].problem = True
        test_game.on_end_play_card(selected_player)
    elif "Igor" in player_cards and test_game.will_you_protect(selected_player):
        test_game.on_play_card("Igor", selected_player)
        del (game.players[selected_player].cards[player_cards.index("Igor")])
        selected_region = test_game.select_region(list(range(0, 12)), selected_player)
        test_game.on_new_servant(selected_region, game.playing_player)
        game.players[selected_player].servants += 1
        game.desk.regions[selected_region].servants.append(selected_player)
        if len(game.desk.regions[selected_region].servants) > 1:
            test_game.on_new_problem(selected_region)
            game.desk.regions[selected_region].problem = True
        test_game.on_end_play_card(selected_player)
Beispiel #2
0
def remove_problem(game):
    test_game.on_action_make("remove_problem")
    possible_regions = []
    for i in range(12):
        if game.desk.regions[i].problem:
            possible_regions.append(i)
    selected_region = test_game.select_region(possible_regions, game.playing_player)
    game.desk.regions[selected_region].problem = False
    test_game.on_remove_problem(selected_region)
Beispiel #3
0
def ask_about_saving_card(game, selected_card):
    player_cards = []
    for card in game.players[game.playing_player].cards:
        player_cards.append(card.name)
    if "Doctor Mossy Lawn" in player_cards and test_game.will_you_save_card(game.playing_player):
        test_game.on_play_card("Doctor Mossy Lawn", game.playing_player)
        test_game.on_action_make("text")
        del (game.players[game.playing_player].cards[player_cards.index("Doctor Mossy Lawn")])
        game.players[game.playing_player].cards.append(selected_card)
        test_game.on_end_play_card(game.playing_player)
Beispiel #4
0
def ask_about_text_protection(game, selected_player):
    player_cards = []
    for card in game.players[selected_player].cards:
        player_cards.append(card.name)
    if "Wallace Sonky" in player_cards:
        if test_game.will_you_ignore_text(selected_player):
            test_game.on_play_card("Wallace Sonky", selected_player)
            test_game.on_action_make("text")
            test_game.on_end_play_card(selected_player)
            del (game.players[selected_player].cards[player_cards.index("Wallace Sonky")])
            return True
        else:
            return False
    else:
        return False
Beispiel #5
0
def add_servant(game):
    test_game.on_action_make("add_servant")
    if game.players[game.playing_player].servants < 12:
        possible_regions = []
        for region in game.desk.regions:
            for neigbour in region.neigbours:
                if game.playing_player in game.desk.regions[neigbour].servants:
                    possible_regions.append(game.desk.regions.index(region))
        selected_region = test_game.select_region(list(set(possible_regions)), game.playing_player)
        test_game.on_new_servant(selected_region, game.playing_player)
        game.players[game.playing_player].servants += 1
        game.desk.regions[selected_region].servants.append(game.playing_player)
        if len(game.desk.regions[selected_region].servants) > 1:
            test_game.on_new_problem(selected_region)
            game.desk.regions[selected_region].problem = True
    else:
        remove_servant(game)
Beispiel #6
0
def ask_about_protection(game, selected_player):
    player_cards = []
    for card in game.players[selected_player].cards:
        player_cards.append(card.name)
    if "Gaspode" in player_cards:
        if test_game.will_you_protect(selected_player):
            test_game.on_play_card("Gaspode", selected_player)
            test_game.on_action_make("text")
            test_game.on_end_play_card(selected_player)
            del (game.players[selected_player].cards[player_cards.index("Gaspode")])
            return True
    elif "Susan" in player_cards:
        if test_game.will_you_protect(selected_player):
            test_game.on_play_card("Susan", selected_player)
            test_game.on_action_make("text")
            test_game.on_end_play_card(selected_player)
            del (game.players[selected_player].cards[player_cards.index("Susan")])
            return True
    else:
        return False
Beispiel #7
0
def build_house(game):
    possible_regions = []
    for region in game.desk.regions:
        if (
            (not region.problem)
            and game.players[game.playing_player].money >= region.costs
            and game.playing_player in region.servants
            and region.building == None
        ):
            possible_regions.append(game.desk.regions.index(region))
    if possible_regions != []:
        selected_region = test_game.select_region(possible_regions, game.playing_player)
        test_game.on_action_make("build_house")
        test_game.on_new_building(selected_region, game.playing_player)
        game.desk.regions[selected_region].played = True
        game.players[game.playing_player].money -= region.costs
        test_game.on_add_money(region.costs * (-1), game.playing_player)
        game.players[game.playing_player].buildings.append(selected_region)
        game.desk.regions[selected_region].building = game.playing_player
    else:
        pass
Beispiel #8
0
def kill_servant(game):
    test_game.on_action_make("kill_servant")
    possible_regions = []
    for region in game.desk.regions:
        if region.problem:
            possible_regions.append(game.desk.regions.index(region))
    selected_region = test_game.select_region(possible_regions, game.playing_player)
    selected_servant = test_game.select_servant(game.desk.regions[selected_region].servants, game.playing_player)
    test_game.on_remove_servant(selected_region, selected_servant)
    test_game.on_remove_problem(selected_region)
    if ask_about_protection(game, selected_servant):
        test_game.on_new_servant(selected_region, selected_servant)
        test_game.on_new_problem(selected_region)
    else:
        game.desk.regions[selected_region].problem = False
        del (
            game.desk.regions[selected_region].servants[
                game.desk.regions[selected_region].servants.index(selected_servant)
            ]
        )
        game.players[selected_servant].servants -= 1
        ask_about_resurrection(game, selected_servant)
Beispiel #9
0
def add_money_5(game):
    test_game.on_action_make("add_money")
    test_game.on_add_money(5, game.playing_player)
    game.players[game.playing_player].money += 5
Beispiel #10
0
def play_next_card(game):
    if test_game.will_you_play_another_card(game.playing_player):
        test_game.on_action_make("play_new_card")
        game.players[game.playing_player].play_card(game)