function Trig_Untitled_Trigger_003_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction
function Trig_Untitled_Trigger_003_Actions takes nothing returns nothing
local unit uc = GetTriggerUnit()
local unit ut = GetSpellTargetUnit()
local unit array u
local integer a = 1
local integer b = 1
local integer h1 = 330
local integer h2 = 320
local integer d = 10
local integer rnd
local integer e = 0
local real xt = GetUnitX(ut)
local real yt = GetUnitY(ut)
local real g = (3.14159 / 180)
local real array x
local real array y
local real spd = GetUnitMoveSpeed(ut)
local real spd1 = GetUnitMoveSpeed(uc)
local real sp = 100
local real hp = GetWidgetLife(ut)
local real hp1 = GetWidgetLife(uc)
local real dmg = GetHeroLevel(uc) * GetUnitAbilityLevel(uc,'A000' )
local real t1
local real dist
local real dist1
local lightning array l
local lightning l1 = null
local lightning l2 = null
local lightning l3 = null
local lightning l4 = null
local lightning l5 = null
local lightning l6 = null
local lightning l7 = null
local lightning l8 = null
local lightning l9 = null
local lightning l10 = null
local player p = GetTriggerPlayer()
local string array s
local effect f1
local effect f2
local effect array f
set s[0] = "Abilities\\Spells\\Items\\StaffOfSanctuary\\Staff_Sanctuary_Target.mdl"
set s[1] = "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl"
set s[2] = "Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodPeasant.mdl"
set s[3] = "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl"
set s[4] = "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl"
set s[5] = "Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeEmbers.mdl"
set f1 = AddSpecialEffectTarget(s[0], ut, "chest")
loop
exitwhen a > 5
set t1 = g * (a - 1) * 72
set x[a] = xt + 300 * Cos(t1)
set y[a] = yt + 300 * Sin(t1)
set x[a + 5] = xt + 400 * Cos(t1)
set y[a + 5] = yt + 400 * Sin(t1)
set x[a + 10] = xt - 400 * Cos(t1)
set y[a + 10] = yt - 400 * Sin(t1)
set u[a] = CreateUnit (p, 'h000', x[a] , y[a], 0)
call UnitAddAbility(u[a], 'Amrf' )
call UnitRemoveAbility(u[a], 'Amrf' )
call SetUnitFlyHeight( u[a], h1, sp * 4 )
set a = a + 1
endloop
call PauseUnit( uc, true )
call SetUnitPathing (uc, true)
call SetUnitMoveSpeed (uc, 400)
call PauseUnit( ut, true )
call UnitAddAbility(uc, 'Abun' )
call UnitAddAbility(ut, 'Amrf' )
call UnitRemoveAbility(ut, 'Amrf' )
call SetUnitFlyHeight( ut, h2, sp )
call SetUnitInvulnerable( ut, true )
call TriggerSleepAction(3.2)
call UnitAddAbility(uc, 'Aloc' )
call SetUnitVertexColor(uc, 255, 255, 255, 200)
call DestroyEffect(f1)
set f[1] = AddSpecialEffectTarget(s[5], uc, "foot left")
set f[2] = AddSpecialEffectTarget(s[5], uc, "foot right")
set f[3] = AddSpecialEffectTarget(s[5], uc, "hand left")
set f[4] = AddSpecialEffectTarget(s[5], uc, "hand right")
set f[5] = AddSpecialEffectTarget(s[5], uc, "chest")
set a = 1
loop
exitwhen a > 5
set l[a] = AddLightningEx("DRAL", true, x[a], y[a], 320, xt, yt, 320)
call SetLightningColor(l[a], 1, 0, 0, 1)
set a = a + 1
endloop
set a = 0
set l[6] = AddLightningEx("LEAS", true, x[1], y[1], 320, x[5], y[5], 320)
call SetLightningColor(l[6], 0, 0, 1, 1)
call TriggerSleepAction(0.01)
set l[7] = AddLightningEx("LEAS", true, x[2], y[2], 320, x[1], y[1], 320)
call SetLightningColor(l[7], 0, 0, 1, 1)
call TriggerSleepAction(0.01)
set l[8] = AddLightningEx("LEAS", true, x[3], y[3], 320, x[2], y[2], 320)
call SetLightningColor(l[8], 0, 0, 1, 1)
call TriggerSleepAction(0.01)
set l[9] = AddLightningEx("LEAS", true, x[4], y[4], 320, x[3], y[3], 320)
call SetLightningColor(l[9], 0, 0, 1, 1)
call TriggerSleepAction(0.01)
set l[10] = AddLightningEx("LEAS", true, x[5], y[5], 320, x[4], y[4], 320)
call SetLightningColor(l[10], 0, 0, 1, 1)
call PauseUnit( uc, false )
call SetUnitInvulnerable( ut, false )
call SetUnitLookAt( ut, "bone_chest", uc, 0, 0, 50 )
loop
set hp = GetWidgetLife(ut)
set hp1 = GetWidgetLife(uc)
exitwhen b > 5 or hp < 0.4 or hp1 < 0.4
call DestroyEffect(AddSpecialEffectTarget(s[1], uc, "origin"))
call SetUnitPosition(uc, x[b + 5], y[b + 5])
call DestroyEffect(AddSpecialEffectTarget(s[3], uc, "origin"))
call UnitAddAbility(uc, 'Amrf' )
call UnitRemoveAbility(uc, 'Amrf' )
call SetUnitFlyHeight( uc, h1, 10000 )
call DestroyEffect(AddSpecialEffectTarget(s[1], uc, "origin"))
call IssuePointOrder (uc, "move", x[b + 10], y[b + 10])
loop
set dist = SquareRoot((x[b + 10] - GetUnitX(uc)) * (x[b + 10] - GetUnitX(uc)) + (y[b + 10] - GetUnitY(uc)) * (y[b + 10] - GetUnitY(uc)))
exitwhen dist < 120
set dist1 = SquareRoot((GetUnitX(ut) - GetUnitX(uc)) * (GetUnitX(ut) - GetUnitX(uc)) + (GetUnitY(ut) - GetUnitY(uc)) * (GetUnitY(ut) - GetUnitY(uc)))
if dist1 < 75 and b != e then
call UnitDamageTarget(uc, ut, dmg, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffectTarget(s[2], ut, "origin"))
call DestroyEffect(AddSpecialEffectTarget(s[4], ut, "origin"))
if b == 5 then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl", ut, "origin"))
call DestroyEffect(AddSpecialEffectTarget("Units\\NightElf\\Wisp\\WispExplode.mdl", ut, "origin"))
call UnitDamageTarget(uc, ut, dmg * 2, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
endif
set e = b
endif
call TriggerSleepAction(0.1)
endloop
set b = b + 1
endloop
call SetUnitMoveSpeed (uc, 0)
call IssueTargetOrder( uc, "smart", ut )
call TriggerSleepAction(0.3)
call SetUnitAnimation( uc, "stand victory" )
call SetUnitInvulnerable( ut, true )
call TriggerSleepAction(1)
call DestroyEffect(AddSpecialEffectTarget(s[1], uc, "origin"))
call TriggerSleepAction(0.3)
call ResetUnitLookAt( ut )
call SetUnitFlyHeight( uc, 0, 2000 )
call SetUnitPathing (uc, false)
set f1 = AddSpecialEffectTarget(s[0], ut, "chest")
set a = 1
loop
exitwhen a > 10
call DestroyLightning(l[a])
set l[a] = null
set a = a + 1
endloop
set a = 1
loop
exitwhen a > 5
call UnitApplyTimedLife( u[a], 'BUan', 5 )
call SetUnitFlyHeight( u[a], 2500, sp * 4 )
set u[a] = null
set a = a + 1
endloop
if (GetLocalPlayer() == p) then
call ClearSelection()
call SelectUnit(uc, true)
endif
call UnitAddAbility(ut, 'Amrf' )
call UnitRemoveAbility(ut, 'Amrf' )
call SetUnitMoveSpeed (uc, spd1)
call SetUnitVertexColor(uc, 255, 255, 255, 255)
call UnitRemoveAbility (uc, 'Aloc' )
call ShowUnit(uc, false)
call ShowUnit(uc, true)
set hp = GetWidgetLife(ut)
if hp < 0.4 then
call DestroyEffect(f1)
call SetUnitFlyHeight( ut, 0, sp * 4 )
else
call SetUnitFlyHeight( ut, 0, sp )
endif
set hp = GetWidgetLife(uc)
set a = 1
if hp < 0.4 then
loop
exitwhen a > 5
call DestroyEffect(f[a])
set a = a + 1
endloop
endif
call TriggerSleepAction(3)
call SetUnitInvulnerable( ut, false )
call UnitRemoveAbility(uc, 'Abun' )
call PauseUnit( ut, false )
if f1 != null then
call DestroyEffect(f1)
endif
set a = 1
if f[1] != null then
loop
exitwhen a > 5
call DestroyEffect(f[a])
set s[a] = null
set a = a + 1
endloop
endif
call DestroyEffect(f2)
set ut = null
set p = null
set f1 = null
set f2 = null
set s[0] = null
endfunction
//===========================================================================
function InitTrig_Magical_sword takes nothing returns nothing
set gg_trg_Magical_sword = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Magical_sword, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Magical_sword, Condition( function Trig_Untitled_Trigger_003_Conditions ) )
call TriggerAddAction( gg_trg_Magical_sword, function Trig_Untitled_Trigger_003_Actions )
endfunction