|
发表于 2009-12-31 09:11:28
|
显示全部楼层
[jass]function IsLocInDirection takes real x,real y,real tx,real ty,real facing,real sa,real ea returns boolean
local real ang = (57.296)*Atan2(ty-y,tx-x)+180
local real rsa = facing + sa
local real rea = facing + ea
if(ang>=rsa and ang<=rea)then
return true
endif
set ang = ang + 360.0
if(ang>=rsa and ang<=rea)then
return true
endif
return false
endfunction
function SneakAttackCheck takes unit u,unit tu returns boolean
if(GetUnitState(u,UNIT_STATE_LIFE)<=0.0 or GetUnitState(tu,UNIT_STATE_LIFE)<=0.0)then
return false
endif
if(GetUnitAbilityLevel(u,SYD_SneakAttackImmuneBuff)>0)then
return false
endif
if(GetUnitAbilityLevel(u,SYD_SneakAttackAlwaysBuff)>0 or GetUnitAbilityLevel(tu,SYD_SneakAttackFatalBuff)>0)then
return true
endif
return IsLocInDirection(GetUnitX(u),GetUnitY(u),GetUnitX(tu),GetUnitY(tu),GetUnitFacing(tu),120.0,240.0)
endfunction[/jass] |
|