|
楼主 |
发表于 2006-6-1 23:30:22
|
显示全部楼层
[JASS]function NinjiaSlash_Child takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local integer index = 1
local unit whichUnit = GetHandleUnit(t, \"whichUnit\")
local unit targetUnit = GetHandleUnit(t, \"targetUnit\")
local real basedamage = GetHandleReal(t, \"basedamage\")
local real slowrate = GetHandleReal(t, \"slowrate\")
local string anim = GetHandleString(t, \"anim\")
local string effctpath = GetHandleString(t, \"effctpath\")
local real targetMoveSpeed = GetUnitMoveSpeed(targetUnit)
local location targetLocation
local location randomLocation
local effect re = AddSpecialEffectTarget( effctpath, whichUnit, \"hand right\" )
local effect le = AddSpecialEffectTarget( effctpath, whichUnit, \"hand left\" )
call TriggerSleepAction(0.5)
call PauseUnit( whichUnit, true )
call SetUnitInvulnerable( whichUnit, true )
//初始化
call SetUnitMoveSpeed(targetUnit, targetMoveSpeed*(slowrate/100))
loop
exitwhen index > 10 or GetUnitState(targetUnit, UNIT_STATE_LIFE) <= 0 or GetUnitState(whichUnit, UNIT_STATE_LIFE) <= 0
call PlaySoundOnUnitBJ(GetHandleSound(whichUnit, \"soundeffect\"),100,whichUnit)
set targetLocation = GetUnitLoc(targetUnit)
set randomLocation = PolarProjectionBJ(targetLocation, 150, GetRandomDirectionDeg())
call SetUnitPositionLoc(whichUnit,randomLocation)
call SetUnitFacingToFaceLocTimed(whichUnit, targetLocation, 0)
if index == 10 and ModuloInteger(index,2) ==0 then
call SetUnitAnimation(whichUnit,anim)
else
call SetUnitAnimation(whichUnit,\"attack\")
endif
call UnitDamageTargetBJ( whichUnit, targetUnit, basedamage*index/2, ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL )
call FadeTagUnit (I2S(R2I(basedamage*index/2))+\"!\",whichUnit,100,0,0,4)
call TriggerSleepAction(0.5)
call StopSound( GetHandleSound(whichUnit, \"soundeffect\"),false, false )
call RemoveLocation(targetLocation)
set targetLocation = null
call RemoveLocation(randomLocation)
set randomLocation = null
set index = index + 1
endloop
call FlushHandleLocals(t)
call DestroyEffect(re)
call DestroyEffect(le)
call SetUnitMoveSpeed(targetUnit, targetMoveSpeed)
call DestroyTrigger(GetTriggeringTrigger())
set t = null
call TriggerSleepAction(0.5)
call PauseUnit( whichUnit, false )
call SetUnitInvulnerable( whichUnit, false )
call SetUnitAnimation(whichUnit,\"stand\")
endfunction
//whichUnit - 释放技能的单位
//targetUnit - 被技能打中的单位
//basedamage - 基础伤害
//slowrate - 移动速度减少率slowrate%
//anim - 最后一击的动作
//effctpath - 跟随效果的路径
function NinjiaSlash takes unit whichUnit, unit targetUnit, real basedamage, real slowrate,string anim, string effctpath returns nothing
local timer t = CreateTimer()
local trigger action = CreateTrigger()
local sound MirrorImage = CreateSound( \"Abilities\\\\Spells\\\\Orc\\\\MirrorImage\\\\MirrorImage.wav\", false, true, true, 10, 10, \"SpellsEAX\" )
if GetHandleHandle(whichUnit, \"soundeffect\") == null then
call SetHandleHandle(whichUnit, \"soundeffect\", MirrorImage)
endif
call SetHandleHandle(action, \"whichUnit\", whichUnit)
call SetHandleHandle(action, \"targetUnit\", targetUnit)
call SetHandleReal(action, \"basedamage\", basedamage)
call SetHandleReal(action, \"slowrate\", slowrate)
call SetHandleString(action, \"anim\", anim)
call SetHandleString(action, \"effctpath\", effctpath)
call TriggerRegisterTimerExpireEvent( action, t )
call TriggerAddAction( action, function NinjiaSlash_Child )
call TriggerExecute( action )
set whichUnit = null
set targetUnit = null
endfunction[/JASS]
JASS |
|