#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#
#    This function has been created by Skilendarz Group.
#             https://skilendarz.com
#
#      GIVE MAP MAKERS THE CREDIT THEY DESERVE!
#             COPYING IS PROHIBITED!
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

scoreboard players add @s dabdab 1
scoreboard players add @s dab_mode 0
execute if entity @s[team=lobby] run scoreboard players add @s shift 1
execute if score @s shift matches 100.. at @e[tag=dab] run particle cloud ~ ~1 ~ 0.1 0.3 0.1 0 10
execute if score @s shift matches 100.. run kill @e[tag=dab]

execute if score @s dabdab matches 1 run scoreboard players set @e[tag=dab] hitbox_x 0
execute if score @s dabdab matches 1 run scoreboard players set @e[tag=dab] hitbox_y 0
execute if score @s dabdab matches 1..6 run scoreboard players remove @e[tag=dab] hitbox_x 16
execute if score @s dabdab matches 1..6 run scoreboard players remove @e[tag=dab] hitbox_y 4
execute if score @s dabdab matches 7 run scoreboard players remove @e[tag=dab] hitbox_x 8
execute if score @s dabdab matches 7 run scoreboard players remove @e[tag=dab] hitbox_y 2
execute if score @s dabdab matches 8 run scoreboard players add @e[tag=dab] hitbox_x 8
execute if score @s dabdab matches 8 run scoreboard players add @e[tag=dab] hitbox_y 2
execute if score @s dabdab matches 9..14 run scoreboard players add @e[tag=dab] hitbox_x 16
execute if score @s dabdab matches 9..14 run scoreboard players add @e[tag=dab] hitbox_y 4

execute if score @s dabdab matches 14 run scoreboard players add @s dab_mode 1
execute if score @s dabdab matches 14.. run scoreboard players set @s dabdab 0


execute as @e[tag=dab] run data merge entity @s {Pose:{RightArm:[0.01f,0.01f,0.01f],LeftArm:[0.01f,0.01f,0.01f],Head:[0.01f,0.01f,0.01f]}}
execute if score @s dab_mode matches 2.. run scoreboard players set @s dab_mode 0
execute if score @s dab_mode matches 0 as @e[tag=dab] store result entity @s Pose.RightArm[0] float 1 run scoreboard players get @s hitbox_x
execute if score @s dab_mode matches 0 as @e[tag=dab] store result entity @s Pose.RightArm[1] float 1 run scoreboard players get @s hitbox_y
execute if score @s dab_mode matches 0 as @e[tag=dab] store result entity @s Pose.LeftArm[0] float 1 run scoreboard players get @s hitbox_y
execute if score @s dab_mode matches 0 as @e[tag=dab] store result entity @s Pose.LeftArm[2] float 1 run scoreboard players get @s hitbox_x
execute if score @s dab_mode matches 0 as @e[tag=dab] store result entity @s Pose.Head[1] float -0.3 run scoreboard players get @s hitbox_x

execute as @e[tag=dab] store result entity @s Pose.Head[0] float -0.3 run scoreboard players get @s hitbox_x


execute if score @s dab_mode matches 1 as @e[tag=dab] store result entity @s Pose.RightArm[0] float 1 run scoreboard players get @s hitbox_y
execute if score @s dab_mode matches 1 as @e[tag=dab] store result entity @s Pose.RightArm[2] float -1 run scoreboard players get @s hitbox_x
execute if score @s dab_mode matches 1 as @e[tag=dab] store result entity @s Pose.LeftArm[0] float 1 run scoreboard players get @s hitbox_x
execute if score @s dab_mode matches 1 as @e[tag=dab] store result entity @s Pose.LeftArm[1] float -1 run scoreboard players get @s hitbox_y
execute if score @s dab_mode matches 1 as @e[tag=dab] store result entity @s Pose.Head[1] float 0.3 run scoreboard players get @s hitbox_x