scope Revenge
private struct ReData
real dmg
endstruct
//store damage taken
private function Damage takes nothing returns nothing
local ReData r = t[GetTriggerUnit()]
set r.dmg = r.dmg+GetEventDamage()
endfunction
private function IsSpell takes nothing returns boolean
return GetSpellAbilityId() == 'A02M'
endfunction
//damage units with damage taken
private function Explode takes nothing returns nothing
local ReData r = t[GetTriggerUnit()]
call DamageArea(GetTriggerUnit(),r.dmg,GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()),600.,ENEMYS)
endfunction
private function Actions takes nothing returns nothing
local trigger trig
local ReData r = ReData.create()
set r.dmg = 0
set t = HandleTable.create()
set t[GetTriggerUnit()] = r
set trig = CreateTrigger()
call TriggerRegisterUnitEvent( t, GetTriggerUnit(), EVENT_UNIT_DAMAGED )
call TriggerAddAction( t, function Damage )
call TriggerRegisterUnitEvent( t, GetTriggerUnit(), EVENT_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function IsSpell ) )
call TriggerAddAction( t, function Explodes )
set trig = null
endfunction
private function Conditions takes nothing returns boolean
return GetLearnedSkill() == 'A0G7' and GetUnitAbilityLevel(GetTriggerUnit(),'A0G7')<=1
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( t, Condition( function Conditions ) )
call TriggerAddAction( t, function Actions )
set t = null
endfunction
endscope