Prozix
New Member
- Reaction score
- 7
Rewritten the trigger:
couldn't test it because I haven't got your map
JASS:
scope HolyLight
globals
private constant integer ABILITY_ID = 039;A08F039; //ability id
private constant real DAMAGE = 25.0 //damage per level
private constant real AOE_MAX = 400. //area of effect which will grow
private constant real AOE_GROW = 100. //grow rate of aoe of spell
private constant string EFFECT_ENEMY = "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl" //effect in enemy when damage happen
private constant string EFFECT_ALLY = "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl" //effect in ally when heal happen
private constant string EFFECT_CIRCLE = "Abilities\\Spells\\Items\\ResourceItems\\ResourceEffectTarget.mdl"
private constant string EFFECT_ATTACH = "origin" //position of effect
endglobals
private function HolyLight_Conditions takes nothing returns boolean
return GetSpellAbilityId() == ABILITY_ID
endfunction
private function UnitFilter takes nothing returns boolean
local unit u = GetFilterUnit()
return IsUnitType(u, UNIT_TYPE_STRUCTURE) == false and IsUnitType(u, UNIT_TYPE_DEAD) == false
endfunction
//The spell effect
globals
private unit CASTER
private real AMOUNT
endglobals
private function SpellEffectEnum takes nothing returns nothing
local unit u = GetEnumUnit()
if IsUnitEnemy(u, GetOwningPlayer(CASTER)) == true then
call DestroyEffect(AddSpecialEffectTarget(EFFECT_ENEMY, u, EFFECT_ATTACH))
call UnitDamageTarget(CASTER, u, AMOUNT, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
else
call DestroyEffect(AddSpecialEffectTarget(EFFECT_ALLY, u, EFFECT_ATTACH))
call SetWidgetLife(u, GetWidgetLife(u) + AMOUNT)
endif
endfunction
//
//Actions
private function HolyLight_Actions takes nothing returns nothing
local location targetLoc = GetSpellTargetLoc()
local real range = 0.0
local integer n = 1
local group g
local unit caster = GetTriggerUnit()
local real damage = DAMAGE * GetUnitAbilityLevel(caster, ABILITY_ID)
loop
call CreateEffectCircle(targetLoc, range, n, EFFECT_CIRCLE, 2)
set g = CreateGroup()
call GroupEnumUnitsInRangeOfLoc(g, targetLoc, range, Filter(function UnitFilter)) //get the group
set CASTER = caster
set AMOUNT = damage
call ForGroup(g, function SpellEffectEnum)
call DestroyGroup(g)
set g = null
set range = range + AOE_GROW
set n = n + 10
exitwhen range >= AOE_MAX
call TriggerSleepAction (.3)
endloop
call RemoveLocation(targetLoc)
set targetLoc = null
endfunction
function InitTrig_Holy_Light takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function HolyLight_Conditions))
call TriggerAddAction(t, function HolyLight_Actions)
endfunction
endscope
couldn't test it because I haven't got your map