Name | Type | is_array | initial_value |
function Shield takes nothing returns nothing
local unit j = GetSpellTargetUnit()
local integer i = 0
call UnitAddAbility(j,'A001')
// Adding the Spellbook that contains the aura used for the bonus
call SetUnitUserData(j,GetUnitAbilityLevel(GetSpellAbilityUnit(),'A003'))
// Setting the unit's Custom Value, used to determine Sunburst damage
loop
call TriggerSleepAction(0.50)
if GetUnitAbilityLevel(j,'B000') <= 0 then
call UnitAddAbility(j,'A001')
endif
set i = (i + 1)
// Checking every half second, stops when the duration has expired, or unit no longer has the ability
exitwhen i == 4 + (8 * GetUnitAbilityLevel(GetSpellAbilityUnit(),'A003')) or GetUnitAbilityLevel(j,'B002') > 0 // To change duration change that "4".
endloop
call SetUnitUserData(j,0)
// Cleaning memory leaks
call UnitRemoveAbility(j,'A001')
call UnitRemoveAbility(j,'A008')
set i = 0
set j = null
endfunction
function ShieldCondition takes nothing returns boolean
return GetSpellAbilityId() == 'A003'
// Condition, checking spell id
endfunction
function InitTrig_Shield takes nothing returns nothing
local trigger lt_Shield = CreateTrigger()
local integer iTrig1 = 0
loop
call TriggerRegisterPlayerUnitEvent( lt_Shield, Player(iTrig1),EVENT_PLAYER_UNIT_SPELL_CAST ,null)
set iTrig1 = iTrig1 + 1
exitwhen iTrig1 >= bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition( lt_Shield, Condition( function ShieldCondition ) )
call TriggerAddAction( lt_Shield, function Shield)
endfunction
function BurstEffect takes nothing returns nothing
local real rX = GetUnitX(GetSpellAbilityUnit())
local real rY = GetUnitY(GetSpellAbilityUnit())
local real rX2 = rX + 300
local real rY2 = rY + 75
local integer el = 0
local unit eu
local group eg = CreateGroup()
local boolean bX = false
local boolean bY = false
loop
set el = (el + 1)
// Creating 12 dummy units to create the effect
call GroupAddUnit(eg,CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()),'o000',rX,rY,270))
exitwhen el == 12
endloop
set el = 0
loop
set eu = FirstOfGroup(eg)
// Actually casting the effect
if bX == false then
set rX2 = rX2 - 75
else
set rX2 = rX2 + 75
endif
if bY == false then
set rY2 = rY2 - 75
else
set rY2 = rY2 + 75
endif
call IssuePointOrder(eu,"shockwave",rX2,rY2)
call UnitApplyTimedLife(eu,'B001',0.50)
call GroupRemoveUnit(eg,eu)
set el = (el + 1)
if rX2 == rX + -225 then
set bX = true
endif
if rY2 == rY + -225 then
set bY = true
endif
if rY2 == rY + 225 then
set bY = false
endif
exitwhen el == 12
endloop
// Cleaning memory leaks
set eu = null
call DestroyGroup(eg)
set eg = null
endfunction
function EffectCondition takes nothing returns boolean
return GetSpellAbilityId() == 'A002'
// Condition, checking spell id
endfunction
function InitTrig_Effect takes nothing returns nothing
local trigger lt_Effect = CreateTrigger()
local integer iTrig3 = 0
loop
call TriggerRegisterPlayerUnitEvent( lt_Effect, Player(iTrig3),EVENT_PLAYER_UNIT_SPELL_CAST ,null)
set iTrig3 = iTrig3 + 1
exitwhen iTrig3 >= bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition( lt_Effect, Condition( function EffectCondition ) )
call TriggerAddAction( lt_Effect, function BurstEffect)
endfunction
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