function Trig_Untitled_Trigger_003_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A007'
endfunction
function Trig_Untitled_Trigger_003_Actions takes nothing returns nothing
local unit uc = GetTriggerUnit()
local unit u = GetSpellTargetUnit()
local unit u1
local unit u2
local unit u3
local unit u4
local unit u5
local integer a = 0
local integer h1 = 330
local integer h2 = 320
local integer d = 10
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real g = (3.14159 / 180)
local real x1 = x + 300 * Cos(g * 0)
local real y1 = y + 300 * Sin(g * 0)
local real x2 = x + 300 * Cos(g * 72)
local real y2 = y + 300 * Sin(g * 72)
local real x3 = x + 300 * Cos(g * 144)
local real y3 = y + 300 * Sin(g * 144)
local real x4 = x + 300 * Cos(g * 216)
local real y4 = y + 300 * Sin(g * 216)
local real x5 = x + 300 * Cos(g * 288)
local real y5 = y + 300 * Sin(g * 288)
local real sp = 100
local real hp = GetUnitState(u, ConvertUnitState(0))
local real chp = hp
local real cchp = GetUnitState(uc, ConvertUnitState(0))
local real mhp = hp / 33
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 = GetOwningPlayer(GetTriggerUnit())
local string s1 = "Abilities\\Spells\\Human\\DivineShield\\DivineShieldTarget.mdl"
local effect f = AddSpecialEffectTarget(s1, u, "origin")
call SetUnitInvulnerable( u, true )
call PauseUnit( u, true )
set u1 = CreateUnit (p, 'h003', x1 , y1, 0)
call UnitAddAbility(u1, 'Amrf' )
call UnitRemoveAbility(u1, 'Amrf' )
call SetUnitFlyHeight( u1, h1, sp * 4 )
set u2 = CreateUnit (p, 'h003', x2 , y2, 0)
call UnitAddAbility(u2, 'Amrf' )
call UnitRemoveAbility(u2, 'Amrf' )
call SetUnitFlyHeight( u2, h1, sp * 4 )
set u3 = CreateUnit (p, 'h003', x3 , y3, 0)
call UnitAddAbility(u3, 'Amrf' )
call UnitRemoveAbility(u3, 'Amrf' )
call SetUnitFlyHeight( u3, h1, sp * 4 )
set u4 = CreateUnit (p, 'h003', x4 , y4, 0)
call UnitAddAbility(u4, 'Amrf' )
call UnitRemoveAbility(u4, 'Amrf' )
call SetUnitFlyHeight( u4, h1, sp * 4 )
set u5 = CreateUnit (p, 'h003', x5 , y5, 0)
call UnitAddAbility(u5, 'Amrf' )
call UnitRemoveAbility(u5, 'Amrf' )
call SetUnitFlyHeight( u5, h1, sp * 4 )
call UnitAddAbility(u, 'Amrf' )
call UnitRemoveAbility(u, 'Amrf' )
call SetUnitFlyHeight( u, h2, sp )
call TriggerSleepAction(3.2)
call UnitApplyTimedLife( u1, 'BUan', d + 15 )
call UnitApplyTimedLife( u2, 'BUan', d + 15 )
call UnitApplyTimedLife( u3, 'BUan', d + 15 )
call UnitApplyTimedLife( u4, 'BUan', d + 15 )
call UnitApplyTimedLife( u5, 'BUan', d + 15 )
set l1 = AddLightningEx("DRAL", true, x1, y1, 320, x, y, 320)
call SetLightningColor(l1, 1, 0, 0, 1)
set l2 = AddLightningEx("DRAL", true, x2, y2, 320, x, y, 320)
call SetLightningColor(l2, 1, 0, 0, 1)
set l3 = AddLightningEx("DRAL", true, x3, y3, 320, x, y, 320)
call SetLightningColor(l3, 1, 0, 0, 1)
set l4 = AddLightningEx("DRAL", true, x4, y4, 320, x, y, 320)
call SetLightningColor(l4, 1, 0, 0, 1)
set l5 = AddLightningEx("DRAL", true, x5, y5, 320, x, y, 320)
call SetLightningColor(l5, 1, 0, 0, 1)
call TriggerSleepAction(0.01)
set l6 = AddLightningEx("LEAS", true, x1, y1, 320, x5, y5, 320)
call SetLightningColor(l6, 0, 0, 1, 1)
call TriggerSleepAction(0.01)
set l7 = AddLightningEx("LEAS", true, x2, y2, 320, x1, y1, 320)
call SetLightningColor(l7, 0, 0, 1, 1)
call TriggerSleepAction(0.01)
set l8 = AddLightningEx("LEAS", true, x3, y3, 320, x2, y2, 320)
call SetLightningColor(l8, 0, 0, 1, 1)
call TriggerSleepAction(0.01)
set l9 = AddLightningEx("LEAS", true, x4, y4, 320, x3, y3, 320)
call SetLightningColor(l9, 0, 0, 1, 1)
call TriggerSleepAction(0.01)
set l10 = AddLightningEx("LEAS", true, x5, y5, 320, x4, y4, 320)
call SetLightningColor(l10, 0, 0, 1, 1)
loop
exitwhen a > d
call TriggerSleepAction(1)
call SetUnitState(u, ConvertUnitState(0), chp - mhp)
call SetUnitState(uc, ConvertUnitState(0), cchp + mhp)
set chp = GetUnitState(u, ConvertUnitState(0))
set cchp = GetUnitState(uc, ConvertUnitState(0))
set a = a + 1
endloop
call TriggerSleepAction(1)
call DestroyLightning(l1)
call DestroyLightning(l2)
call DestroyLightning(l3)
call DestroyLightning(l4)
call DestroyLightning(l5)
call DestroyLightning(l6)
call DestroyLightning(l7)
call DestroyLightning(l8)
call DestroyLightning(l9)
call DestroyLightning(l10)
call SetUnitFlyHeight( u1, 1500, sp * 4 )
call SetUnitFlyHeight( u2, 1500, sp * 4 )
call SetUnitFlyHeight( u3, 1500, sp * 4 )
call SetUnitFlyHeight( u4, 1500, sp * 4 )
call SetUnitFlyHeight( u5, 1500, sp * 4 )
call UnitAddAbility(u, 'Amrf' )
call UnitRemoveAbility(u, 'Amrf' )
call SetUnitFlyHeight( u, 0, sp )
call TriggerSleepAction(3)
call PauseUnit( u, false )
call SetUnitInvulnerable( u, false )
call DestroyEffect(f)
set u = null
set u1 = null
set u2 = null
set u3 = null
set u4 = null
set u5 = null
set p = null
set f = null
set s1 = null
set l1 = null
set l2 = null
set l3 = null
set l4 = null
set l5 = null
set l6 = null
set l7 = null
set l8 = null
set l9 = null
set l10 = 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