{
  "format_version": "1.19.0",
  "minecraft:entity": {
    "description": {
      "identifier": "wesl3y:escanor",
      "is_spawnable": true,
      "is_summonable": true,
      "is_experimental": false,
      "animations": {
        "death": "controller.animation.mob.escanor",
        "loop": "animation.mob.escanor.loop",
        "timer.0_3": "animation.timer.0_3",
        "timer.0_5": "animation.timer.0_5",
        "timer.0_75": "animation.timer.0_75"
      },
      "scripts": {
        "animate": [
          "death",
          "loop"
        ]
      },
      "properties": {
	    "wesl3y:skill": {
		  "client_sync": true,
          "type": "int",
          "range":[ 0, 7 ],
          "default":0
		}
      }
    },
    "component_groups": {
      "look_priority":{
        "minecraft:behavior.look_at_player": {
          "priority": 1,
          "look_distance": 8
        }
      },
      "no_alcance": {
        "minecraft:variant": {
          "value": 0
        }
      },
      "fora_do_alcance": {
        "minecraft:variant": {
          "value": 1
        }
      },
      "dboa": {
        "minecraft:mark_variant": {
          "value": 0
        },
        "minecraft:attack": {
          "damage": 10
        },
        "minecraft:knockback_resistance": {
          "value": 0.5
        },
        "minecraft:behavior.melee_attack": {
          "priority": 1,
          "speed_multiplier": 0.7,
          "track_target": true
        },
        "minecraft:timer": {
          "time": [ 5, 8 ],
          "looping": true,
          "time_down_event": {
            "event": "random_event"
          }
        }
      },
      "combo1": {
        "minecraft:mark_variant": {
          "value": 1
        },
        "minecraft:knockback_resistance": {
          "value": 1.0
        }
      },
      "combo1_2": {
        "minecraft:shooter": {
          "def": "wesl3y:escanor_projetil<wesl3y:mob.cruel_sun>"
        },
        "minecraft:behavior.ranged_attack": {
          "burst_shots": 1,
          "burst_interval": 0,
          "charge_charged_trigger": 0,
          "charge_shoot_trigger": 0.25,
          "attack_interval_min": 3,
          "attack_interval_max": 3,
          "attack_radius": 24.0
        }
      }
    },

    "components": {
      "minecraft:experience_reward": {
        "on_death": "query.last_hit_by_player ? 1 : 0"
      },
      "minecraft:type_family": {
        "family": [ "escanor", "boss", "mob" ]
      },
      "minecraft:breathable": {
        "total_supply": 15,
        "suffocate_time": 0
      },
      "minecraft:nameable": {},
      "minecraft:collision_box": {
        "width": 0.8,
        "height": 2.0
      },
      "minecraft:health": {
        "value": 360,//300 + 20%
        "max": 360
      },
      "minecraft:scale": {
        "value": 1.5
      },
      "minecraft:movement": {
        "value": 0.3
      },
      "minecraft:flying_speed": {
        "value": 0.3
      },
      "minecraft:loot": {
        "table": "loot_tables/entities/escanor.json"
      },
      "minecraft:damage_sensor": {
        "triggers": [
          {
            "on_damage": {
              "filters": {
                "any_of": [{"test":"has_damage","value":"fall"}]
              }
            },
            "deals_damage": false
          }
        ]
      },
      "minecraft:despawn": {
        "filters": {
          "all_of": [
            {"test": "distance_to_nearest_player", "operator": ">", "value": 80}
          ]
        }
      },
      "minecraft:hurt_on_condition": {
        "damage_conditions": [
          {
            "filters": { "test": "in_lava", "subject": "self", "operator": "==", "value": true },
            "cause": "lava",
            "damage_per_tick": 4
          }
        ]
      },
      "minecraft:behavior.nearest_attackable_target": {
        "priority": 0,
        "must_see": true,
        "reselect_targets": false,
        "entity_types": [
          {
            "filters": {
              "test": "has_tag",
              "subject": "other",
              "value": "escanor_mission"
            },
            "max_dist": 16
          }
        ]
      },
      "minecraft:target_nearby_sensor": {
        "inside_range": 3.0,
        "outside_range": 4.0,
        "on_inside_range": {
          "event": "no_alcance",
          "target": "self"
        },
        "on_outside_range": {
          "event": "fora_do_alcance",
          "target": "self"
        }
      },
      "minecraft:on_target_escape": {
        "event": "dboa",
        "target": "self"
      },
      "minecraft:follow_range": {
        "value": 32,
        "max": 32
      },
      "minecraft:navigation.walk": {
        "can_path_over_water": true
      },
      "minecraft:movement.basic": {},
      "minecraft:jump.static": {},
      "minecraft:can_climb": {},
      "minecraft:behavior.float": {
        "priority": 0
      },
      "minecraft:behavior.hurt_by_target": {
        "priority": 1
      },
      "minecraft:pushable": {
        "is_pushable": true,
        "is_pushable_by_piston": true
      },
      "minecraft:physics": {},
      "minecraft:conditional_bandwidth_optimization": {
      }
    },

    "events": {
      "minecraft:entity_spawned": {
        "add": {
          "component_groups": [
            "dboa",
            "look_priority",
            "no_alcance",
            "normal"
          ]
        }
      },
      "no_alcance": {
        "add": {
          "component_groups": [
            "no_alcance"
          ]
        },
        "remove": {
          "component_groups": [
            "fora_do_alcance"
          ]
        }
      },
      "fora_do_alcance": {
        "add": {
          "component_groups": [
            "fora_do_alcance"
          ]
        },
        "remove": {
          "component_groups": [
            "no_alcance"
          ]
        }
      },
      "dboa": {
        "add": {
          "component_groups": [
            "dboa"
          ]
        },
        "remove": {
          "component_groups": [
            "combo1",
            "combo1_2"
          ]
        }
      },
      "combo1_2": {
        "add": {
          "component_groups": [
            "combo1_2"
          ]
        }
      },
      "wesl3y:skill0": {
        "set_property": {
          "wesl3y:skill": 0
        }
      },
      "wesl3y:skill1": {
        "set_property": {
          "wesl3y:skill": 1
        }
      },
      "wesl3y:skill2": {
        "set_property": {
          "wesl3y:skill": 2
        }
      },
      "wesl3y:skill3": {
        "set_property": {
          "wesl3y:skill": 3
        }
      },
      "wesl3y:skill4": {
        "set_property": {
          "wesl3y:skill": 4
        }
      },
      "wesl3y:skill5": {
        "set_property": {
          "wesl3y:skill": 5
        }
      },
      "wesl3y:skill6": {
        "set_property": {
          "wesl3y:skill": 6
        }
      },
      "random_event": {
        "sequence": [
          {
            "add": {
              "component_groups": [
                "dboa"
              ]
            }
          },
          {
            "remove": {
              "component_groups": [
                "combo1",
                "combo1_2"
              ]
            }
          },
          {
            "filters": {
              "all_of": [
                {"test": "has_tag", "operator": "!=", "value": "empty"},
                {"test": "has_target", "subject": "self", "value": true}
              ]
            },
            "randomize": [
              {
                "weight": 45,
                "filters": {
                  "all_of": [
                    {"test": "is_variant", "subject": "self", "value": 1}
                  ]
                },
                "add": {
                  "component_groups": [
                    "combo1"
                  ]
                }
              }
            ]
          }
        ]
      }
    }
  }
}