mirror of
https://github.com/araxiaonline/ScourgeInvasion.git
synced 2026-06-13 03:02:21 -04:00
69 lines
2.3 KiB
Lua
69 lines
2.3 KiB
Lua
-- Balzaphon (Scourge Invasion Boss) made by Manmadedrummer for Araxia Online
|
|
|
|
local NPC_BALZAPHON = 14684
|
|
local SPELL_CONE_OF_COLD = 10161
|
|
local SPELL_FROSTBOLT = 16799
|
|
local SPELL_FROSTBOLT_VOLLEY = 8398
|
|
local SPELL_FEAR = 30584
|
|
|
|
local fearHasCast = false
|
|
|
|
local function CastConeOfCold(eventId, delay, calls, creature)
|
|
local target = creature:GetVictim()
|
|
if target then
|
|
creature:CastSpell(target, SPELL_CONE_OF_COLD, false)
|
|
end
|
|
creature:RegisterEvent(CastConeOfCold, math.random(2500, 3000), 1)
|
|
end
|
|
|
|
local function CastFrostbolt(eventId, delay, calls, creature)
|
|
local target = creature:GetVictim()
|
|
if target then
|
|
creature:CastSpell(target, SPELL_FROSTBOLT, false)
|
|
end
|
|
creature:RegisterEvent(CastFrostbolt, 2000, 1)
|
|
end
|
|
|
|
local function CastFrostboltVolley(eventId, delay, calls, creature)
|
|
creature:CastSpell(creature, SPELL_FROSTBOLT_VOLLEY, false)
|
|
creature:RegisterEvent(CastFrostboltVolley, math.random(10000, 15000), 1)
|
|
end
|
|
|
|
local function CheckFearPhase(eventId, delay, calls, creature)
|
|
local healthPct = creature:GetHealthPct()
|
|
if healthPct <= 30 and healthPct >= 1 and not fearHasCast then
|
|
local players = creature:GetPlayersInRange(35)
|
|
if #players > 0 then
|
|
local target = players[math.random(1, #players)]
|
|
if target then
|
|
creature:CastSpell(target, SPELL_FEAR, false)
|
|
fearHasCast = true
|
|
end
|
|
end
|
|
end
|
|
if not fearHasCast then
|
|
creature:RegisterEvent(CheckFearPhase, 1000, 1)
|
|
end
|
|
end
|
|
|
|
local function OnCombat(event, creature, target)
|
|
creature:RegisterEvent(CastFrostbolt, math.random(1000, 1500), 1)
|
|
creature:RegisterEvent(CastConeOfCold, math.random(1000, 2000), 1)
|
|
creature:RegisterEvent(CastFrostboltVolley, math.random(5000, 8000), 1)
|
|
creature:RegisterEvent(CheckFearPhase, 1000, 1)
|
|
fearHasCast = false
|
|
end
|
|
|
|
local function OnLeaveCombat(event, creature)
|
|
creature:RemoveEvents()
|
|
fearHasCast = false
|
|
end
|
|
|
|
local function OnDeath(event, creature, killer)
|
|
creature:RemoveEvents()
|
|
fearHasCast = false
|
|
end
|
|
|
|
RegisterCreatureEvent(NPC_BALZAPHON, 1, OnCombat)
|
|
RegisterCreatureEvent(NPC_BALZAPHON, 2, OnLeaveCombat)
|
|
RegisterCreatureEvent(NPC_BALZAPHON, 4, OnDeath) |