Esempio n. 1
0
def cellar(p: Player, scr: Screen) -> bool:

    cards = [i for i in p.current_hand]

    scr.show_main_content([
        "Which cards do you want to discard?",
        "Separate your choices with a comma."
    ] + format_cards(cards, r_main_content.width))

    chosen_cards = input_cards_selection(cards,
                                         scr,
                                         min=1,
                                         max=len(p.current_hand))

    if chosen_cards == []: return False

    p.add_actions(1, scr)

    for card in chosen_cards:
        scr.log("Discarding: {0}".format(card.name))
        p.current_hand.remove(card.name)
        p.discardpile.append(card.name)

    p.draw_cards(len(chosen_cards), scr)

    return True
Esempio n. 2
0
def end_turn(p: Player, scr: Screen) -> None:
    scr.clear_main_content()
    scr.clear_history()

    # Reset player balance
    p.current_hand_balance = 0
    p.bonus_coins = 0
    p.amount_spent = 0

    if session_objects.s_game_mode == "castle race":
        if any(card == "castle" for card in p.deck):
            scr.log("=== GAME WON ===", 1)
            scr.log("You've won the castle race!")
            scr.log("Turns taken: " + str(session_objects.s_turn_counter), 1)
            scr.log("Press enter to exit.", 2)
            scr.retrieve_user_input()
            exit(0)

    p.played_cards_to_discard()

    # Put all remaining cards in hard onto the discard pile
    scr.log("Putting hand cards in discard pile...")
    p.hand_to_discard()

    # Draw 5 cards
    p.draw_cards(5, scr, verbose=False)

    scr.log("Ended turn.")
Esempio n. 3
0
def start_new_game(p: Player, scr) -> None:
    """
    Function that gets called at the start of a new game.

    p: The player object to start the game with.
    """
    # Reset turn counter
    session_objects.s_turn_counter = 0
    
    # Add starter cards into deck
    p.deck = ["copper coin"] * 7
    p.deck += ["land"] * 3
    
    # Copy deck into drawpile
    p.drawpile = p.deck.copy()

    # shuffle draw pile
    random.shuffle(p.drawpile)

    # Draw 5 cards
    p.draw_cards(5, main_screen, verbose=False)
Esempio n. 4
0
def smithy(p: Player, scr: Screen) -> bool:
    p.draw_cards(3, scr)
    return True
Esempio n. 5
0
def magic_spell(p: Player, scr: Screen) -> bool:
    p.draw_cards(2, scr)
    return True
Esempio n. 6
0
def laboratory(p: Player, scr: Screen) -> bool:

    p.draw_cards(2, scr)
    p.add_actions(1, scr)
    return True
Esempio n. 7
0
def council(p: Player, scr: Screen) -> bool:

    p.draw_cards(4, scr)
    p.add_purchases(1, scr)
    return True
Esempio n. 8
0
def village(p: Player, scr: Screen) -> bool:
    p.add_actions(2, scr)
    p.draw_cards(1, scr)
    return True