-----------------------------------
-- Area: Crawlers' Nest (197)
--  Mob: Demonic Tiphia
-----------------------------------
local ID = zones[xi.zone.CRAWLERS_NEST]
-----------------------------------
---@type TMobEntity
local entity = {}

entity.spawnPoints =
{
    { x = -103.000, y = -1.000, z =  311.000 },
    { x =  -89.000, y = -1.000, z =  301.000 },
    { x =  -75.000, y = -1.000, z =  299.000 },
    { x = -101.000, y = -1.000, z =  285.000 },
    { x =  -97.993, y = -0.173, z =  326.615 },
    { x = -106.887, y = -0.385, z =  345.743 },
    { x =  -81.061, y = -0.214, z =  301.460 },
    { x = -100.393, y = -0.274, z =  316.377 },
    { x = -103.453, y = -0.363, z =  298.791 },
    { x =  -95.980, y = -0.496, z =  298.313 },
    { x = -104.369, y = -0.329, z =  342.025 },
    { x = -105.581, y = -0.312, z =  346.714 },
    { x = -104.912, y = -0.341, z =  349.042 },
    { x =  -96.758, y = -0.422, z =  298.326 },
    { x = -103.159, y = -0.348, z =  305.169 },
    { x =  -82.704, y = -0.180, z =  300.032 },
    { x = -103.386, y = -0.387, z =  309.294 },
    { x =  -98.186, y = -0.243, z =  323.211 },
    { x =  -94.959, y = -0.357, z =  299.738 },
    { x = -102.879, y = -0.329, z =  339.055 },
    { x = -100.105, y = -0.349, z =  333.388 },
    { x = -109.486, y = -0.642, z =  347.509 },
    { x =  -98.736, y = -0.174, z =  320.885 },
    { x = -106.866, y = -0.481, z =  344.518 },
    { x = -101.493, y = -0.114, z =  289.381 },
    { x =  -97.393, y = -0.392, z =  328.757 },
    { x =  -76.258, y = -1.102, z =  301.931 },
    { x = -104.253, y = -0.329, z =  342.561 },
    { x = -102.970, y = -0.329, z =  340.621 },
    { x = -101.906, y = -0.192, z =  276.080 },
    { x = -100.632, y = -0.329, z =  337.527 },
    { x = -101.478, y = -0.261, z =  284.203 },
    { x = -100.140, y = -0.353, z =  330.000 },
    { x = -101.868, y = -1.381, z =  354.176 },
    { x =  -99.623, y = -0.054, z =  279.536 },
    { x = -100.727, y = -0.097, z =  319.890 },
    { x = -102.780, y = -0.231, z =  287.089 },
    { x =  -82.802, y = -0.299, z =  299.108 },
    { x =  -98.725, y = -0.202, z =  321.931 },
    { x = -105.026, y = -0.328, z =  343.467 },
    { x =  -90.133, y = -0.329, z =  300.983 },
    { x = -102.387, y = -0.329, z =  339.974 },
    { x = -102.123, y = -0.329, z =  339.204 },
    { x = -102.908, y = -0.451, z =  294.955 },
    { x = -104.753, y = -0.454, z =  308.572 },
    { x = -103.230, y = -0.396, z =  299.398 },
    { x =  -96.145, y = -0.416, z =  299.108 },
    { x = -104.003, y = -0.348, z =  309.727 },
    { x = -101.775, y = -0.110, z =  274.420 },
    { x =  -97.195, y = -0.329, z =  298.861 }
}

entity.phList =
{
    [ID.mob.DEMONIC_TIPHIA - 7] = ID.mob.DEMONIC_TIPHIA, -- -101.000 -1.000 285.000
    [ID.mob.DEMONIC_TIPHIA - 6] = ID.mob.DEMONIC_TIPHIA, -- -103.000 -1.000 311.000
    [ID.mob.DEMONIC_TIPHIA - 3] = ID.mob.DEMONIC_TIPHIA, -- -89.000 -1.000 301.000
    [ID.mob.DEMONIC_TIPHIA - 2] = ID.mob.DEMONIC_TIPHIA, -- -75.000 -1.000 299.000
}

entity.onMobFight = function(mob, target)
    -- captures show cure v repeatedly every 15 sec below 50% health
    if
        mob:getHPP() <= 50 and
        not xi.combat.behavior.isEntityBusy(mob) and
        GetSystemTime() > mob:getLocalVar('cureDelay')
    then
        mob:castSpell(xi.magic.spell.CURE_V, mob)
        mob:setLocalVar('cureDelay', GetSystemTime() + 15)
    end
end

entity.onMobDeath = function(mob, player, optParams)
    xi.hunts.checkHunt(mob, player, 236)
end

return entity
