|
[jass]function EluneArrowCheck takes nothing returns boolean
return GetSpellAbilityId()=='A0L8'
endfunction
function EluneArrowFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_u_DTAX_temp))and GetUnitAbilityLevel(GetFilterUnit(),'A04R')==0 and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>1 and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)==false
endfunction
function EluneArrowStunCalc takes real pX1,real pY1,real pX2,real pY2 returns integer
local real lDistance=SquareRoot((pX2-pX1)*(pX2-pX1)+(pY2-pY1)*(pY2-pY1))
return ReturnMin(R2I(lDistance/150),10)
endfunction
function EluneArrowTimer takes nothing returns nothing
local timer lMove=GetExpiredTimer()
local string lTable=H2Tx(lMove)
local unit lCaster=GetUnit(lTable,"Hero")
local unit lBolt=GetUnit(lTable,"Projectile")
local real lXL=GetReal(lTable,"TargetX")
local real lYL=GetReal(lTable,"TargetY")
local real lAngle=GetReal(lTable,"Angle")
local real lXX=GetUnitX(lBolt)
local real lYY=GetUnitY(lBolt)
local real lXN=SafeX(GetUnitX(lBolt)+30*Cos(lAngle))
local real lYN=SafeY(GetUnitY(lBolt)+30*Sin(lAngle))
local boolexpr lCheck=Condition(function EluneArrowFilter)
local group lEnumGroup=CreateGroup()
local unit lTemp
local unit lFirst
local real lXF
local real lYF
call SetUnitX(lBolt,lXN)
call SetUnitY(lBolt,lYN)
set udg_u_DTAX_temp=lCaster
call GroupEnumUnitsInRange(lEnumGroup,lXN,lYN,150,lCheck)
set lFirst=FirstOfGroup(lEnumGroup)
call DestroyGroup(lEnumGroup)
call DestroyBoolExpr(lCheck)
if lFirst!=null then
set lXF=GetReal(lTable,"OriginalX")
set lYF=GetReal(lTable,"OriginalY")
set lTemp=CreateUnit(GetOwningPlayer(lCaster),'e00E',lXX,lYY,0)
call UnitAddAbility(lTemp,'A0L7')
call SetUnitAbilityLevel(lTemp,'A0L7',EluneArrowStunCalc(lXF,lYF,lXX,lYY))
call IssueTargetOrderById(lTemp,OrderId("thunderbolt"),lFirst)
call UnitDamageTarget(lCaster,lFirst,90*GetUnitAbilityLevel(lCaster,'A0L8'),true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS)
call KillUnit(lBolt)
call KillTimer(lMove)
elseif(lXN-lXL)*(lXN-lXL)+(lYN-lYL)*(lYN-lYL)<1600 then
call KillUnit(lBolt)
call KillTimer(lMove)
endif
endfunction
function EluneArrowAction takes nothing returns nothing
local unit lCaster=GetTriggerUnit()
local real lXX=SafeX(GetUnitX(lCaster))
local real lYY=SafeY(GetUnitY(lCaster))
local location lCastLoc=GetSpellTargetLoc()
local real lXL=GetLocationX(lCastLoc)
local real lYL=GetLocationY(lCastLoc)
local real lAngle=Atan2(lYL-lYY,lXL-lXX)
local timer lMove=CreateTimer()
local string lTable=H2Tx(lMove)
local unit lBolt=CreateUnit(GetOwningPlayer(lCaster),'h005',lXX,lYY,lAngle*bj_RADTODEG)
call RemoveLocation(lCastLoc)
call SetUnitFacing(lBolt,lAngle*bj_RADTODEG)
call SetUnitPathing(lBolt,false)
set lXL=SafeX(lXX+3000*Cos(lAngle))
set lYL=SafeY(lYY+3000*Sin(lAngle))
call SetReal(lTable,"OriginalX",lXX)
call SetReal(lTable,"OriginalY",lYY)
call SetReal(lTable,"TargetX",lXL)
call SetReal(lTable,"TargetY",lYL)
call SetReal(lTable,"Angle",lAngle)
call SetHandle(lTable,"Hero",lCaster)
call SetHandle(lTable,"Projectile",lBolt)
call TimerStart(lMove,.035,true,function EluneArrowTimer)
endfunction
function HJ takes nothing returns nothing
local trigger ltt=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(ltt,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(ltt,Condition(function EluneArrowCheck))
call TriggerAddAction(ltt,function EluneArrowAction)
call SpellPreload('A0L7')
endfunction
function InitTrig_Elune_Arrow takes nothing returns nothing
endfunction[/jass]
不知道这个是不是真的代码。。。
在执行EluneArrowFilter这个的时候,要用到全局函数,set udg_u_DTAX_temp=lCaster,也就是选取的单位是施法者的敌人。
那么,如果在白虎A施放这个技能之后的整数倍0.35秒的那个时刻,如果这个技能还没有完成,白虎B也施放了这个技能,2个白虎不是盟友,那么就会同时间设置u_DTAX_temp,是不是就会出现一些问题啊? |
|