{
  "format_version": "1.10.0",
  "animation_controllers": {
    "controller.animation.basiccombat.ct": {
      "states": {
        "default": {
          "transitions": [
            {
              "ready": "q.is_alive"
            }
            ]
        },
        "ready": {
          "transitions": [
            {
              "armed": "q.equipped_item_any_tag('slot.weapon.mainhand','weapon:basiccombat')"
            }
            ],
          "on_entry": [
            "/scoreboard players set @s ba_attacking 0",
            "/tag @s remove basicAttack",
            "/scoreboard players set @s has_skill 0",
            "/event entity @s[scores={weaponTimer=0}] weapon_equip:unarmed",
            "/event entity @s[scores={weaponTimer=0}] weapon_name:none"
            ],
          "on_exit": [
            "/event entity @s weapon_equip:armed","/event entity @s weapon_name:remove2",
            "/event entity @s weapon_name:basiccombat"
            ]
        },
        "cooldown": {
          "transitions": [
            {
              "armed": "q.scoreboard('ba_cd') == 0"
            },
            {
              "ready": "q.all_animations_finished && !q.equipped_item_any_tag('slot.weapon.mainhand','weapon:anim') && !q.equipped_item_any_tag('slot.weapon.mainhand','weapon:moveset') && q.scoreboard('stun') == 0"
            }
            ],
          "on_entry": [
            "/scoreboard players set @s basic_attack 0"
            ]
        },
        "armed": {
          "transitions": [
            {
              "cooldown": "q.scoreboard('ba_cd') > 0"
            },
            {
              "attack": "q.property('weapon:name')=='basiccombat' && v.attack_time && q.scoreboard('stun') == 0 && !q.is_jumping && !q.is_sneaking && q.scoreboard('block') == 0 && q.scoreboard('has_skill') == 0"
            },
            {
              "ready": "q.all_animations_finished && !q.equipped_item_any_tag('slot.weapon.mainhand','weapon:anim') && !q.equipped_item_any_tag('slot.weapon.mainhand','weapon:moveset') && q.scoreboard('stun') == 0"
            }
             ],
          "on_entry": [
            "/scoreboard players set @s[scores={basic_attack=3..}] basic_attack 0"
            ],
            "on_exit": [
              "/scoreboard players add @s basic_attack 1"
              ]
        },
        "attack": {
          "transitions": [
            {
              "cooldown": "q.scoreboard('ba_cd') > 0"
            },
            {
              "armed": "q.any_animation_finished && q.scoreboard('ba_cd') == 0 || q.scoreboard('stun') > 0"
            }
            ],
            "animations": [
              {
                "basiccombat.basic1": "q.scoreboard('basic_attack') <= 1"
              },
              {
                "basiccombat.basic2": "q.scoreboard('basic_attack') == 2"
              },
              {
                "basiccombat.basic3": "q.scoreboard('basic_attack') == 3"
              }
              ],
            "on_entry": [
              "/scoreboard players set @s ba_attacking 1",
              "/tag @s add basicAttack",
              "/scoreboard players set @s ba_reset 40",
              "/playanimation @s[scores={basic_attack=1}] animation.basiccombat.basic1",
              "/playanimation @s[scores={basic_attack=2}] animation.basiccombat.basic2",
              "/playanimation @s[scores={basic_attack=3}] animation.basiccombat.basic3",
              "/playanimation @s[scores={basic_attack=4}] animation.basiccombat.basic4"
              ],
            "on_exit": [
              "/scoreboard players set @s ba_attacking 0",
              "/tag @s remove basicAttack",
              "/scoreboard players set @s[scores={basic_attack=3..}] ba_cd 40"
              ]
        }
      }
    },
    "controller.animation.basiccombat.charged_attack": {
      "states": {
        "default": {
          "transitions": [
            {
              "ready": "q.is_alive"
            }
            ]
        },
        "ready": {
          "transitions": [
            {
              "armed": "q.equipped_item_any_tag('slot.weapon.mainhand','weapon:basiccombat')"
            }
            ],
          "on_entry": [
            "/scoreboard players set @s ba_attacking 0",
            "/tag @s remove basicAttack",
            "/scoreboard players set @s has_skill 0",
            "/event entity @s[scores={weaponTimer=0}] weapon_equip:unarmed",
            "/event entity @s[scores={weaponTimer=0}] weapon_name:none"
            ],
          "on_exit": [
            "/event entity @s weapon_equip:armed","/event entity @s weapon_name:remove2",
            "/event entity @s weapon_name:basiccombat"
            ]
        },
        "cooldown": {
          "transitions": [
            {
              "armed": "q.scoreboard('chargedatk_cd') == 0"
            },
            {
              "ready": "q.all_animations_finished && !q.equipped_item_any_tag('slot.weapon.mainhand','weapon:basiccombat') && !q.equipped_item_any_tag('slot.weapon.mainhand','weapon:moveset') && q.scoreboard('stun') == 0"
            }
            ]
        },
        "armed": {
          "transitions": [
            {
              "cooldown": "q.scoreboard('chargedatk_cd') > 0"
            },
            {
              "attack": "q.property('weapon:name')=='basiccombat' && v.attack_time && q.scoreboard('stun') == 0 && !q.is_jumping && q.is_sneaking && q.scoreboard('has_skill') == 0 && q.scoreboard('ba_attacking') == 0"
            },
            {
              "ready": "q.all_animations_finished && !q.equipped_item_any_tag('slot.weapon.mainhand','weapon:basiccombat') && !q.equipped_item_any_tag('slot.weapon.mainhand','weapon:moveset') && q.scoreboard('stun') == 0"
            }
             ]
        },
        "attack": {
          "transitions": [
            {
              "cooldown": "q.scoreboard('chargedatk_cd') > 0"
            },
            {
              "armed": "q.any_animation_finished && q.scoreboard('chargedatk_cd') == 0 || q.scoreboard('stun') > 0 || q.scoreboard('clashing') > 0"
            }
            ],
            "animations": [
              "basiccombat.charged_attack"
              ],
            "on_entry": [
              "@s movement:stop",
              "/scoreboard players set @s has_skill 1",
              "/tag @s add hasSkill",
              "/playanimation @s animation.basiccombat.charged_attack"
              ],
            "on_exit": [
              "/tag @s remove hasSkill",
              "@s movement:walk",
              "/scoreboard players set @s has_skill 0",
              "/scoreboard players set @s[tag=trait:shortcd] chargedatk_cd 100",
              "/scoreboard players set @s[tag=!trait:shortcd,tag=!trait:longcd] chargedatk_cd 200",
              "/scoreboard players set @s[tag=trait:longcd] chargedatk_cd 300"
              ]
        }
      }
    },
    "controller.animation.basiccombat.skill_attack": {
      "states": {
        "default": {
          "transitions": [
            {
              "ready": "q.is_alive"
            }
            ]
        },
        "ready": {
          "transitions": [
            {
              "armed": "q.equipped_item_any_tag('slot.weapon.mainhand','weapon:basiccombat')"
            }
            ],
          "on_entry": [
            "/scoreboard players set @s ba_attacking 0",
            "/tag @s remove basicAttack",
            "/scoreboard players set @s has_skill 0",
            "/event entity @s[scores={weaponTimer=0}] weapon_equip:unarmed",
            "/event entity @s[scores={weaponTimer=0}] weapon_name:none"
            ],
          "on_exit": [
            "/event entity @s weapon_equip:armed","/event entity @s weapon_name:remove2",
            "/event entity @s weapon_name:basiccombat"
            ]
        },
        "cooldown": {
          "transitions": [
            {
              "armed": "q.scoreboard('skillatk_cd') == 0"
            },
            {
              "ready": "q.all_animations_finished && !q.equipped_item_any_tag('slot.weapon.mainhand','weapon:basiccombat') && !q.equipped_item_any_tag('slot.weapon.mainhand','weapon:moveset') && q.scoreboard('stun') == 0"
            }
            ]
        },
        "armed": {
          "transitions": [
            {
              "cooldown": "q.scoreboard('skillatk_cd') > 0"
            },
            {
              "attack": "q.equipped_item_any_tag('slot.weapon.mainhand','weapon:basiccombat') && q.property('weapon:name')=='basiccombat' && q.is_using_item && q.scoreboard('stun') == 0 && !q.is_jumping && !q.is_sneaking && !q.is_sprinting && q.scoreboard('has_skill') == 0 && q.scoreboard('ba_attacking') == 0 && q.scoreboard('headrot') > -5"
            },
            {
              "ready": "q.all_animations_finished && !q.equipped_item_any_tag('slot.weapon.mainhand','weapon:basiccombat') && !q.equipped_item_any_tag('slot.weapon.mainhand','weapon:moveset') && q.scoreboard('stun') == 0"
            }
             ],
             "on_entry": [
              "/tag @s remove grab:entityA",
            "/inputpermission set @s[scores={stun=0}] lateral_movement enabled"
            ]
        },
        "attack": {
          "transitions": [
            {
              "armed": "q.any_animation_finished || q.scoreboard('stun') > 0"
            }
            ],
            "animations": [
              "basiccombat.skill_attack"
              ],
            "on_entry": [
              "@s movement:stop",
              "/scoreboard players set @s has_skill 1",
              "/tag @s add hasSkill",
              "/playanimation @s animation.basiccombat.skill_attack"
              ],
            "on_exit": [
              "/tag @s remove hasSkill",
              "@s movement:walk",
              "/scoreboard players set @s has_skill 0",
              "/scoreboard players set @s[tag=trait:shortcd] skillatk_cd 100",
              "/scoreboard players set @s[tag=!trait:shortcd,tag=!trait:longcd] skillatk_cd 200",
              "/scoreboard players set @s[tag=trait:longcd] skillatk_cd 300"
              ]
        }
      }
    }
  }
}