{
  "format_version": "1.10.0",
  "animation_controllers": {
    "controller.animation.npc.rumiaex.skill_attack": {
      "states": {
        "default": {
          "transitions": [
            {
              "checkdomain": "q.property('attack:state') == 'domain' && q.scoreboard('stun') == 0 && q.scoreboard('has_skill') == 0"
            }
             ],
            "on_entry": [
              "/tag @s remove domain:clash",
              "@s attack_state:idle",
            "/event entity @s[scores={stun=0}] cooldownAttack",
              "/tag @s remove hasDomain",
              "/tag @s remove hitboxIframe",
              "/tag @s remove domainActive",
              "/scoreboard players add @e[r=15,scores={domainclash=1..}] emotionP 25",
              "/scoreboard players set @s domainclash 0",
              "/event entity @s[scores={stun=0}] movement:walk",
              "/tag @s remove hasSkill",
              "/scoreboard players set @s has_skill 0"
              ]
        },
        "checkdomain": {
          "transitions": [
            {
              "default": "q.scoreboard('domainclash') == -100"
            },
            {
              "opendomain": "q.scoreboard('domainclash') == -101"
            },
            {
              "clashdomain": "q.scoreboard('domainclash') == 1"
            }
            ],
          "on_entry": [
            "@s movement:stop",
            "/function domain/checkNearbyDomain"
            ],
          "on_exit":[
            "/execute as @s[scores={domainclash=-102}] at @s run say Clashing",
            "/execute as @s[scores={domainclash=-101}] at @s run say Open",
            "/execute as @s[scores={domainclash=-100}] at @s run say Other Domain Near"
            ]
        },
        "opendomain": {
          "transitions": [
            {
              "clashdomain": "q.scoreboard('domainclash') == 1"
            },
            {
              "releasedomain": "q.scoreboard('domainclash') == 0 && q.any_animation_finished"
            },
            {
              "default": "q.scoreboard('stun') > 0"
            }
            ],
            "animations": [
              "rumiaex.skill_attack"
              ],
            "on_entry": [
              "/tag @s remove domain:clashing",
              "/tag @s add domain:open",
              "/scoreboard players set @s domainclash 0",
              "/scoreboard players set @s has_skill 1",
              "/tag @s add hasSkill",
              "/tag @s add hasDomain",
              "/tag @s add hitboxIframes"
              ]
        },
        "clashdomain": {
          "animations": [
            "rumiaex.skill_attack.clash"
            ],
          "transitions": [
            {
              "default": "q.scoreboard('domainclash') == -1"
            },
            {
              "releasedomain": "q.scoreboard('domainclash') == 2"
            }
            ],
            "on_entry": [
              "/scoreboard players set @s domainclash 1",
              "/tag @s remove domain:open",
              "/scoreboard players set @e[r=15,tag=domain:open] domainclash 1",
              "/tag @s add domain:clashing"
              ],
            "on_exit":[
              "/tag @s remove domain:clashing",
              "/scoreboard players set @s[tag=trait:shortcd] skillatk_cd 140",
              "/scoreboard players set @s[tag=!trait:shortcd,tag=!trait:longcd] skillatk_cd 200",
              "/scoreboard players set @s[tag=trait:longcd] skillatk_cd 240"
              ]
        },
        "releasedomain": {
          "animations": [
            "rumiaex.skill_attack.release"
            ],
          "transitions": [
            {
              "default": "q.any_animation_finished || q.scoreboard('stun') > 0"
            }
            ],
          "on_entry": [
            "/tag @s add rumiaPull",
            "/tag @s add domain:active",
            "/tag @s remove domain:open",
            "/function domain/rumiaOpen"
            ],
          "on_exit": [
            "/particle rumia:vfx7",
            "/tag @s remove rumiaPull",
            "/tag @s remove domain:active",
            "/tag @s add domainActive",
              "@s movement:walk",
              "/tag @s remove hasSkill",
              "/scoreboard players set @s has_skill 0",
              "/scoreboard players set @s[tag=trait:shortcd] skillatk_cd 140",
              "/scoreboard players set @s[tag=!trait:shortcd,tag=!trait:longcd] skillatk_cd 200",
              "/scoreboard players set @s[tag=trait:longcd] skillatk_cd 240"
              ]
        }
      }
    }
  }
}