library CircularShock initializer init requires Nova
//You need the Nova System
globals
private integer SPELL_ID = 'A000' //the rawcode of your spell
private string PATH = "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl" //The path of the special effect
private real OFFSET = 400.0 //the offset of the shocks
private integer AMOUNT = 12 //The amount of shocks
private real DELAY = .3 //the time delay between each shock
private attacktype AT = ATTACK_TYPE_MAGIC //The attack type of the spell
private damagetype DT = DAMAGE_TYPE_LIGHTNING //Damage type of the spell
endglobals
//I added caster as a parameter, just in case you want to add the attributes to the damage
private function GetDamage takes integer level, unit caster returns real
return 100.0*level
endfunction
private function AOE takes integer level returns real
return 200.0
endfunction
private function Shocks takes nothing returns boolean
local unit a = GetTriggerUnit()
local integer level = GetUnitAbilityLevel(a, SPELL_ID)
local real angle = bj_DEGTORAD*GetUnitFacing(a)
local real angle_2 = 360.0/AMOUNT
local real x = GetUnitX(a)
local real y = GetUnitY(a)
local integer i = 0
if GetSpellAbilityId() == SPELL_ID then
loop
exitwhen i == AMOUNT
call NovaSystem.create(a, x + OFFSET*Cos(angle + angle_2*i), y + OFFSET*Sin(angle + angle_2*i), 0.0, AOE(level), 0.0, 1, 1, DELAY*i, DELAY*i, GetDamage(level, a), (AOE(level))/200.0, false, false, false, PATH , AT, DT)
set i = i + 1
endloop
endif
endif
set a = null
return false
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function Shocks))
set t = null
endfunction
endlibrary