Code:
local ENTRY_VEREESA = 90077;
local combatIsDone = false;
local VereesaWindrunner = {
Spells = {
71130,
42846,
71118,
},
};
local magicInterrupt = 0;
local isIcyVeinUse = false
local isIceBlock = false
function VereesaWindrunner.CastRandomSpell(eventId, dely, calls, creature)
if not combatIsDone then
if not creature:IsCasting() then
local randomSpell = math.random(1, 3)
if randomSpell == 71118 then
local x1, y1, z1 = creature:GetVictim():GetRelativePoint(math.random(1, 2), (math.random(math.pi / 12, math.pi * 2)));
creature:CastSpellAoF(x1, y1, z1, randomSpell)
else
creature:CastSpell(creature:GetVictim(), VereesaWindrunner.Spells[randomSpell])
end
end
end
end
function VereesaWindrunner.PantiRun(eventId, dely, calls, creature)
if not combatIsDone then
creature:CastSpell(creature:GetVictim(), 865, true) -- Frost Nova
creature:CastSpell(creature, 14514, true) -- Blink
end
end
function VereesaWindrunner.CombatEnd(event, delay, repeats, creature)
creature:SetFaction(1760)
combatIsDone = false
creature:RemoveEvents()
end
function VereesaWindrunner.GiveUp(event, delay, repeats, creature)
local player_unit = creature:GetVictim()
local Player = GetPlayerByGUID(player_unit:GetGUID())
combatIsDone = true
creature:RemoveAllAuras()
creature:StopSpellCast(0)
creature:SendUnitYell("I'll give you this. Please...", 0)
creature:SetHealth(creature:GetMaxHealth())
creature:AttackStop()
player_unit:AttackStop()
player_unit:StopSpellCast(0)
creature:ClearInCombat()
player_unit:ClearInCombat()
creature:PerformEmote(20)
player_unit:PerformEmote(1)
Player:AddItem(43102, 1) -- reward
isIcyVeinUse = false
isIceBlock = false
magicInterrupt = 0
creature:SetFaction(35)
creature:MoveHome()
creature:RegisterEvent(VereesaWindrunner.CombatEnd, 5000, 1)
end
function VereesaWindrunner.TrackingVictim(event, delay, repeats, creature)
local victim = creature:GetVictim()
local victimIsCast = victim:IsCasting()
if victimIsCast and (magicInterrupt < 1) then
creature:SendUnitYell("Nope!", 0)
creature:CastSpell(victim, 65790, true)
magicInterrupt = 15 -- 마차 쿨
else
magicInterrupt = magicInterrupt - 1
end
end
function VereesaWindrunner.CheckHealth(event, delay, repeats, creature)
local HealthPct = creature:GetHealthPct()
if (HealthPct <= 80 and HealthPct > 50) then
if not isIcyVeinUse then
creature:CastSpell(creature, 65547, true) -- Removes all movement impairing effects
creature:CastSpell(creature, 12472, true) -- IcyVein
creature:CastSpell(creature:GetVictim(), 7655, true) -- 디벞
creature:CastSpell(creature:GetVictim(), 30449, true) -- spellsteal
isIcyVeinUse = true
end
end
if (HealthPct <= 40 and HealthPct > 30) then
if not isIceBlock then
creature:CastSpell(creature, 65547, true) -- Removes all movement impairing effects
creature:CastSpell(creature, 29842, true) -- second-wind
creature:CastSpell(creature, 36911, true) -- IceBlock
isIceBlock = true
end
end
if (HealthPct <= 20 and HealthPct >= 1) then
creature:RegisterEvent(VereesaWindrunner.GiveUp, 1000, 1)
end
end
function VereesaWindrunner.OnEnterCombat(event, creature, target)
creature:SetReactState(1) -- still following if 0 can't attack player
creature:RegisterEvent(VereesaWindrunner.CastRandomSpell, 500, 0)
creature:RegisterEvent(VereesaWindrunner.CheckHealth, 1000, 0)
creature:RegisterEvent(VereesaWindrunner.TrackingVictim, 1000, 0)
creature:RegisterEvent(VereesaWindrunner.PantiRun, {5000, 12000}, 0)
end
function VereesaWindrunner.OnLeaveCombat(event, creature)
isIcyVeinUse = false
isIceBlock = false
combatIsDone = false
creature:RemoveEvents()
end
function VereesaWindrunner.OnDied(event, creature, killer)
if(killer:GetObjectType() == "Player") then
killer:SendBroadcastMessage("You killed " ..creature:GetName().."!")
creature:Respawn()
end
creature:RemoveEvents()
end
RegisterCreatureEvent(ENTRY_VEREESA, 1, VereesaWindrunner.OnEnterCombat)
RegisterCreatureEvent(ENTRY_VEREESA, 2, VereesaWindrunner.OnLeaveCombat)
RegisterCreatureEvent(ENTRY_VEREESA, 4, VereesaWindrunner.OnDied)