示例#1
0
def decied_card_to_play():
    global card_to_play

    if Game_REWRITE.com3_turn == True:
        messagebox.showinfo("Exploding Kittens Game",
                            "It is currently com 3's turn.")

        print("Com 3's hand: " + str(DTCP.com3_cards))

        card_to_play = random.choice(DTCP.com3_cards)

        print("Card Com 3's going to play " + str(card_to_play))

        get_rid_of_card(card_to_play)
        check_card_to_play(card_to_play)

        CC3CP.check_card_played()
        def card7_command():
            # Checks if it's  the players turn
            if Game_REWRITE.player_turn == True:
                Game_REWRITE.discard_pile_text.set(card_to_display + "\n \n \n") # Sets the discard pile display text to the card that you've played

                show_card7.destroy() # Destroys the card

                Game_REWRITE.card7_played = True # Sets the bollen from the Game_REWRITE script to True

                Game_REWRITE.player_cards[6] = "" # Assigns the empty slot to the played card

                CCP.check_card_to_play(card_to_display) # Checks the card, so it can do its respected function

            # Checks if com 1 played a favor
            elif C1B.card_to_play == "favor":
                favoraction = messagebox.askyesno("Exploding Kittens Game","Are you sure you want to give com1 your " + card_to_display, icon = "warning") # Asks the player for if they a sure they want to give that card to com 1

                # Checks if the player clicked on "yes"
                if favoraction == True:
                    messagebox.showinfo("Exploding Kittens Game", "You have given com1 your " + card_to_display) # Tells the player that there card was add to com 1's hand

                    Game_REWRITE.card7_played = True # Sets the bollen from the Game_REWRITE script to True

                    C1B.card_to_play = "" # Sets com 1's card to play to an empty string so the the next time the player goes to click on another card this if statement doesn't repeat

                    show_card7.destroy() # Destroys the card

                    Game_REWRITE.player_cards[6] = "" # Assigns the empty slot to the given card

                    CC1CP.draw_card() # Makes com 1 draw a card
                else:
                    messagebox.showerror("Exploding Kittens Game", "You have not given your card to com1") # Tells the player that the card that they clicked on wasn't given to com 1

            # Checks if com 2 played a favor
            elif C2B.card_to_play == "favor":
                favoraction = messagebox.askyesno("Exploding Kittens Game","Are you sure you want to give com2 your " + Game_REWRITE.CARDS_IN_HAND7, icon = "warning")

                # Checks if the player clicked on yes
                if favoraction == True:
                    messagebox.showinfo("Exploding Kittens Game", "You have given com2 your " + Game_REWRITE.CARDS_IN_HAND7)
                    Game_REWRITE.card7_played = True
                    C2B.card_to_play = ""

                    show_card7.destroy()
                    Game_REWRITE.player_cards[6] = ""

                    CC2CP.draw_card()

                else:
                    messagebox.showerror("Exploding Kittens Game", "You have not given your card to com 2")

            # Checks if com 3 played a favor
            elif C3B.card_to_play == "favor":
                favoraction = messagebox.askyesno("Exploding Kittens Game","Are you sure you want to give com 3 your " + Game_REWRITE.CARDS_IN_HAND7, icon = "warning")

                # Checks if the player clicked on yes
                if favoraction == True:
                    messagebox.showinfo("Exploding Kittens Game", "You have given com 3 your " + Game_REWRITE.CARDS_IN_HAND7)
                    Game_REWRITE.card7_played = True
                    C3B.card_to_play = ""

                    show_card7.destroy()
                    Game_REWRITE.player_cards[6] = ""

                    CC3CP.add_favor_or_stolen_card(Game_REWRITE.CARDS_IN_HAND7)

                    CC3CP.draw_card()

                else:
                    messagebox.showerror("Exploding Kittens Game", "You have not given your card to com 3")

            else:
                messagebox.showerror('Exploding Kittens Game', "Sorry, it's not your turn") # Tells the player that it's not there turn