|
发表于 2021-6-13 14:25:13
|
显示全部楼层
globals
constant hashtable hc=InitHashtable() //嘻哈表用于储存
endglobals
function GetRectQY takes real x, real y,real width,real height returns rect //以指定坐标返回矩形区域
return Rect( x - width*0.5, y - height*0.5, x + width*0.5, y + height*0.5 )
endfunction
//-------------------------两个坐标间的方向-----------------------------
function ZuoBiaoFangX takes real x1,real y1, real x,real y returns real
return Atan2(y1 - y, x1 - x)
endfunction
function IsChPd takes unit u returns boolean//用于判断单位是否存活
return(GetWidgetLife(u)>.405)
endfunction
function IsChKphPd takes destructable u returns boolean//用于判断可破坏物是否存活
return(GetWidgetLife(u)>.405)
endfunction
function BUFFbe takes unit u,integer bf returns boolean //用于判断单位是否拥有BFF
if GetUnitAbilityLevel(u,bf)>0 then
return true
endif
return false
endfunction
function IsChWd takes unit u returns boolean//用于判断单位是否无敌
if GetUnitAbilityLevel(u, 'A005') <= 0 and GetUnitAbilityLevel(u, 'A007') <= 0 and GetUnitAbilityLevel(u, 'Avul') <= 0 and GetUnitAbilityLevel(u, 'B010') <= 0 and GetUnitAbilityLevel(u, 'BHds') <= 0 then
return true
endif
return false
endfunction
function XsTianMaHuiXingQuanCs takes nothing returns boolean
return ((GetSpellAbilityId() == 'A05U'))
endfunction
function XsTianMaHuiXingQuanAsDYTimerJX takes nothing returns nothing //树木
if GetDestructableTypeId(GetEnumDestructable()) == 'ZTtc' then
call KillDestructable(GetEnumDestructable())
endif
endfunction
function XsTianMaHuiXingQuanAsDYTimer takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer id=GetHandleId(t)
local unit u0=LoadUnitHandle(hc,id,0)
local unit u1=LoadUnitHandle(hc,id,1)
local real ang=LoadReal(hc,id,2) //方向
local real Wam=LoadReal(hc,id,3) //速率
local real com=LoadReal(hc,id,4)-1 //终结点
local real SL=LoadReal(hc,id,5)
local real x=GetUnitX(u1)+Wam*Cos(ang)
local real y=GetUnitY(u1)+Wam*Sin(ang)
local rect ct
call SaveReal(hc,id,4,com)
//---击退距离--
if(IsTerrainPathable(x, y,PATHING_TYPE_WALKABILITY) != true)then
call SetUnitPosition(u1, x, y)
//----选取树木--
set ct=GetRectQY(x, y,150.00, 150.00)
call EnumDestructablesInRect(ct,null,function XsTianMaHuiXingQuanAsDYTimerJX)
call RemoveRect(ct)
set ct=null
endif
//----击飞高度--
if com >= 17 then
set SL=SL+25
call SaveReal(hc,id,5,SL)
else
set SL=SL-25
call SaveReal(hc,id,5,SL)
endif
call SetUnitFlyHeight(u1,SL, 0)
//----终结点---
if com<=0 then
call PauseTimer(t)
call DestroyTimer(t)
call UnitDamageTarget(u0, u1, (I2R(GetHeroAgi(u0, true)) * (10.00 * I2R(GetUnitAbilityLevel(u0, 'A05U')))), true, true, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffect("conflagrateblue.mdx",GetUnitX(u1),GetUnitY(u1)))
call SetUnitFlyHeight(u1,0,0)
call FlushChildHashtable(hc,id)
endif
//----清理残留--
set t=null
set u0=null
set u1=null
endfunction
function XsTianMaHuiXingQuanAsDY takes unit u0,unit u1 returns nothing
local timer t=CreateTimer()
local integer id=GetHandleId(t)
local real x=GetUnitX(u0)
local real y=GetUnitY(u0)
local real r1=GetUnitX(u1)
local real r2=GetUnitY(u1)
local real ang=Atan2(r2 - y, r1 - x) //方向
local real Wam=100 //速率/距离
local real com=33 //最终结束点
local real SL=0//上升降落实数
local unit u2=null
if (IsUnitType(u1, UNIT_TYPE_MAGIC_IMMUNE) == true) then
call UnitDamageTarget(u0, u1, (I2R(GetHeroAgi(u0, true)) * (5.00 * I2R(GetUnitAbilityLevel(u0, 'A05U')))), true, true, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl", u1, "chest"))
call DestroyTimer(t)
else
call UnitAddAbility(u1, 'A006')
call UnitRemoveAbility(u1, 'A006')
set u2=CreateUnit(GetOwningPlayer(u0), 'h003',GetUnitX(u1),GetUnitY(u1), GetUnitFacing(u0))
call ShowUnit(u2, false)
call UnitAddAbility(u2, 'A00T')
call SetUnitAbilityLevel(u2, 'A00T',3)
call IssueTargetOrderById(u2, 852095, u1)
call UnitApplyTimedLife(u2, 'BHwe', 1.20)
//----保存--
call SaveUnitHandle(hc,id,0,u0)
call SaveUnitHandle(hc,id,1,u1)
call SaveReal(hc,id,2,ang)
call SaveReal(hc,id,3,Wam*0.03)
call SaveReal(hc,id,4,com)
call SaveReal(hc,id,5,SL)
//-----开启计时器----
call TimerStart(t,0.03,true,function XsTianMaHuiXingQuanAsDYTimer)
endif
set t=null
set u0=null
set u1=null
set u2=null
endfunction
//-------上列调用击飞——击退
function XsTianMaHuiXingQuanAsTimer takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer id=GetHandleId(t)
local unit u=LoadUnitHandle(hc,id,0)
local unit u1=LoadUnitHandle(hc,id,1)
local real ang=LoadReal(hc,id,2) //方向
local real Wam=LoadReal(hc,id,3) //速率
local real com=LoadReal(hc,id,4)-1 //终结点
local real x=GetUnitX(u1)+Wam*Cos(ang)
local real y=GetUnitY(u1)+Wam*Sin(ang)
local unit u2=null
local group g=null
call SaveReal(hc,id,4,com)
call SetUnitPosition(u1, x, y)
//------------伤害-------------------
set g=CreateGroup()
call GroupEnumUnitsInRange(g,x,y,300.00,null)
call GroupRemoveUnit(g, u)
call GroupRemoveUnit(g, u1)
loop
set u2=FirstOfGroup(g)
exitwhen u2 == null
if IsChPd(u2) and IsChWd(u2) and IsUnitEnemy(u2, GetOwningPlayer(u)) == true then
if (IsUnitType(u2, UNIT_TYPE_MAGIC_IMMUNE) == false) then
call XsTianMaHuiXingQuanAsDY(u,u2)
set com=0
call SaveReal(hc,id,4,com)
else
call XsTianMaHuiXingQuanAsDY(u,u2)
endif
endif
call GroupRemoveUnit(g, u2)
endloop
call GroupClear(g)
call DestroyGroup(g)
if com<=0 then
call PauseTimer(t)
call DestroyTimer(t)
call KillUnit(u1)
call FlushChildHashtable(hc,id)
endif
set t=null
set g=null
set u=null
set u1=null
set u2=null
endfunction
function XsTianMaHuiXingQuanAs takes unit u returns nothing
local timer t=CreateTimer()
local integer id=GetHandleId(t)
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local real r1=GetSpellTargetX()
local real r2=GetSpellTargetY()
local real ang=Atan2(r2 - y, r1 - x) //方向
local real Wam=800 //速率/距离
local real com=33 //最终结束点
local unit u1=CreateUnit(GetOwningPlayer(u), 'h01U', x, y,GetUnitFacing(u))
//-----保存----
call SaveUnitHandle(hc,id,0,u)
call SaveUnitHandle(hc,id,1,u1)
call SaveReal(hc,id,2,ang)
call SaveReal(hc,id,3,Wam*0.03)
call SaveReal(hc,id,4,com)
//-----开启计时器----
call TimerStart(t,0.03,true,function XsTianMaHuiXingQuanAsTimer)
//-------清理残留----
set t=null
set u=null
set u1=null
endfunction |
|