找回密码
 点一下
查看: 1580|回复: 3

求人解释一下函数

[复制链接]
发表于 2011-4-22 17:07:27 | 显示全部楼层 |阅读模式
小弟在复制ICEFROG的无敌斩的时候遇到了难题,求解
[jass]
// Objects used:
// 'A0M1' = Omnislash (Juggernaut : Yurnero)
// 'Nbbc' = Juggernaut
// 'o003' = Spin Web
// 'e00C' = Stop looking at me swan!!
// 'A04R' = Marker (Nether Ward 4,Lightning Bolter,Nether Ward 3,Nether Ward 2,Vengeance Death caster,...)
// 'A05G' = Blade Fury (Juggernaut : Yurnero)

// DEBUG Trigger Number : 255
function Trig_Blade_Fury_Conditions takes nothing returns boolean
    return GetSpellAbilityId()=='A0M1'
endfunction

function Omnislash_IsJugg takes nothing returns boolean
    return GetUnitTypeId(GetTriggerUnit())=='Nbbc'
endfunction

function Omnislash_AntiSelect takes nothing returns nothing
    call SelectUnitRemoveForPlayer(GetTriggerUnit(),GetOwningPlayer(GetTriggerUnit()))
endfunction

function Omnislash_Damage takes unit pOd,unit pFB returns nothing
    local location ln3=GetUnitLoc(pFB)
    local location lOD=GetUnitLoc(pOd)
    local location liD=PolarProjectionBJ(ln3,50,GetRandomReal(0,360))
    local effect lfx
    call SetUnitPositionLocFacingBJ(pOd,liD,AngleBetweenPoints(lOD,ln3))
    call SetUnitAnimation(pOd,"Attack")
    call UnitDamageTargetBJ(pOd,pFB,GetRandomReal(150,250),ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL)
    set lfx=AddSpecialEffectTargetUnitBJ("chest",pOd,"Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl")
    call RemoveLocation(ln3)
    call RemoveLocation(lOD)
    call RemoveLocation(liD)
    call DestroyEffect(lfx)
endfunction

function Omnislash_Filter takes nothing returns boolean
    if(GetUnitTypeId(GetFilterUnit())!='o003')then
        if(GetUnitTypeId(GetFilterUnit())!='e00C')then
            if(IsUnitAliveBJ(GetFilterUnit()))then
                if(IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)==false)then
                    if(GetUnitAbilityLevelSwapped('A04R',GetFilterUnit())!=1)then
                        return true
                    endif
                endif
            endif
        endif
    endif
    return false
endfunction

function Omnislash_Strike takes unit pOd returns unit
    local player lOf=GetOwningPlayer(pOd)
    local unit lFB
    local group lEw
    local location lOD=GetUnitLoc(pOd)
    local boolean lOF=false
    set lEw=GetUnitsInRangeOfLocMatching(575,lOD,Condition(function Omnislash_Filter))
    loop
        exitwhen lOF
        set lFB=GroupPickRandomUnit(lEw)
        if(IsUnitVisible(lFB,lOf))then
            if(IsUnitEnemy(lFB,lOf))then
                set lOF=true
            endif
        endif
        call GroupRemoveUnit(lEw,lFB)
        if(IsUnitGroupEmptyBJ(lEw))then
            if(lOF==false)then
                set lFB=null
            endif
            set lOF=true
        endif
    endloop
    call RemoveLocation(lOD)
    call DestroyGroup(lEw)
    set udg_u_DTAX_temp=lFB
    return udg_u_DTAX_temp
endfunction

function Trig_Blade_Fury_Actions takes nothing returns nothing
    local trigger lOG=CreateTrigger()
    local unit lOd=GetTriggerUnit()
    local player lOf=GetOwningPlayer(lOd)
    local unit lFB=GetSpellTargetUnit()
    local integer lMP=GetUnitAbilityLevel(lOd,'A0M1')
    local integer lEq=2
    local integer lEQ=3
    local integer lOh=GetUnitAbilityLevel(lOd,'A05G')
    if(lMP==2)then
        set lEQ=5
    endif
    if(lMP==3)then
        set lEQ=8
    endif
    if(lOh>0)then
        call SetPlayerAbilityAvailable(lOf,'A05G',false)
    endif
    call SelectUnitRemoveForPlayer(lOd,lOf)
    call SetUnitVertexColorBJ(lOd,100,100,100,50)
    call SetUnitPathing(lOd,false)
    call SetUnitInvulnerable(lOd,true)
    call PolledWait(.01)
    call TriggerRegisterPlayerSelectionEventBJ(lOG,lOf,true)
    call TriggerAddCondition(lOG,Condition(function Omnislash_IsJugg))
    call TriggerAddAction(lOG,function Omnislash_AntiSelect)
    if(IsUnitAliveBJ(lOd))then
        call Omnislash_Damage(lOd,lFB)
        call PolledWait(.25)
        loop
            exitwhen lEq>lEQ
            set lFB=Omnislash_Strike(lOd)
            if(lFB!=null)then
                if(IsUnitAliveBJ(lOd))then
                    call Omnislash_Damage(lOd,lFB)
                    call PolledWait(.25)
                endif
            else
                set lEq=lEQ+1
            endif
            set lEq=lEq+1
        endloop
    endif
    call DisableTrigger(lOG)
    call SetUnitPathing(lOd,true)
    call SetUnitInvulnerable(lOd,false)
    call SetUnitScalePercent(lOd,100.,100.,100.)
    call SetUnitVertexColorBJ(lOd,100,100,100,.0)
    call SelectUnitAddForPlayer(lOd,lOf)
    if(lOh>0)then
        call UnitAddAbility(lOd,'A05G')
        call SetUnitAbilityLevel(lOd,'A05G',lOh)
    endif
    call PolledWait(.01)
    if(lOh>0)then
        call SetPlayerAbilityAvailable(lOf,'A05G',true)
    endif
endfunction

function StartTrigger_Blade_Fury takes nothing returns nothing
    set gg_trg_Blade_Fury=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Blade_Fury,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_Blade_Fury,Condition(function Trig_Blade_Fury_Conditions))
    call TriggerAddAction(gg_trg_Blade_Fury,function Trig_Blade_Fury_Actions)
endfunction

function InitTrig_Blade_Fury takes nothing returns nothing
endfunction
[/jass]
发表于 2011-5-1 08:30:58 | 显示全部楼层
我想问的是..LZ.你的问题是什么
回复

使用道具 举报

 楼主| 发表于 2011-5-1 09:04:19 | 显示全部楼层
就是翻译一下那些CALL 后面的函数是什么意识
回复

使用道具 举报

发表于 2011-5-1 09:59:52 | 显示全部楼层
或许英汉词典比较有效,当然学好英语更好,jass的函数名还是很通俗易懂的,直接翻译就是了
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-21 23:04 , Processed in 0.034427 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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