execute as @a[tag=!AnimesWg] run function start

execute as @e[family=!attack,family=!inanimate,type=!item,type=!player,type=!xp_orb] at @s[tag=!mob] run scoreboard players set @s wg:animes 0
execute as @e[family=!attack,family=!inanimate,type=!item,type=!player,type=!xp_orb] at @s[tag=!mob] run scoreboard players set @s wg:characters 0
execute as @e[family=!attack,family=!inanimate,type=!item,type=!player,type=!xp_orb] at @s[tag=!mob] run tag @s add mob

tag @a[m=0,tag=!m0] add m0
tag @a[m=!0,tag=m0] remove m0

execute as @a[tag=eren] at @s run function attack_on_titan/eren
execute as @a[tag=titan_attack] at @s run function attack_on_titan/titan_attack
execute as @a[tag=reiner] at @s run function attack_on_titan/reiner
execute as @a[tag=titan_armored] at @s run function attack_on_titan/titan_armored
execute as @a[tag=asta] at @s run function black_clover/asta
execute as @a[tag=yamamoto] at @s run function bleach/yamamoto
execute as @a[tag=yamamoto_bankai] at @s run function bleach/yamamoto_bankai
execute as @a[tag=todoroki] at @s run function boku_no_hero/todoroki
execute as @a[tag=kuririn] at @s run function dragon_ball/kuririn
execute as @a[tag=gojo] at @s run function jujutsu_kaisen/gojo
execute as @a[tag=itadori] at @s run function jujutsu_kaisen/itadori
execute as @a[tag=escanor] at @s run function nanatsu_no_taizai/escanor
execute as @a[tag=luffy] at @s run function one_piece/luffy
execute as @a[tag=luffy_gear2] at @s run function one_piece/luffy_gear2
execute as @a[tag=luffy_gear5] at @s run function one_piece/luffy_gear5
execute as @a[tag=jinwoo] at @s run function solo_leveling/jinwoo

scoreboard players set @a[scores={wg:power=..-1}] wg:power 0
scoreboard players set @a[scores={wg:power=101..}] wg:power 100

scoreboard players set @a[scores={wg:animes=..-1}] wg:animes 0
scoreboard players set @a[scores={wg:animes=11..}] wg:animes 10

scoreboard players set @a[scores={wg:characters=..0}] wg:characters 1
scoreboard players set @a[scores={wg:characters=5..}] wg:characters 4

tag @a[tag=!transform,scores={wg:transform=1..}] add transform
tag @a[tag=transform,scores={wg:transform=!1..}] remove transform

tag @a[tag=!cutscene,scores={wg:cutscene=1..}] add cutscene
tag @a[tag=cutscene,scores={wg:cutscene=!1..}] remove cutscene

execute as @a[scores={wg:animes=1,wg:characters=2},tag=!cutscene,tag=!transform] at @s[tag=!is_sneaking,tag=!skill] positioned ~~5.5~ run camera @s set minecraft:free ease 0.1 linear pos ^^^-4 rot ~15~
execute as @a[scores={wg:animes=1,wg:characters=22},tag=!cutscene,tag=!transform] at @s[tag=!is_sneaking,tag=!skill] positioned ~~5.5~ run camera @s set minecraft:free ease 0.1 linear pos ^^^-4 rot ~15~
execute as @a[scores={wg:animes=1,wg:characters=4},tag=!cutscene,tag=!transform] at @s[tag=!is_sneaking,tag=!skill] positioned ~~6~ run camera @s set minecraft:free ease 0.1 linear pos ^^^-4 rot ~15~
execute as @a[scores={wg:animes=7,wg:characters=1},tag=!cutscene,tag=!transform] at @s[tag=!is_sneaking,tag=!skill] positioned ~~3.5~ run camera @s set minecraft:free ease 0.1 linear pos ^^^-4 rot ~15~

##execute as @a[scores={wg:animes=!0,wg:characters=!0},tag=!cutscene,tag=!transform] at @s[tag=!is_sneaking,tag=!skill_distance,tag=!skill] positioned ~~3~ run camera @s set minecraft:free ease 0.1 linear pos ^^^-4 rot ~15~
##execute as @a[scores={wg:animes=!0,wg:characters=!0},tag=!cutscene,tag=!transform] at @s[tag=skill_distance,tag=!skill] positioned ~~3.5~ run camera @s set minecraft:free ease 0.1 linear pos ^^^-5 rot ~20~

#execute as @a[tag=camera_mode] at @s[tag=!skill_distance,tag=!skill] positioned ~~1.5~ run camera @s set minecraft:free ease 0.1 linear pos ^^^-5 rot ~~
#execute as @a[tag=camera_mode] at @s[tag=skill_distance,tag=!skill] positioned ~~1.5~ run camera @s set minecraft:free ease 0.1 linear pos ^^^-7 rot ~~