function Damage takes unit z, group x returns nothing
local unit v
local group x2 = CreateGroup()
local player dp = GetOwningPlayer(z)
loop
set v = FirstOfGroup(x)
// Clearing out all allied units from the valid targets
if IsUnitAlly(v,dp) == false then
call GroupRemoveUnit(x,v)
call GroupAddUnit(x2,v)
else
call GroupRemoveUnit(x,v)
endif
exitwhen v == null
endloop
loop
set v = FirstOfGroup(x2)
// Creating an effect and damaging all units left to damage
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Incinerate\\IncinerateBuff.mdl",v,"head"))
call UnitDamageTarget(z,v,(50.00 * (I2R(GetUnitUserData(z)))),false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_FIRE,WEAPON_TYPE_WHOKNOWS)
// Dealing the damage. The Custom Value is set by the Shield Trigger, changing that "50" changes the damage
exitwhen v == null
call GroupRemoveUnit(x2,v)
endloop
call DestroyGroup(x)
// Cleaning memory leaks
call DestroyGroup(x2)
set x = null
set x2 = null
set dp = null
set v = null
set z = null
endfunction
function ShieldBurst takes nothing returns nothing
local group g = CreateGroup()
local group s = CreateGroup()
local group d = CreateGroup()
local group f = CreateGroup()
local unit c = GetSpellAbilityUnit()
local player p = GetOwningPlayer(c)
local unit u
local location l = GetUnitLoc(c)
call GroupEnumUnitsInRangeOfLoc(g,l,375,null)
loop
set u = FirstOfGroup(g)
if GetUnitAbilityLevel(u,'B000') > 0 then
// Enumerating all units with Fireshield and the units around them
call GroupRemoveUnit(g,u)
call UnitAddAbility(u,'A008')
//Adding a Spellbook that stops the effects of the Fireshield
call GroupEnumUnitsInRangeOfLoc(d,GetUnitLoc(u),200,null)
call Damage(u,d)
// Calling the function to damage surrounding enemies
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl",u,"origin")) // Creating the blast effect.
call GroupAddUnit(s,u)
else
call GroupRemoveUnit(g,u)
endif
exitwhen u == null
endloop
call DestroyGroup(d)
// Cleaning memory leaks
set d = null
call DestroyGroup(s)
set s = null
call DestroyGroup(g)
set g = null
call DestroyGroup(f)
set f = null
set c = null
set u = null
call RemoveLocation(l)
set l = null
set p = null
endfunction
function BurstCondition takes nothing returns boolean
return GetSpellAbilityId() == 'A002' and GetTimeOfDay() > 6.00 and GetTimeOfDay() < 18.00
// Condition, checking spell id and daytime
endfunction
function InitTrig_SunBurst takes nothing returns nothing
local trigger lt_SunBurst = CreateTrigger( )
local integer iTrig2 = 0
loop
call TriggerRegisterPlayerUnitEvent( lt_SunBurst, Player(iTrig2),EVENT_PLAYER_UNIT_SPELL_CAST ,null)
set iTrig2 = iTrig2 + 1
exitwhen iTrig2 >= bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition( lt_SunBurst, Condition( function BurstCondition ) )
call TriggerAddAction( lt_SunBurst, function ShieldBurst)
endfunction