-----------------------------------
-- Area: The Boyahda Tree
--   NM: Voluptuous Vivian
-----------------------------------
mixins = { require('scripts/mixins/job_special') }
-----------------------------------
local ID = zones[xi.zone.THE_BOYAHDA_TREE]
-----------------------------------
---@type TMobEntity
local entity = {}

entity.phList =
{
    [ID.mob.VOLUPTUOUS_VIVIAN - 1] = ID.mob.VOLUPTUOUS_VIVIAN, -- -196.178 5.592 190.971
}

entity.spawnPoints =
{
    { x = -215.158, y = 5.671, z = 184.629 },
    { x = -215.792, y = 5.718, z = 187.152 },
    { x = -216.685, y = 5.095, z = 192.898 },
    { x = -215.840, y = 5.914, z = 199.350 },
    { x = -215.278, y = 5.612, z = 203.135 },
    { x = -214.516, y = 5.285, z = 206.357 },
    { x = -212.537, y = 4.751, z = 209.737 },
    { x = -208.640, y = 4.712, z = 211.481 },
    { x = -203.275, y = 5.630, z = 212.923 },
    { x = -198.496, y = 5.989, z = 214.204 },
    { x = -193.305, y = 5.275, z = 214.541 },
    { x = -188.910, y = 4.527, z = 212.437 },
    { x = -185.907, y = 4.365, z = 209.538 },
    { x = -185.455, y = 5.528, z = 204.687 },
    { x = -185.085, y = 5.956, z = 199.572 },
    { x = -183.552, y = 5.184, z = 191.921 },
    { x = -186.084, y = 5.678, z = 187.071 },
    { x = -193.121, y = 5.351, z = 188.220 },
    { x = -196.588, y = 5.580, z = 184.341 },
    { x = -201.197, y = 5.792, z = 182.762 },
    { x = -204.689, y = 5.231, z = 183.871 },
    { x = -207.278, y = 5.288, z = 187.267 },
    { x = -210.239, y = 5.545, z = 192.468 },
    { x = -208.414, y = 5.905, z = 197.172 },
    { x = -209.400, y = 5.804, z = 201.499 },
    { x = -209.699, y = 5.294, z = 207.211 },
    { x = -204.360, y = 5.735, z = 210.093 },
    { x = -198.706, y = 5.798, z = 211.819 },
    { x = -194.601, y = 5.529, z = 208.885 },
    { x = -190.258, y = 5.530, z = 205.416 },
    { x = -190.237, y = 5.720, z = 200.040 },
    { x = -191.025, y = 5.563, z = 194.023 },
    { x = -193.461, y = 5.606, z = 192.175 },
    { x = -198.140, y = 5.798, z = 188.441 },
    { x = -203.961, y = 5.597, z = 191.974 },
    { x = -203.120, y = 5.730, z = 196.160 },
    { x = -204.872, y = 5.763, z = 199.845 },
    { x = -205.151, y = 5.732, z = 204.877 },
    { x = -201.102, y = 5.919, z = 208.546 },
    { x = -197.193, y = 5.870, z = 208.238 },
    { x = -194.280, y = 5.565, z = 207.310 },
    { x = -191.376, y = 5.910, z = 202.994 },
    { x = -192.200, y = 5.978, z = 198.738 },
    { x = -195.950, y = 5.721, z = 196.564 },
    { x = -200.594, y = 5.709, z = 195.880 },
    { x = -200.914, y = 5.956, z = 199.436 },
    { x = -200.758, y = 5.700, z = 204.213 },
    { x = -197.292, y = 5.695, z = 204.317 },
    { x = -195.660, y = 5.738, z = 199.377 },
    { x = -198.131, y = 5.913, z = 200.190 },
}

entity.onMobInitialize = function(mob)
    mob:setMobMod(xi.mobMod.GIL_MIN, 20000)
    mob:setMobMod(xi.mobMod.GIL_MAX, 24000)
end

entity.onMobSpawn = function(mob)
    mob:setMobMod(xi.mobMod.NO_MOVE, 0)
    mob:addImmunity(xi.immunity.DARK_SLEEP)
    mob:addImmunity(xi.immunity.LIGHT_SLEEP)
    mob:addImmunity(xi.immunity.PARALYZE)
end

entity.onMobRoam = function(mob)
    mob:setMobMod(xi.mobMod.NO_MOVE, 0)
end

entity.onMobFight = function(mob, target)
    local spawnPos = mob:getSpawnPos()
    local drawInTable =
    {
        conditions =
        {
            target:checkDistance(spawnPos.x, spawnPos.y, spawnPos.z) > 25,
        },
        position = mob:getPos(),
        wait = 3,
    }
    if drawInTable.conditions[1] then
        mob:setMobMod(xi.mobMod.NO_MOVE, 1)
        utils.drawIn(target, drawInTable)
    else
        mob:setMobMod(xi.mobMod.NO_MOVE, 0)
    end
end

entity.onMobDeath = function(mob, player, optParams)
    player:addTitle(xi.title.THE_VIVISECTOR)
end

return entity
