// Copyright (c) JaylyMC.
// Licensed under the GPL-3.0 License.

{
  "format_version": "1.10.0",
  "animation_controllers": {
    "controller.animation.dummy.escape_pathfind": {
      "initial_state": "default_state",
      "states": {
        "default_state": {
          "on_entry": ["@s dummy:create_terminator_target"]
        }
      }
    },
    "controller.animation.dummy.spawn_terminator": {
      "initial_state": "variable_setup",
      "states": {
        "variable_setup": {
          "transitions": [{ "default_state": "(1.0)" }],
          "on_entry": ["v.dummy_time = q.time_stamp; v.dummy_duration = 120;"] // 120 ticks = 6 seconds
        },
        "default_state": {
          "transitions": [
            {
              "lore_setup": "(q.time_stamp - v.dummy_time) >= v.dummy_duration"
            }
          ],
          "on_entry": [
            "v.dummy_time = q.time_stamp; v.dummy_duration = 120;",
            // evoker_spell particles has decreased from 16 to 4 in beta 1.3.5.1
            "/particle minecraft:evoker_spell ~ ~ ~",
            "/particle minecraft:evoker_spell ~ ~ ~",
            "/particle minecraft:evoker_spell ~ ~ ~",
            "/particle minecraft:evoker_spell ~ ~ ~"
          ],
          "on_exit": ["@s dummy:force_roar"]
        },
        "lore_setup": {
          "transitions": [
            { "execute1": "(q.time_stamp - v.dummy_time) >= v.dummy_duration" }
          ],
          "on_entry": [
            "v.dummy_time = q.time_stamp; v.dummy_duration = 120;",
            "/fog @a push minecraft:fog_hell respawn_lore",
            "/weather thunder",
            "/gamerule dodaylightcycle false",
            "/gamerule doweathercycle false"
          ],
          "on_exit": ["/summon minecraft:lightning_bolt", "@s dummy:force_roar"]
        },
        "execute1": {
          "transitions": [
            { "execute2": "(q.time_stamp - v.dummy_time) >= v.dummy_duration" }
          ],
          "on_entry": [
            "v.dummy_time = q.time_stamp; v.dummy_duration = 60;",
            "/structure load robot_respawn_cage ~-2 ~-1 ~-2"
          ],
          "on_exit": ["/summon minecraft:lightning_bolt", "@s dummy:force_roar"]
        },
        "execute2": {
          "transitions": [
            { "execute3": "(q.time_stamp - v.dummy_time) >= v.dummy_duration" }
          ],
          "on_entry": ["v.dummy_time = q.time_stamp; v.dummy_duration = 60;"],
          "on_exit": ["/summon minecraft:lightning_bolt", "@s dummy:force_roar"]
        },
        "execute3": {
          "transitions": [
            { "execute4": "(q.time_stamp - v.dummy_time) >= v.dummy_duration" }
          ],
          "on_entry": ["v.dummy_time = q.time_stamp; v.dummy_duration = 60;"],
          "on_exit": ["/summon minecraft:lightning_bolt", "@s dummy:force_roar"]
        },
        "execute4": {
          "transitions": [
            { "execute5": "(q.time_stamp - v.dummy_time) >= v.dummy_duration" }
          ],
          "on_entry": ["v.dummy_time = q.time_stamp; v.dummy_duration = 100;"],
          "on_exit": ["/summon minecraft:lightning_bolt", "@s dummy:force_roar"]
        },
        "execute5": {
          "transitions": [
            { "execute6": "(q.time_stamp - v.dummy_time) >= v.dummy_duration" }
          ],
          "on_entry": ["v.dummy_time = q.time_stamp; v.dummy_duration = 60;"],
          "on_exit": ["/summon minecraft:lightning_bolt", "@s dummy:force_roar"]
        },
        "execute6": {
          "transitions": [
            {
              "execute7_steve": "((q.time_stamp - v.dummy_time) >= v.dummy_duration) && q.property('dummy:task_type') == 1"
            },
            {
              "execute7_alex": "((q.time_stamp - v.dummy_time) >= v.dummy_duration) && q.property('dummy:task_type') == 3"
            },
            {
              "execute7_custom": "((q.time_stamp - v.dummy_time) >= v.dummy_duration) && q.property('dummy:task_type') == 4"
            }
          ],
          "on_entry": ["v.dummy_time = q.time_stamp; v.dummy_duration = 100;"],
          "on_exit": ["/summon minecraft:lightning_bolt", "@s dummy:force_roar"]
        },
        "execute7_steve": {
          "on_entry": [
            "v.dummy_time = q.time_stamp; v.dummy_duration = 100;",
            "/fill ~-2 ~-1 ~-2 ~2 ~-1 ~2 air replace bedrock",
            "/fill ~-2 ~ ~-2 ~2 ~3 ~2 air replace barrier",
            "/summon entity:terminator ~ ~ ~ ~ ~ terminator:disable_respawn_event_steve",
            "/fog @a remove respawn_lore",
            "@s dummy:spawn_terminator",
            "/summon minecraft:lightning_bolt",
            "@s dummy:force_roar"
          ]
        },
        "execute7_alex": {
          "on_entry": [
            "v.dummy_time = q.time_stamp; v.dummy_duration = 100;",
            "/fill ~-2 ~-1 ~-2 ~2 ~-1 ~2 air replace bedrock",
            "/fill ~-2 ~ ~-2 ~2 ~3 ~2 air replace barrier",
            "/summon entity:terminator ~ ~ ~ ~ ~ terminator:disable_respawn_event_alex",
            "/fog @a remove respawn_lore",
            "@s dummy:spawn_terminator",
            "/summon minecraft:lightning_bolt",
            "@s dummy:force_roar"
          ]
        },
        "execute7_custom": {
          "on_entry": [
            "v.dummy_time = q.time_stamp; v.dummy_duration = 100;",
            "/fill ~-2 ~-1 ~-2 ~2 ~-1 ~2 air replace bedrock",
            "/fill ~-2 ~ ~-2 ~2 ~3 ~2 air replace barrier",
            "/summon entity:terminator ~ ~ ~ ~ ~ terminator:disable_respawn_event_custom",
            "/fog @a remove respawn_lore",
            "@s dummy:spawn_terminator",
            "/summon minecraft:lightning_bolt",
            "@s dummy:force_roar"
          ]
        }
      }
    }
  }
}
