/*
Echo Buster v1.12
by Adiktuz
--------------------------------------------------------
External Library Requirements:
Nova - http://www.hiveworkshop.com/forums/spells-569/nova-system-2-01-a-181884/
SpellEffectEvent - http://www.hiveworkshop.com/forums/jass-resources-412/snippet-spelleffectevent-187193/
--------------------------------------------------------
How to Import:
1) Import the Nova and Spell trigger folders to your map
2) Import the dummy.mdx model (if you haven't have one already) and create a dummy caster
3) Modify the spell settings on the globals block and spell setting functions
of the Echo Buster trigger (this trigger)
4) Make sure that you set the dummy's rawcode on the Nova library
--------------------------------------------------------
*/
library EchoBuster initializer OnInit requires Nova, SpellEffectEvent
globals
private constant integer SPELL_ID = 'A000' //Rawcode of the spell
private constant string PATH = "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl" //Path to the effect of the base spell
private constant attacktype AT = ATTACK_TYPE_MAGIC //attack type of the base spell
private constant damagetype DT = DAMAGE_TYPE_MAGIC //damage type of the base spell
private constant string E_PATH = "Abilities\\Spells\\Other\\HowlOfTerror\\HowlCaster.mdl" //Path to the effect of the echo
private constant attacktype E_AT = ATTACK_TYPE_CHAOS //attack type of the echo
private constant damagetype E_DT = DAMAGE_TYPE_DIVINE //damage type of the echo
private group tmpGroup = CreateGroup()
private constant key KEY //Placeholder key, random number
endglobals
//Setting functions for the base spell
private function Faoe takes integer level, unit caster returns real
return 150.0 + 50.0*level
endfunction
private function Scale takes integer level, unit caster returns real
return 1.0 + 0.1*level
endfunction
private function Height takes integer level, unit caster returns real
return 0.0
endfunction
private function Damage takes integer level, unit caster returns real
return 100.0*level
endfunction
//Setting functions for the echo
private function EFaoe takes integer level, unit caster returns real
return 100.0
endfunction
private function EDelay takes integer level, unit caster returns real
return 0.50
endfunction
private function EScale takes integer level, unit caster returns real
return 0.8
endfunction
private function EHeight takes integer level, unit caster returns real
return 0.0
endfunction
private function EDamage takes integer level, unit caster returns real
return 0.0 + level*GetHeroInt(caster,true)
endfunction
//Determines which units can cause echos
private function CanEcho takes unit u, NovaSystem nova returns boolean
return IsUnitEnemy(u,nova.owner) and GetWidgetLife(u) >= .405 and not IsUnitType(u, UNIT_TYPE_DEAD)
endfunction
//Main spell function
private function Fire takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer level = GetUnitAbilityLevel(u,SPELL_ID)
local unit v = null
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local NovaSystem nova = NovaSystem.simpleCreate(u,null, x, y,/*
*/Faoe(level,u), Height(level,u), Damage(level,u), Scale(level,u), PATH, AT, DT, SPELL_ID)
call GroupEnumUnitsInRange(tmpGroup, x, y, Faoe(level,u), null)
loop
set v = FirstOfGroup(tmpGroup)
exitwhen v == null
if CanEcho(v,nova) then
call NovaSystem.simpleCreateDelayTarget(u,v, GetUnitX(v), GetUnitY(v),EDelay(level,u),/*
*/EFaoe(level,u), EHeight(level,u), EDamage(level,u), EScale(level,u), E_PATH, E_AT, E_DT, KEY)
endif
call GroupRemoveUnit(tmpGroup,v)
endloop
set u = null
endfunction
private function OnInit takes nothing returns nothing
call RegisterSpellEffectEvent(SPELL_ID, function Fire)
endfunction
endlibrary