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

#base powerup
execute if entity @s[team=blue,scores={poweruptime=999}] unless entity @e[tag=base_barrier_blue] run summon armor_stand -16 148 41 {Invisible:1,Small:1,NoGravity:1,Marker:1,Tags:["base_barrier","base_barrier_blue"],Rotation:[-90.0f,0.0f]}
execute if entity @s[team=red,scores={poweruptime=999}] unless entity @e[tag=base_barrier_red] run summon armor_stand 75 148 129 {Invisible:1,Small:1,NoGravity:1,Marker:1,Tags:["base_barrier","base_barrier_red"],Rotation:[90.0f,0.0f]}
execute if entity @s[team=green,scores={poweruptime=999}] unless entity @e[tag=base_barrier_green] run summon armor_stand 72 148 38 {Invisible:1,Small:1,NoGravity:1,Marker:1,Tags:["base_barrier","base_barrier_green"],Rotation:[0.0f,0.0f]}
execute if entity @s[team=yellow,scores={poweruptime=999}] unless entity @e[tag=base_barrier_yellow] run summon armor_stand -13 148 132 {Invisible:1,Small:1,NoGravity:1,Marker:1,Tags:["base_barrier","base_barrier_yellow"],Rotation:[180.0f,0.0f]}

##kill
execute if entity @s[team=blue] if entity @p[team=!blue,tag=blue_base,gamemode=adventure,scores={kill-timer=0}] run tag @s add killer
execute if entity @s[team=red] if entity @p[team=!red,tag=red_base,gamemode=adventure,scores={kill-timer=0}] run tag @s add killer
execute if entity @s[team=green] if entity @p[team=!green,tag=green_base,gamemode=adventure,scores={kill-timer=0}] run tag @s add killer
execute if entity @s[team=yellow] if entity @p[team=!yellow,tag=yellow_base,gamemode=adventure,scores={kill-timer=0}] run tag @s add killer

execute if entity @s[team=blue] as @a[team=!blue,tag=blue_base,gamemode=adventure,scores={kill-timer=0}] run function f:game/kill/kill
execute if entity @s[team=red] as @a[team=!red,tag=red_base,gamemode=adventure,scores={kill-timer=0}] run function f:game/kill/kill
execute if entity @s[team=green] as @a[team=!green,tag=green_base,gamemode=adventure,scores={kill-timer=0}] run function f:game/kill/kill
execute if entity @s[team=yellow] as @a[team=!yellow,tag=yellow_base,gamemode=adventure,scores={kill-timer=0}] run function f:game/kill/kill

##particles
execute as @e[tag=base_barrier] at @s run tp @s ^ ^ ^0.3
execute as @e[tag=base_barrier,tag=!coral] at @s if block ~ ~ ~ dead_tube_coral_fan align xyz run tp @s ~0.5 ~ ~0.5 ~-90 ~
execute as @e[tag=base_barrier] at @s if block ~ ~ ~ dead_tube_coral_fan run tag @s add coral
execute as @e[tag=base_barrier] at @s unless block ~ ~ ~ dead_tube_coral_fan run tag @s remove coral
execute at @e[tag=base_barrier] run particle minecraft:block_marker barrier ~ ~1 ~ 0 0 0 0 1 force @a