//TESH.scrollpos=0
//TESH.alwaysfold=0
Name | Type | is_array | initial_value |
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope StormoftheDead initializer Init
//===========================================================================
//=============================CONSTANT VARS=================================
//===========================================================================
native UnitAlive takes unit id returns boolean
globals
private constant integer SPELL_ID = 'A000'
private constant integer DUMMY_ID = 'h000'
private constant string EFFECT = "Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl" //FX
private constant real RADIUS = 400.
private constant attacktype A_TYPE = ATTACK_TYPE_NORMAL
private constant damagetype D_TYPE = DAMAGE_TYPE_UNIVERSAL
private constant real ANGLE = 18.
private constant real RANGE1 = 100.
private constant real RANGE2 = 200.
private constant real RANGE3 = 300.
private constant real RANGE4 = 400.
endglobals
private function Damage takes integer lvl, unit u returns real
return lvl*7.*GetHeroInt(u,true)
endfunction
private function Get takes unit u returns boolean
//the units the spell will affect
return UnitAlive(u) == true and (IsUnitType(u, UNIT_TYPE_STRUCTURE) == false) and (IsUnitType(u, UNIT_TYPE_MAGIC_IMMUNE) == false)
endfunction
//===========================================================================
//===================================END=====================================
//===========================================================================
globals
private group g
private boolexpr b
private group h
endglobals
//===========================================================================
//blade.dk copy group
private function CopyGroup takes group g returns group
set bj_groupAddGroupDest = CreateGroup()
call ForGroup(g, function GroupAddGroupEnum)
return bj_groupAddGroupDest
endfunction
//===========================================================================
private function Pick takes nothing returns boolean
return Get(GetFilterUnit())
endfunction
//===========================================================================
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
//===========================================================================
private function Actions takes nothing returns nothing
local unit a = GetTriggerUnit()
local unit u
local real locX = GetSpellTargetX()
local real locY = GetSpellTargetY()
local real x
local real y
local integer i = 0
local integer lvl = GetUnitAbilityLevel(a,SPELL_ID)
call GroupEnumUnitsInRange(g, locX, locY, RADIUS, b)
set h = CopyGroup(g)
loop
set u = FirstOfGroup(h)
exitwhen(u == null)
call GroupRemoveUnit(h, u)
if IsUnitEnemy(u, GetOwningPlayer(a)) then
call UnitDamageTarget(a, u, Damage(lvl,a), true, false, A_TYPE, D_TYPE, null)
endif
endloop
loop
exitwhen i > 20
//1
set x = locX + RANGE1 * Cos((i * ANGLE) * bj_DEGTORAD)
set y = locY + RANGE1 * Sin((i * ANGLE) * bj_DEGTORAD)
call DestroyEffect(AddSpecialEffect(EFFECT, x, y))
//2
set x = locX + RANGE2 * Cos((i * ANGLE) * bj_DEGTORAD)
set y = locY + RANGE2 * Sin((i * ANGLE) * bj_DEGTORAD)
call DestroyEffect(AddSpecialEffect(EFFECT, x, y))
//3
set x = locX + RANGE3 * Cos((i * ANGLE) * bj_DEGTORAD)
set y = locY + RANGE3 * Sin((i * ANGLE) * bj_DEGTORAD)
call DestroyEffect(AddSpecialEffect(EFFECT, x, y))
//4
set x = locX + RANGE4 * Cos((i * ANGLE) * bj_DEGTORAD)
set y = locY + RANGE4 * Sin((i * ANGLE) * bj_DEGTORAD)
call DestroyEffect(AddSpecialEffect(EFFECT, x, y))
set i = i + 1
endloop
set a = null
set u = null
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger StormoftheDeadTrg = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(StormoftheDeadTrg, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(StormoftheDeadTrg, Condition( function Conditions ) )
call TriggerAddAction( StormoftheDeadTrg, function Actions )
set g = CreateGroup()
set h = CreateGroup()
set b = Condition(function Pick)
call Preload(EFFECT)
//preloads ability
set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DUMMY_ID, 0, 0, 0)
call UnitAddAbility(bj_lastCreatedUnit, SPELL_ID)
call KillUnit(bj_lastCreatedUnit)
endfunction
endscope