- Joined
- Apr 16, 2011
- Messages
- 158
JASS:
library ThundergodsWrath initializer onInit uses SpellEffectEvent
globals
private constant integer ABIL_CODE = 'A03Z'
private constant integer ABIL_CODE_DUMMY = 'A03W'
private constant integer ABIL_FLY = 'Amrf'
private constant integer DUMMY = 'n00V'
private constant string EFFECT_1 = "Abilities\\Weapons\\ChimaeraLightningMissile\\ChimaeraLightningMissile.mdl"
private constant string EFFECT_2 = "Abilities\\Weapons\\Bolt\\BoltImpact.mdl"
private constant real REAL = 1000
endglobals
private function TargetFilter takes nothing returns boolean
return IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO) and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit())) and GetUnitAbilityLevel(GetFilterUnit(),'Aloc') == 0
endfunction
private function Thundergods_Wrath_Bolt takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit e = GetEnumUnit()
local unit d = CreateUnit(GetOwningPlayer(u),DUMMY,GetUnitX(e),GetUnitY(e),0)
call UnitAddAbility(d,ABIL_FLY)
call UnitAddAbility(d,ABIL_CODE_DUMMY)
call SetUnitAbilityLevel(d,ABIL_CODE_DUMMY,GetUnitAbilityLevel(u,ABIL_CODE)+4)
call SetUnitFlyHeight(d,REAL,0)
call IssueTargetOrder(d,"chainlightning",e)
call UnitApplyTimedLife(d,'BTLF',3)
set e = null
set d = null
endfunction
private function onCast takes nothing returns nothing
local group g = CreateGroup()
local unit u = GetTriggerUnit()
local unit p
local unit d
local boolexpr b = Condition(function TargetFilter)
call DestroyEffect(AddSpecialEffectTarget(EFFECT_1,u,"hand right"))
call DestroyEffect(AddSpecialEffectTarget(EFFECT_2,u,"origin"))
call GroupEnumUnitsInRect(g,GetPlayableMapRect(),b)
call ForGroup(g,function Thundergods_Wrath_Bolt)
call DestroyBoolExpr(b)
call DestroyGroup(g)
set u = null
set p = null
set d = null
set g = null
set b = null
endfunction
private function onInit takes nothing returns nothing
call RegisterSpellEffectEvent(ABIL_CODE, function onCast)
endfunction
endlibrary
How to improve it
-GetPlayableMapRect
-TargetFilter
-ForGroup and GroupEnumUnitsInRect(I have printout that Magtheridon96 said something to me once ...
let your opinion, tip, tell about a mistake, all is well accepted
I have a printout that already created a topic like this...
thanks