scope SunStike initializer Init
/**********************
*
* Sun Strike
* v1.3.0.0
* By tRu.Style
*
* - Creates the effect of the point of the used capacity, after some time the effect is removed.
* - Created another effect and all the enemies in the x AoE causes damage.
*
* Requirements:
* -------------
*
* TimerUtils v 2.0 - by Vexorian
* - http://www.wc3c.net/showthread.php?t=101322
*
* Implementation Instructions
* ---------------------------
*
* 1. Copy ability Sun Strike
* 2. Copy trigger SunStrike and TimerUtils
* 3. Setup variable
* 4. Now ready
*
* Credits:
* --------
*
* - Magtheridon96 (Explained it all to the smallest detail and gave form filling :D)
*
**********************/
////////////////////
// SetUp //
////////////////////
globals
//Damage = SSDAMAGE * SS lvl
private constant integer SSID = 'A000' // SS ability ID
private constant integer SSDAMAGE = 50 // Standart dagame on SS
private constant string SSBOOMEF = "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl" // Destroy SS effect
private constant string SSEFFECT = "Abilities\\Spells\\Other\\Drain\\ManaDrainTarget.mdl" // Cast SS effect
private constant real SSAOE = 175. // SS AoE
private constant real SSAOEFM = 225. // SS fog AoE
private constant real SSTIMECAST = 1.70 // SS time to stike
// AoE info - If gathered change the radius, then do not forget to change it in the ability of the SS
private constant attacktype ATTACK_TYPE = ATTACK_TYPE_NORMAL // Attack type damage
private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_FIRE // Damage type use fire or DAMAGE_TYPE_NORMAL
private constant boolean PRELOAD = true // Preload effect, true preload , false dont preload
endglobals
////////////////////
// End SetUp //
////////////////////
//Do not touch struct/////
/* */struct SS //
/* */ unit caster //
/* */ integer damage //
/* */ real x //
/* */ real y //
/* */ effect ef //
/* */ fogmodifier fm //
/* */endstruct //
//////////////////////////
function SSBool takes unit u,unit e returns boolean
return /*
*/ GetWidgetLife(e) > .405 and /* // target is alive
*/ IsUnitEnemy(e,GetOwningPlayer(u)) and /* // target is an enemy of caster
*/ not IsUnitType(e, UNIT_TYPE_STRUCTURE) and /* // target is not a structure
*/ not IsUnitType(e, UNIT_TYPE_MECHANICAL) and /* // target is not mechanic
*/ not IsUnitType(e, UNIT_TYPE_MAGIC_IMMUNE) // targer is not magic immune
endfunction
function LocalEffect takes string ef, real x, real y, player pl returns effect
// this function crate effect for local player aka one player
local string e = ""
if (GetLocalPlayer() == pl) then
set e = ef
endif
return AddSpecialEffect(e,x,y)
endfunction
function SSStike takes nothing returns nothing
local timer t = GetExpiredTimer()
local SS data = GetTimerData(t)
local unit e
local group g = CreateGroup()
call DestroyEffect(data.ef)
call DestroyEffect(AddSpecialEffect(SSBOOMEF,data.x,data.y))
call GroupEnumUnitsInRange(g,data.x,data.y,SSAOE, null)
loop
set e = FirstOfGroup(g)
exitwhen(e == null)
call GroupRemoveUnit(g,e)
if SSBool(data.caster,e) then
call UnitDamageTarget(data.caster,e,data.damage,false,false,ATTACK_TYPE,DAMAGE_TYPE,null)
endif
endloop
call DestroyFogModifier(data.fm)
call data.destroy()
call ReleaseTimer(t)
call DestroyGroup(g)
set g = null
set e = null
set t = null
endfunction
function SSAct takes nothing returns boolean
local SS data
if GetSpellAbilityId() == SSID then
set data = SS.create()
set data.caster = GetTriggerUnit()
set data.damage = SSDAMAGE * GetUnitAbilityLevel(data.caster,SSID)
set data.x = GetSpellTargetX()
set data.y = GetSpellTargetY()
set data.ef = LocalEffect(SSEFFECT,data.x,data.y,GetTriggerPlayer())
set data.fm = CreateFogModifierRadius(GetTriggerPlayer(),FOG_OF_WAR_VISIBLE,data.x,data.y,SSAOEFM,true,true)
call FogModifierStart(data.fm)
call TimerStart(NewTimerEx(data),SSTIMECAST,false,function SSStike)
endif
return false
endfunction
function Init takes nothing returns nothing
local trigger trg = CreateTrigger()
static if PRELOAD then
call Preload(SSEFFECT)
call Preload(SSBOOMEF)
endif
call TriggerRegisterAnyUnitEventBJ(trg,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(trg,Condition(function SSAct))
set trg = null
endfunction
endscope