event entity @s deck
tp @s @e[tag=topdummy]
execute @s ~ ~ ~ tp @s ~ ~ ~ 45 ~
playanimation @s deck_reshuffled



#tag
tag @s remove table
tag @s add deck

tag @s[tag=red_plus4] add plus4
tag @s[tag=blue_plus4] add plus4
tag @s[tag=green_plus4] add plus4
tag @s[tag=yellow_plus4] add plus4

tag @s[tag=red_wild] add wild
tag @s[tag=blue_wild] add wild
tag @s[tag=green_wild] add wild
tag @s[tag=yellow_wild] add wild

tag @s remove red_wild
tag @s remove blue_wild
tag @s remove green_wild
tag @s remove yellow_wild

tag @s remove red_plus4
tag @s remove blue_plus4
tag @s remove green_plus4
tag @s remove yellow_plus4


tag @s remove choose_red1
tag @s remove choose_red2
tag @s remove choose_red3
tag @s remove choose_red4
tag @s remove choose_blue1
tag @s remove choose_blue2
tag @s remove choose_blue3
tag @s remove choose_blue4
tag @s remove choose_green1
tag @s remove choose_green2
tag @s remove choose_green3
tag @s remove choose_green4
tag @s remove choose_yellow1
tag @s remove choose_yellow2
tag @s remove choose_yellow3
tag @s remove choose_yellow4


#event
event entity @e[tag=wild] spawn:wild
event entity @e[tag=plus4] spawn:plus4




scoreboard players remove @e[scores={tableorder=1..}] tableorder 1
scoreboard players reset @s tableorder

function count_cards