|
DOTA里面月神之箭,在游戏里面是飞行到一定距离箭才消失,但是代码里面是箭和施法点距离小于40箭就消失?想了很久都不明白,求解释
月神之箭的施法距离为3000,G字头和hb()都是读写缓存的函数
function uI takes nothing returns boolean
return GetSpellAbilityId()=='A0L8'
endfunction
function uj takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(Ae))and GetUnitAbilityLevel(GetFilterUnit(),'A04R')==0 and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>1 and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)==false
endfunction
function uJ takes real uk,real uK,real iN,real io returns integer
local real in=SquareRoot((iN-uk)*(iN-uk)+(io-uK)*(io-uK))
return iF(R2I(in/150),10)
endfunction
function ul takes nothing returns nothing
local timer t=GetExpiredTimer()
local string Hj=Gt(t)
local unit Hl=G2(Hj,"Hero")
local unit IJ=G2(Hj,"Projectile")
local real hN=hb(Hj,"TargetX")
local real ho=hb(Hj,"TargetY")
local real RK=hb(Hj,"Angle")
local real iN=GetUnitX(IJ)
local real io=GetUnitY(IJ)
local real Il=H6(GetUnitX(IJ)+30*Cos(RK))
local real IL=H8(GetUnitY(IJ)+30*Sin(RK))
local boolexpr hP=Condition(function uj)
local group hO=CreateGroup()
local unit oA
local unit iM
local real uk
local real uK
call SetUnitX(IJ,Il)
call SetUnitY(IJ,IL)
set Ae=Hl
call GroupEnumUnitsInRange(hO,Il,IL,140,hP)
set iM=FirstOfGroup(hO)
call DestroyGroup(hO)
call DestroyBoolExpr(hP)
if iM!=null then
set uk=hb(Hj,"OriginalX")
set uK=hb(Hj,"OriginalY")
set oA=CreateUnit(GetOwningPlayer(Hl),'e00E',iN,io,0)
call UnitAddAbility(oA,'A0L7')
call SetUnitAbilityLevel(oA,'A0L7',uJ(uk,uK,iN,io))
call IssueTargetOrderById(oA,852095,iM)
call UnitDamageTarget(Hl,iM,90*GetUnitAbilityLevel(Hl,'A0L8'),true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS)
call KillUnit(IJ)
call i0(t)
elseif(Il-hN)*(Il-hN)+(IL-ho)*(IL-ho)<1600 then
call KillUnit(IJ)
call i0(t) //i0(t)作用为停止并销毁timer t
endif
endfunction
function uL takes nothing returns nothing
local unit Hl=GetTriggerUnit()
local real iN=H6(GetUnitX(Hl))
local real io=H8(GetUnitY(Hl))
local location sy=GetSpellTargetLoc()
local real hN=GetLocationX(sy)
local real ho=GetLocationY(sy)
local real RK=Atan2(ho-io,hN-iN)
local timer t=CreateTimer()
local string Hj=Gt(t)
local unit IJ=CreateUnit(GetOwningPlayer(Hl),'h005',iN,io,RK*bj_RADTODEG)
call RemoveLocation(sy)
call SetUnitFacing(IJ,RK*bj_RADTODEG)
call SetUnitPathing(IJ,false)
set hN=H6(iN+3000*Cos(RK))
set ho=H8(io+3000*Sin(RK))
call GY(Hj,"OriginalX",iN)
call GY(Hj,"OriginalY",io)
call GY(Hj,"TargetX",hN)
call GY(Hj,"TargetY",ho)
call GY(Hj,"Angle",RK)
call Gw(Hj,"Hero",Hl)
call Gw(Hj,"Projectile",IJ)
call TimerStart(t,.035,true,function ul)
endfunction
function lp takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t,Condition(function uI))
call TriggerAddAction(t,function uL)
call H9('A0L7')
endfunction |
|