2023-02-11 03:20:34 -07:00
local Patchqwerk = { }
2023-02-04 03:28:42 -07:00
2023-02-08 11:34:43 -07:00
function Patchqwerk . OnSpawn ( event , creature )
creature : SendUnitYell ( " Patchqwerk make Lich King proud! You die now! " , 0 )
2023-02-11 03:20:34 -07:00
creature : CastSpell ( creature , 41924 , true )
2023-02-04 03:28:42 -07:00
end
2023-02-08 11:34:43 -07:00
function Patchqwerk . PoisonBoltVolley ( eventId , delay , calls , creature )
creature : CastSpell ( creature : GetVictim ( ) , 40095 , true )
2023-02-04 03:28:42 -07:00
end
2023-02-08 11:34:43 -07:00
function Patchqwerk . CastHatefulStrike ( eventId , delay , calls , creature )
creature : CastSpell ( creature : GetVictim ( ) , 28308 , true )
2023-02-04 03:28:42 -07:00
end
2023-02-08 11:34:43 -07:00
function Patchqwerk . CastGore ( eventId , delay , calls , creature )
creature : CastSpell ( creature : GetVictim ( ) , 48130 , true )
2023-02-04 03:28:42 -07:00
end
2023-02-08 11:34:43 -07:00
function Patchqwerk . OnEnterCombat ( event , creature , target )
local yellOptions = { " Patchqwerk huuuuungry! " , " Time for a snack! " , " You're mine now! " , " You look delicious. Patchqwerk eat you now! " , " I not eat in days, time to feast! " , " Me smash and eat you now! " , " Me so hungry, me eat anything... even you! " }
local randomIndex = math.random ( 1 , 7 )
2023-02-11 03:20:34 -07:00
local selectedYell = yellOptions [ randomIndex ]
2023-02-08 11:34:43 -07:00
creature : SendUnitYell ( selectedYell , 0 )
creature : RegisterEvent ( Patchqwerk.PoisonBoltVolley , 7000 , 0 )
creature : RegisterEvent ( Patchqwerk.CastHatefulStrike , 15000 , 0 )
creature : RegisterEvent ( Patchqwerk.CastGore , 20000 , 0 )
2023-02-04 03:28:42 -07:00
end
2023-02-08 11:34:43 -07:00
function Patchqwerk . OnLeaveCombat ( event , creature )
2023-02-11 03:20:34 -07:00
local yellOptions = { " You not so tasty afterall... " , " I be back for seconds! " , " No more play? Too bad... " , " Maybe next time you taste better! " , " Me still hungry, come back later! " , " You not enough food, me go find more! " , " Awww...You no stay for dinner? You make Patchqwerk sad. " }
local randomIndex = math.random ( 1 , 7 )
2023-02-08 11:34:43 -07:00
local selectedYell = yellOptions [ randomIndex ]
creature : SendUnitYell ( selectedYell , 0 )
creature : RemoveEvents ( )
2023-02-04 03:28:42 -07:00
end
2023-02-08 11:34:43 -07:00
function Patchqwerk . OnDied ( event , creature , killer )
creature : SendUnitYell ( " Patchqwerk forget to chew... " , 0 )
if ( killer : GetObjectType ( ) == " Player " ) then
killer : SendBroadcastMessage ( " You killed " .. creature : GetName ( ) .. " ! " )
end
creature : RemoveEvents ( )
end
2023-02-04 03:28:42 -07:00
2023-02-11 03:20:34 -07:00
function Patchqwerk . CheckHealth ( event , creature )
if ( creature : HealthBelowPct ( 20 ) ) then
creature : SendUnitYell ( " Patchqwerk go berserk! " , 0 )
creature : CastSpell ( creature , 41305 , true ) -- Cast the berserk spell (ID 41305)
elseif ( creature : HealthAbovePct ( 95 ) ) then
creature : CastSpell ( creature , 41924 , true ) -- Cast the other berserk spell (ID 41924)
end
end
2023-02-08 11:34:43 -07:00
RegisterCreatureEvent ( 400012 , 1 , Patchqwerk.OnEnterCombat )
RegisterCreatureEvent ( 400012 , 2 , Patchqwerk.OnLeaveCombat )
RegisterCreatureEvent ( 400012 , 4 , Patchqwerk.OnDied )
2023-02-11 03:20:34 -07:00
RegisterCreatureEvent ( 400012 , 5 , Patchqwerk.OnSpawn )
RegisterCreatureEvent ( 400012 , 6 , Patchqwerk.CheckHealth )