找回密码
 点一下
查看: 2320|回复: 7

忍之舞(类似连续击Slash的技能模板)

[复制链接]
发表于 2006-6-1 23:27:46 | 显示全部楼层 |阅读模式
好久没做演示了,今天顺手放个出来……:)
这个演示技能可以随意修改伤害、魔法效果等等……是一个类似连续击打(Slash Spell)的技能模板。
注意粘贴触发器的时候,创建一个GameCache的游戏缓存变量,即(udg_GameCache)

[ 本帖最后由 蚊子叮 于 2006-6-1 23:33 编辑 ]
 楼主| 发表于 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
回复

使用道具 举报

 楼主| 发表于 2006-6-1 23:32:18 | 显示全部楼层
//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()
    if GetHandleHandle(whichUnit, \"soundeffect\") == null then
        call SetHandleHandle(whichUnit, \"soundeffect\", CreateSound( \"Abilities\\\\Spells\\\\Orc\\\\MirrorImage\\\\MirrorImage.wav\", false, true, true, 10, 10, \"SpellsEAX\" ))        
    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

修改了一处问题,可能会造成内存泄露

[ 本帖最后由 蚊子叮 于 2006-6-1 23:41 编辑 ]
回复

使用道具 举报

发表于 2006-6-2 09:04:31 | 显示全部楼层
传说中的蚊子叮不是一个男生么?怎么变男的了。。。。。:L
回复

使用道具 举报

发表于 2006-6-2 14:58:28 | 显示全部楼层
男生变男的?难道是那方面的成长?
回复

使用道具 举报

发表于 2006-6-2 15:28:43 | 显示全部楼层
看不懂
!我是菜鸟!~
回复

使用道具 举报

发表于 2006-6-2 19:18:59 | 显示全部楼层
顶了,好东西呀!!!
『KickedByOthers专用抗议这万恶的10字节』
『KickedByOthers代表世界水友抗议10字节』
『GA水协_KickedByOthers对10字抗议标签』
回复

使用道具 举报

发表于 2006-6-3 16:39:03 | 显示全部楼层
蚊子大人来了!MBMB
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-11-21 21:46 , Processed in 0.033736 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表