function ability_conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction
function ability_actions takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local unit target = GetSpellTargetUnit()
local integer level = GetUnitAbilityLevel(caster, 'A000')
local location target_loc = GetUnitLoc(target)
local location caster_loc = GetUnitLoc(caster)
local integer target_id = GetUnitTypeId(target)
if level == 1 then
call SetUnitPosition(caster, target_loc)
call UnitDamageTarget(caster, target, 75, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
call SetUnitPosition(caster, caster_loc)
elseif level == 2 then
call SetUnitPosition(target, caster_loc)
call UnitDamageTarget(caster, target, 155, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
call DestroyEffect(AddSpecialEffectLoc("Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl", caster_loc))
elseif level == 3 then
set dummy = CreateUnit(GetOwningPlayer(caster), target_id, target_loc)
call UnitAddAbility(dummy, 'A001')
call IssueTargetOrderById(dummy, 'A001', target)
call RemoveUnit(dummy)
endif
call RemoveLocation(target_loc)
call RemoveLocation(caster_loc)
set caster = null
set target = null
set target_loc = null
set caster_loc = null
set target_id = 0
set dummy = null
endfunction
function InitTrig_ability takes nothing returns nothing
local trigger gg_trig_ability = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trig_ability, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trig_ability, Condition(function ability_conditions))
call TriggerAddAction(gg_trig_ability, function ability_actions)
endfunction