Esempio n. 1
0
def gift_card(p: Player, card: str, scr, pile: str = None) -> bool:
    """
    Gifts a player a certain card. 
    """
    if pile is None:
        pile = "discard"

    # Card doesn't exist in the store
    if card not in s_store.keys():
        scr.log("This card doesn't exist in the store!", 2)
        return False

    # Card has 0 left in the store
    elif s_store.get(card) == 0:
        scr.log("There are no more copies left of this card.", 2)
        return False

    else:
        scr.log("Received card: " + card, 1)

        # Decide where to add the card
        if pile == "hand":
            p.add_hand_card(card)
        elif pile == "draw":
            p.add_drawpile_card(card)
        else:
            p.add_discardpile_card(card)

        remove_card(card, scr)
        return True