#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#
#    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 time 1
execute as @s[scores={time=1},tag=!fake_powerup] at @s run playsound minecraft:item.totem.use master @a[distance=..32] ~ ~ ~ 2 2
execute as @s[scores={time=1..20}] at @s run tp @s ~ ~0.1 ~ 
particle minecraft:cloud ~ ~1.2 ~ 0 0 0 0 10

execute positioned ~ ~-0.1 ~ run function f:game/powerup/particles
scoreboard players set @s tick 0

execute as @s[scores={time=21}] run playsound minecraft:block.beacon.ambient master @a[distance=..16] ~ ~ ~ 1
execute as @s[scores={time=21..25}] run tp @s ~ ~0.02 ~
execute as @s[scores={time=26..30}] run tp @s ~ ~-0.02 ~
execute as @s[scores={time=31..40}] run tp @s ~ ~-0.05 ~
execute as @s[scores={time=41..45}] run tp @s ~ ~-0.02 ~
execute as @s[scores={time=46..50}] run tp @s ~ ~0.02 ~
execute as @s[scores={time=51..60}] run tp @s ~ ~0.05 ~

scoreboard players set @s[scores={time=60..}] time 20
execute at @s run tp @s ~ ~ ~ ~10 ~

execute unless entity @s[tag=fake_powerup] positioned ~ ~0.3 ~ as @p[gamemode=!spectator,distance=..1.2] at @s run function f:game/powerup/random