|
楼主 |
发表于 2012-6-8 18:24:16
|
显示全部楼层
globals
hashtable HT = InitHashtable()
constant string XLDJ_EFFECT = "Abilities\\\\Spells\\\\Human\\\\Thunderclap\\\\ThunderClapCaster.mdl"
endglobals
function Trig_XLDJ_3 takes nothing returns boolean
local unit trgUnit = GetAttacker()
local unit tagUnit = GetTriggerUnit()
local integer Key = GetUnitUserData(trgUnit)
local integer xl = LoadInteger(HT, Key, 0)
local integer lv = LoadInteger(HT, Key, 1)
local timer t = LoadTimerHandle(HT, Key, 4)
local effect eff = null
local real array jl
if(GetUnitAbilityLevel(trgUnit, 'B000') > 0)then
set jl[1] = 0.10
set jl[2] = 0.125
set jl[3] = 0.14
set jl[4] = 0.15
if(GetRandomReal(0, 1) <= jl[lv])then
set xl = xl * 3
endif
call UnitRemoveAbility(trgUnit, 'B000')
call UnitDamageTarget(trgUnit, tagUnit, xl, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
set eff = AddSpecialEffectTarget(XLDJ_EFFECT, tagUnit, "origin")
call YDWETimerDestroyEffect( 0.5, eff)
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(HT, Key)
endif
set trgUnit = null
set tagUnit = null
set t = null
set eff = null
return false
endfunction
function Trig_XLDJ_2 takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer Key = GetHandleId(t)
local integer xl = LoadInteger(HT, Key, 0)
local integer lv = LoadInteger(HT, Key, 1)
local integer end = LoadInteger(HT, Key, 2)
local unit trgUnit = LoadUnitHandle(HT, Key, 3)
local texttag tag = CreateTextTagUnitBJ( I2S(end), trgUnit, 10.00, 15.00, 25.00, 60.00, 100, 0 )
call SetTextTagVelocity( tag, 0.01, 0.02 )
call YDWETimerDestroyTextTag( 0.50, tag )
if(end <= 0)then
call PauseTimer(t)
call DestroyTimer(t)
call PolledWait(2.00)
call FlushChildHashtable(HT, Key)
else
set xl = xl + (2 + lv * 3)
set end = end - 1
endif
call SaveInteger(HT, Key, 0, xl)
call SaveInteger(HT, Key, 2, end)
set t = null
endfunction
function Trig_XLDJ_1 takes nothing returns boolean
local timer t = CreateTimer()
local integer Key = GetHandleId(t)
local unit trgUnit = GetTriggerUnit()
local unit mjUnit = null
local location loc = GetUnitLoc(trgUnit)
local integer lv = GetUnitAbilityLevel(trgUnit, 'A000')
if(GetSpellAbilityId() == 'A000')then
set mjUnit = CreateUnitAtLoc(GetOwningPlayer(trgUnit), 'hfoo', loc, 0)
call ShowUnit(mjUnit, false)
call UnitAddAbility(mjUnit, 'A001')
call SetUnitAbilityLevel(mjUnit, 'A001', lv)
call IssueTargetOrder(mjUnit, "slow", trgUnit)
call YDWETimerRemoveUnit( 0.5, mjUnit)
call SetUnitUserData(trgUnit, Key)
call SaveInteger(HT, Key, 0, 0)
call SaveInteger(HT, Key, 1, lv)
call SaveInteger(HT, Key, 2, lv + 2)
call SaveUnitHandle(HT, Key, 3, trgUnit)
call SaveTimerHandle(HT, Key, 4, t)
call TimerStart(t, 1.00, true, function Trig_XLDJ_2)
endif
set t = null
set trgUnit = null
set mjUnit = null
return false
endfunction
//===========================================================================
function InitTrig_XLDJ takes nothing returns nothing
local trigger XLDJ1 = CreateTrigger()
local trigger XLDJ2 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(XLDJ1, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterAnyUnitEventBJ(XLDJ2, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition(XLDJ1, Condition(function Trig_XLDJ_1))
call TriggerAddCondition(XLDJ2, Condition(function Trig_XLDJ_3))
set XLDJ1 = null
set XLDJ2 = null
endfunction |
|