//JASSHelper struct globals:
constant integer si__Around__Data=1
integer si__Around__Data_F=0
integer si__Around__Data_I=0
integer array si__Around__Data_V
integer array s__Around__Data_Structs
integer s__Around__Data_Total= 0
unit array s__Around__Data_caster
unit array s__Around__Data_obj
real array s__Around__Data_dur
real array s__Around__Data_inter
real array s__Around__Data_each
real array s__Around__Data_rate
real array s__Around__Data_dis
real array s__Around__Data_rise
real array s__Around__Data_angle
real array s__Around__Data_radius
real array s__Around__Data_height
constant integer si__YDVector3=2
integer si__YDVector3_F=0
integer si__YDVector3_I=0
integer array si__YDVector3_V
real array s__YDVector3_x
real array s__YDVector3_y
real array s__YDVector3_z
constant integer si__YDWETimerPattern__Thread=3
integer si__YDWETimerPattern__Thread_F=0
integer si__YDWETimerPattern__Thread_I=0
integer array si__YDWETimerPattern__Thread_V
integer array s__YDWETimerPattern__Thread_des
integer array s__YDWETimerPattern__Thread_pos
integer array s__YDWETimerPattern__Thread_vel
integer array s__YDWETimerPattern__Thread_dec
unit array s__YDWETimerPattern__Thread_caster
unit array s__YDWETimerPattern__Thread_target
unit array s__YDWETimerPattern__Thread_obj
real array s__YDWETimerPattern__Thread_ac
real array s__YDWETimerPattern__Thread_bc
real array s__YDWETimerPattern__Thread_dist
real array s__YDWETimerPattern__Thread_step
real array s__YDWETimerPattern__Thread_amount
integer array s__YDWETimerPattern__Thread_switch
integer array s__YDWETimerPattern__Thread_follow
integer array s__YDWETimerPattern__Thread_unitid
integer array s__YDWETimerPattern__Thread_skills
integer array s__YDWETimerPattern__Thread_order
integer array s__YDWETimerPattern__Thread_level
string array s__YDWETimerPattern__Thread_dsfx
string array s__YDWETimerPattern__Thread_gsfx
string array s__YDWETimerPattern__Thread_wsfx
string array s__YDWETimerPattern__Thread_part
boolean array s__YDWETimerPattern__Thread_recyclable
boolean array s__YDWETimerPattern__Thread_killdest
boolean array s__YDWETimerPattern__Thread_volume
group array s__YDWETimerPattern__Thread_except
timer array s__YDWETimerPattern__Thread_t
constant integer si__Parabola=4
constant integer si__Linear=5
constant integer si__Deceleration=6
integer array si__YDWETimerPattern__Thread_type
trigger array st__YDWETimerPattern__Thread_onDestroy
integer f__arg_this
endglobals
//Generated allocator of Around__Data
function s__Around__Data__allocate takes nothing returns integer
local integer this=si__Around__Data_F
if (this!=0) then
set si__Around__Data_F=si__Around__Data_V[this]
else
set si__Around__Data_I=si__Around__Data_I+1
set this=si__Around__Data_I
endif
if (this>8190) then
return 0
endif
set s__Around__Data_caster[this]= null
set s__Around__Data_obj[this]= null
set s__Around__Data_dur[this]= 0.
set s__Around__Data_inter[this]= 0.
set s__Around__Data_each[this]= 0.
set s__Around__Data_rate[this]= 0.
set s__Around__Data_dis[this]= 0.
set s__Around__Data_rise[this]= 0.
set s__Around__Data_angle[this]= 0.
set s__Around__Data_radius[this]= 0.
set s__Around__Data_height[this]= 0
set si__Around__Data_V[this]=-1
return this
endfunction
//Generated destructor of Around__Data
function s__Around__Data_deallocate takes integer this returns nothing
if this==null then
return
elseif (si__Around__Data_V[this]!=-1) then
return
endif
set si__Around__Data_V[this]=si__Around__Data_F
set si__Around__Data_F=this
endfunction
//Generated allocator of YDVector3
function s__YDVector3__allocate takes nothing returns integer
local integer this=si__YDVector3_F
if (this!=0) then
set si__YDVector3_F=si__YDVector3_V[this]
else
set si__YDVector3_I=si__YDVector3_I+1
set this=si__YDVector3_I
endif
if (this>8190) then
return 0
endif
set si__YDVector3_V[this]=-1
return this
endfunction
//Generated destructor of YDVector3
function s__YDVector3_deallocate takes integer this returns nothing
if this==null then
return
elseif (si__YDVector3_V[this]!=-1) then
return
endif
set si__YDVector3_V[this]=si__YDVector3_F
set si__YDVector3_F=this
endfunction
//Generated method caller for YDWETimerPattern__Thread.onDestroy
function sc__YDWETimerPattern__Thread_onDestroy takes integer this returns nothing
set f__arg_this=this
call TriggerEvaluate(st__YDWETimerPattern__Thread_onDestroy[3])
endfunction
//Generated allocator of YDWETimerPattern__Thread
function s__YDWETimerPattern__Thread__allocate takes nothing returns integer
local integer this=si__YDWETimerPattern__Thread_F
if (this!=0) then
set si__YDWETimerPattern__Thread_F=si__YDWETimerPattern__Thread_V[this]
else
set si__YDWETimerPattern__Thread_I=si__YDWETimerPattern__Thread_I+1
set this=si__YDWETimerPattern__Thread_I
endif
if (this>8190) then
return 0
endif
set si__YDWETimerPattern__Thread_type[this]=3
set si__YDWETimerPattern__Thread_V[this]=-1
return this
endfunction
//Generated destructor of YDWETimerPattern__Thread
function sc__YDWETimerPattern__Thread_deallocate takes integer this returns nothing
if this==null then
return
elseif (si__YDWETimerPattern__Thread_V[this]!=-1) then
return
endif
set f__arg_this=this
call TriggerEvaluate(st__YDWETimerPattern__Thread_onDestroy[si__YDWETimerPattern__Thread_type[this]])
set si__YDWETimerPattern__Thread_V[this]=si__YDWETimerPattern__Thread_F
set si__YDWETimerPattern__Thread_F=this
endfunction
//Generated allocator of Parabola
function s__Parabola__allocate takes nothing returns integer
local integer this=s__YDWETimerPattern__Thread__allocate()
local integer kthis
if(this==0) then
return 0
endif
set si__YDWETimerPattern__Thread_type[this]=4
set kthis=this
return this
endfunction
//Generated allocator of Deceleration
function s__Deceleration__allocate takes nothing returns integer
local integer this=s__YDWETimerPattern__Thread__allocate()
local integer kthis
if(this==0) then
return 0
endif
set si__YDWETimerPattern__Thread_type[this]=6
set kthis=this
return this
endfunction
//Generated allocator of Linear
function s__Linear__allocate takes nothing returns integer
local integer this=s__YDWETimerPattern__Thread__allocate()
local integer kthis
if(this==0) then
return 0
endif
set si__YDWETimerPattern__Thread_type[this]=5
set kthis=this
//store and get integer
function YDWESaveIntegerByInteger takes integer pTable,integer pKey,integer i returns nothing
call StoreInteger(YDGC, I2S(pTable), I2S(pKey), i)
endfunction
function YDWESaveIntegerByString takes string pTable,string pKey,integer i returns nothing
call StoreInteger(YDGC, pTable, pKey, i)
endfunction
//store and get real
function YDWESaveRealByInteger takes integer pTable,integer pKey,real r returns nothing
call StoreReal(YDGC, I2S(pTable), I2S(pKey), r)
endfunction
function YDWESaveRealByString takes string pTable,string pKey,real r returns nothing
call StoreReal(YDGC, pTable, pKey, r)
endfunction
function YDWEGetRealByInteger takes integer pTable,integer pKey returns real
return GetStoredReal(YDGC, I2S(pTable), I2S(pKey))
endfunction
function YDWEGetRealByString takes string pTable,string pKey returns real
return GetStoredReal(YDGC, pTable, pKey)
endfunction
//store and get string
function YDWESaveStringByInteger takes integer pTable,integer pKey,string s returns nothing
call StoreString(YDGC, I2S(pTable), I2S(pKey), s)
endfunction
function YDWESaveStringByString takes string pTable,string pKey,string s returns nothing
call StoreString(YDGC, pTable, pKey, s)
endfunction
//store and get boolean
function YDWESaveBooleanByInteger takes integer pTable,integer pKey,boolean b returns nothing
call StoreBoolean(YDGC, I2S(pTable), I2S(pKey), b)
endfunction
function YDWESaveBooleanByString takes string pTable,string pKey,boolean b returns nothing
call StoreBoolean(YDGC, pTable, pKey, b)
endfunction
function YDWES2I takes string s returns integer
return s
return 0
endfunction
function GetSpellTargetX takes nothing returns real
local location point=GetSpellTargetLoc()
local real x=GetLocationX(point)
call RemoveLocation(point)
set point=null
return x
endfunction
function GetSpellTargetY takes nothing returns real
local location point=GetSpellTargetLoc()
local real y=GetLocationY(point)
call RemoveLocation(point)
set point=null
return y
endfunction
//============================
//杞?崲handle涓篿nteger
//===========================================================================
function YDWEGetUnitID takes unit u returns integer
return YDWEH2I(u)
endfunction
function YDWEGetItemID takes item it returns integer
return YDWEH2I(it)
endfunction
function YDWEGetPlayerID takes player p returns integer
return YDWEH2I(p)
endfunction
function YDWEGetTimerID takes timer t returns integer
return YDWEH2I(t)
endfunction
function YDWEGetTriggerID takes trigger trg returns integer
return YDWEH2I(trg)
endfunction
function YDWEGetGroupID takes group g returns integer
return YDWEH2I(g)
endfunction
function YDWEGetLocationID takes location point returns integer
return YDWEH2I(point)
endfunction
function YDWEGetUnitTypeID takes integer uid returns integer
return uid
endfunction
function YDWEGetAbilityTypeID takes integer ab returns integer
return ab
endfunction
function YDWEGetItemTypeID takes integer itid returns integer
return itid
endfunction
function YDWEGetMultiboardID takes multiboard m returns integer
return YDWEH2I(m)
endfunction
function YDWEGetMultiboardItemID takes multiboarditem mt returns integer
return YDWEH2I(mt)
endfunction
function YDWEGetTextTagID takes texttag tt returns integer
return YDWEH2I(tt)
endfunction
function YDWEGetLightningID takes lightning ln returns integer
return YDWEH2I(ln)
endfunction
function YDWEGetRegionID takes region rn returns integer
return YDWEH2I(rn)
endfunction
function YDWEGetRectID takes rect rt returns integer
return YDWEH2I(rt)
endfunction
function YDWEGetLeaderboardID takes leaderboard lb returns integer
return YDWEH2I(lb)
endfunction
function YDWEGetEffectID takes effect e returns integer
return YDWEH2I(e)
endfunction
function YDWEGetDestructableID takes destructable da returns integer
return YDWEH2I(da)
endfunction
function YDWEGetTriggerConditionID takes triggercondition tc returns integer
return YDWEH2I(tc)
endfunction
function YDWEGetTriggerActionID takes triggeraction ta returns integer
return YDWEH2I(ta)
endfunction
function YDWEGetTriggerEventID takes event et returns integer
return YDWEH2I(et)
endfunction
function YDWEGetForceID takes force fc returns integer
return YDWEH2I(fc)
endfunction
function YDWEGetBoolexprID takes boolexpr be returns integer
return YDWEH2I(be)
endfunction
function YDWEGetSoundID takes sound sd returns integer
return YDWEH2I(sd)
endfunction
function YDWEGetTimerDialogID takes timerdialog td returns integer
return YDWEH2I(td)
endfunction
function YDWEGetTrackableID takes trackable ta returns integer
return YDWEH2I(ta)
endfunction
function YDWEGetDialogID takes dialog d returns integer
return YDWEH2I(d)
endfunction
function YDWEGetButtonID takes button bt returns integer
return YDWEH2I(bt)
endfunction
function YDWEConverItemcodeToInt takes integer itid returns integer
return itid
endfunction
function YDWEConverAbilcodeToInt takes integer abid returns integer
return abid
endfunction
function YDWEConverOrdercodeToInt takes integer orderid returns integer
return orderid
endfunction
//===========================================================================
//===========================================================================
//Custom functions added by wataloo&Everguo
//===========================================================================
//===========================================================================
//===========================================================================
//返回参数
//===========================================================================
//地图边界判断
function YDWECoordinateX takes real x returns real
set x=RMaxBJ(x, yd_MapMinX)
set x=RMinBJ(x, yd_MapMaxX)
return x
endfunction
function YDWECoordinateY takes real y returns real
set y=RMaxBJ(y, yd_MapMinY)
set y=RMinBJ(y, yd_MapMaxY)
return y
endfunction
//两个单位之间的距离
function YDWEDistanceBetweenUnits takes unit a,unit b returns real
return SquareRoot(( GetUnitX(a) - GetUnitX(b) ) * ( GetUnitX(a) - GetUnitX(b) ) + ( GetUnitY(a) - GetUnitY(b) ) * ( GetUnitY(a) - GetUnitY(b) ))
endfunction
//两个单位之间的角度
function YDWEAngleBetweenUnits takes unit from,unit to returns real
return bj_RADTODEG * Atan2(GetUnitY(to) - GetUnitY(from), GetUnitX(to) - GetUnitX(from))
endfunction
//生成区域
function YDWEGetRect 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 YDWEFlyEnable takes unit u returns nothing
call UnitAddAbility(u, 'Amrf')
call UnitRemoveAbility(u, 'Amrf')
endfunction
//===========================================================================
//字符窜与ID转换
//===========================================================================
function YDWEId2S takes integer value returns string
local string charMap=bj_AllString
local string result= ""
local integer remainingValue= value
local integer charValue
local integer byteno
set byteno=0
loop
set charValue=ModuloInteger(remainingValue, 256)
set remainingValue=remainingValue / 256
set result=SubString(charMap, charValue, charValue + 1) + result
set byteno=byteno + 1
exitwhen byteno == 4
endloop
return result
endfunction
function YDWES2Id takes string targetstr returns integer
local string originstr=bj_AllString
local integer strlength=StringLength(targetstr)
local integer a=0
local integer b=0
local integer numx=1
local integer result=0
loop
exitwhen b > strlength - 1
set numx=R2I(Pow(256, strlength - 1 - b))
set a=1
loop
exitwhen a > 255
if SubString(targetstr, b, b + 1) == SubString(originstr, a, a + 1) then
set result=result + a * numx
set a=256
endif
set a=a + 1
endloop
set b=b + 1
endloop
return result
endfunction
function YDWES2UnitId takes string targetstr returns integer
return YDWES2Id(targetstr)
endfunction
function YDWES2ItemId takes string targetstr returns integer
return YDWES2Id(targetstr)
endfunction
function YDWEI2UnitId takes integer targetint returns integer
return targetint
endfunction
function YDWEI2ItemId takes integer targetint returns integer
return targetint
endfunction
function GetLastMovedItemInItemSlot takes nothing returns item
return bj_lastMovedItemInItemSlot
endfunction
function GetLastCombinedItem takes nothing returns item
return bj_lastCombinedItem
endfunction
function GetLastAbilityCastingUnit takes nothing returns unit
return bj_lastAbilityCastingUnit
endfunction
function GetLastAbilityTargetUnit takes nothing returns unit
return bj_lastAbilityTargetUnit
endfunction
function YDWESetMapLimitCoordinate takes real MinX,real MaxX,real MinY,real MaxY returns nothing
set yd_MapMaxX=MaxX
set yd_MapMinX=MinX
set yd_MapMaxY=MaxY
set yd_MapMinY=MinY
endfunction
//===========================================================================
//===========================================================================
//地图初始化
//===========================================================================
//===========================================================================
//物品合成
function YDWESyStemItemCombineTriggerAction takes nothing returns nothing
local integer i=(GetStoredInteger(YDGC, ("YDWESyStemItemCombineRegistTrigger" ), ( "TriggerNumber"))) // INLINED!!
local trigger array trg
loop
set trg[i]=(YDWEI2T(GetStoredInteger(YDGC, ("YDWESyStemItemCombineRegistTrigger" ), ( I2S(i))))) // INLINED!!
if trg[i] != null and TriggerEvaluate(trg[i]) == true and IsTriggerEnabled(trg[i]) == true then
call TriggerExecute(trg[i])
endif
set trg[i]=null
set i=i - 1
exitwhen i <= 0
endloop
endfunction
//YDWE特殊技能结束事件
function YDWESyStemAbilityCastingOverTriggerAction takes unit hero,integer index returns nothing
local integer i= (GetStoredInteger(YDGC, ("YDWESyStemAbilityCastingOverRegistTrigger" ), ( "TriggerNumber"))) // INLINED!!
local integer abiltype= 0
local trigger array trg
loop
set trg[i]=(YDWEI2T(GetStoredInteger(YDGC, ("YDWESyStemAbilityCastingOverRegistTrigger" ), ( I2S(i))))) // INLINED!!
set abiltype=(GetStoredInteger(YDGC, ("YDWESyStemAbilityCastingOverRegistTrigger" ), ( I2S(YDWEH2I(trg[i])) + "AbilityType"))) // INLINED!!
if trg[i] != null and IsTriggerEnabled(trg[i]) == true and index == abiltype then
set bj_lastAbilityCastingUnit=hero
call ConditionalTriggerExecute(trg[i])
endif
set trg[i]=null
set i=i - 1
exitwhen i <= 0
endloop
endfunction
//===========================================================================
//系统函数完善
//===========================================================================
function YDWEIfThenElse takes boolexpr b,code c1,code c2 returns nothing
local trigger trg=CreateTrigger()
local triggercondition tc=TriggerAddCondition(trg, b)
local boolean b1=TriggerEvaluate(trg)
if b1 == true then
call TimerStart(CreateTimer(), 0, false, c1)
else
call TimerStart(CreateTimer(), 0, false, c2)
endif
call TriggerRemoveCondition(trg, tc)
//call DestroyCondition(tc)
call DestroyTrigger(trg)
set trg=null
set tc=null
endfunction
function YDWEIfThenElseMultiple takes nothing returns nothing
endfunction
function YDWEForLoopAMultiple takes nothing returns nothing
endfunction
function YDWECreateUnitPool takes nothing returns nothing
set bj_lastCreatedUnitPool=CreateUnitPool()
endfunction
function YDWEPlaceRandomUnit takes unitpool up,player p,real x,real y,real face returns nothing
set bj_lastPoolAbstractedUnit=PlaceRandomUnit(up, p, x, y, face)
endfunction
function YDWEGetLastUnitPool takes nothing returns unitpool
return bj_lastCreatedUnitPool
endfunction
function YDWEGetLastPoolAbstractedUnit takes nothing returns unit
return bj_lastPoolAbstractedUnit
endfunction
function YDWECreateItemPool takes nothing returns nothing
set bj_lastCreatedItemPool=CreateItemPool()
endfunction
function YDWEPlaceRandomItem takes itempool ip,real x,real y returns nothing
set bj_lastPoolAbstractedItem=PlaceRandomItem(ip, x, y)
endfunction
function YDWEGetLastItemPool takes nothing returns itempool
return bj_lastCreatedItemPool
endfunction
function YDWEGetLastPoolAbstractedItem takes nothing returns item
return bj_lastPoolAbstractedItem
endfunction
function YDWESetAttackDamageWeaponType takes attacktype at,damagetype dt,weapontype wt returns nothing
set bj_lastSetAttackType=at
set bj_lastSetDamageType=dt
set bj_lastSetWeaponType=wt
endfunction
//unitpool bj_lastCreatedPool=null
//unit bj_lastPoolAbstractedUnit=null
//===========================================================================
//拾取物品触发
//===========================================================================
function YDWEItemAbilitySystemByAbility_CON takes nothing returns boolean
local unit hero= GetTriggerUnit()
local item it=GetManipulatedItem()
local trigger trg=(YDWEI2T(GetStoredInteger(YDGC, (I2S(YDWEH2I(hero)) ), ( "MulItemSlotByAbility")))) // INLINED!!
local integer itid=GetItemTypeId(it)
local integer index= (GetStoredInteger(YDGC, (I2S(itid) ), ( "AbilityStorageIndex"))) // INLINED!!
local integer array skills
local integer i=0
local integer N=(GetStoredInteger(YDGC, (I2S(YDWEH2I(trg)) ), ( "ItemSlotNum"))) // INLINED!!
local boolean OnOff=(GetStoredBoolean(YDGC, (I2S(YDWEH2I(hero)) ), ( "YDWEItemAbilitySystemTriggerClose"))) // INLINED!!
if index == 0 or OnOff == true then
set it=null
set hero=null
set trg=null
return false
endif
loop
set i=i + 1
exitwhen i > index
set skills[i]=(GetStoredInteger(YDGC, (I2S(itid) ), ( "AbilityStorage" + I2S(i)))) // INLINED!!
if GetTriggerEventId() == ConvertUnitEvent(48) then
call UnitRemoveAbility(hero, skills[i])
elseif GetTriggerEventId() == ConvertUnitEvent(49) then
call UnitAddAbility(hero, skills[i])
call UnitMakeAbilityPermanent(hero, true, skills[i])
endif
endloop
set it=null
set hero=null
set trg=null
return false
endfunction
function YDWEItemAbilitySystem takes nothing returns nothing
local trigger trg=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trg, EVENT_PLAYER_UNIT_PICKUP_ITEM)
call TriggerRegisterAnyUnitEventBJ(trg, EVENT_PLAYER_UNIT_DROP_ITEM)
call TriggerAddCondition(trg, Condition(function YDWEItemAbilitySystemByAbility_CON))
set trg=null
endfunction
//===========================================================================
//===========================================================================
//系统函数补充
//===========================================================================
//===========================================================================
function YDWEGetUnitItemSoftId takes unit hero,item it returns integer
local integer i= 0
loop
exitwhen i > 5
if UnitItemInSlot(hero, i) == it then
exitwhen true
endif
set i=i + 1
endloop
if i > 5 then
set i=0
else
set i=i + 1
endif
return i
endfunction
//===========================================================================
//===========================================================================
//地图初始化
//===========================================================================
//===========================================================================
//游戏时间
function YDWEGetGameCurrentTime takes nothing returns integer
return TimerSystem_BigSteps
endfunction
function YDWEGameTimeElapse takes nothing returns nothing
set TimerSystem_BigSteps=TimerSystem_BigSteps + 1
endfunction
function YDWEVersion_Init takes nothing returns nothing
local trigger t= CreateTrigger()
local integer i= 0
loop
exitwhen i == 12
call TriggerRegisterPlayerChatEvent(t, Player(i), "YDWE Version", true)
set i=i + 1
endloop
call TriggerAddCondition(t, Condition(function YDWEVersion_Display))
set t=null
endfunction
function InitializeYD takes nothing returns nothing
local trigger trg=CreateTrigger()
call TriggerRegisterTimerEventSingle(trg, 0.00)
call TriggerAddAction(trg, function YDWEGameStartActions)
set TimerSystem_TimerZero=CreateTimer()
set trg=null
//call BJDebugMsg("The result is " + I2S(abcdefghij))
//=================设置变量=====================
set yd_MapMaxX=GetRectMaxX(bj_mapInitialPlayableArea)
set yd_MapMinX=GetRectMinX(bj_mapInitialPlayableArea)
set yd_MapMaxY=GetRectMaxY(bj_mapInitialPlayableArea)
set yd_MapMinY=GetRectMinY(bj_mapInitialPlayableArea)
//=================显示版本=====================
call YDWEVersion_Init()
endfunction
function Around__spin takes nothing returns nothing
local integer d= 0
local real x= 0.
local real y= 0.
local integer inst= 0
loop
exitwhen ( inst == s__Around__Data_Total )
set d=s__Around__Data_Structs[inst]
if ( s__Around__Data_dur[d] > 0 ) and ( GetUnitState(s__Around__Data_caster[d], UNIT_STATE_LIFE) > 0 ) and ( GetUnitState(s__Around__Data_obj[d], UNIT_STATE_LIFE) > 0 ) then
set s__Around__Data_each[d]=s__Around__Data_each[d] + Around__AROUND_INTER
if ( s__Around__Data_each[d] >= s__Around__Data_inter[d] ) then
set s__Around__Data_angle[d]=s__Around__Data_angle[d] + s__Around__Data_rate[d]
set s__Around__Data_radius[d]=s__Around__Data_radius[d] + s__Around__Data_dis[d]
set s__Around__Data_height[d]=s__Around__Data_height[d] + s__Around__Data_rise[d]
set x=GetUnitX(s__Around__Data_caster[d]) + s__Around__Data_radius[d] * Cos(s__Around__Data_angle[d])
set y=GetUnitY(s__Around__Data_caster[d]) + s__Around__Data_radius[d] * Sin(s__Around__Data_angle[d])
set x=YDWECoordinateX(x)
set y=YDWECoordinateY(y)
call SetUnitX(s__Around__Data_obj[d], x)
call SetUnitY(s__Around__Data_obj[d], y)
call SetUnitFlyHeight(s__Around__Data_obj[d], s__Around__Data_height[d], 0.)
set s__Around__Data_each[d]=0.
endif
set s__Around__Data_dur[d]=s__Around__Data_dur[d] - Around__AROUND_INTER
else
set bj_lastAbilityTargetUnit=s__Around__Data_caster[d]
call YDWESyStemAbilityCastingOverTriggerAction(s__Around__Data_obj[d] , 10)
set s__Around__Data_caster[d]=null
set s__Around__Data_obj[d]=null
call s__Around__Data_deallocate(d)
set s__Around__Data_Total=s__Around__Data_Total - 1
set s__Around__Data_Structs[inst]=s__Around__Data_Structs[s__Around__Data_Total]
set inst=inst - 1
endif
set inst=inst + 1
endloop
if ( s__Around__Data_Total == 0 ) then
call PauseTimer(Around__AROUND_TIM)
endif
endfunction
function YDWEAroundSystem takes unit satellite,unit star,real angleRate,real displacement,real riseRate,real timeout,real interval returns nothing
local integer d= s__Around__Data__allocate()
local real x1= GetUnitX(star)
local real y1= GetUnitY(star)
local real x2= GetUnitX(satellite)
local real y2= GetUnitY(satellite)
set s__Around__Data_caster[d]=star
set s__Around__Data_obj[d]=satellite
set s__Around__Data_dur[d]=timeout
set s__Around__Data_inter[d]=interval
set s__Around__Data_rate[d]=angleRate * ( 3.14159 / 180. )
set s__Around__Data_dis[d]=displacement
set s__Around__Data_rise[d]=riseRate
set s__Around__Data_angle[d]=Atan2(y2 - y1, x2 - x1)
set s__Around__Data_radius[d]=SquareRoot(( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ))
set s__Around__Data_height[d]=GetUnitFlyHeight(s__Around__Data_obj[d])
set s__Around__Data_Structs[s__Around__Data_Total]=(d)
set s__Around__Data_Total=s__Around__Data_Total + 1
call StoreInteger(YDGC, (I2S(YDWEH2I(satellite)) ), ( "abilevent" ), ( 10)) // INLINED!!
if ( s__Around__Data_Total - 1 == 0 ) then
call TimerStart(Around__AROUND_TIM, Around__AROUND_INTER, true, function Around__spin)
endif
endfunction
//library Around ends
//library YDWEJumpTimer:
function YDWEJumpTimerLoop takes nothing returns nothing
local timer t=GetExpiredTimer()
local unit hero=( (YDWEI2U(GetStoredInteger(YDGC, (I2S(YDWEH2I(t)) ), ( "Hero")))) ) // INLINED!!
local real angle=(GetStoredReal(YDGC, (I2S(YDWEH2I(t)) ), ( "Angle"))) // INLINED!!
local integer steeps=(GetStoredInteger(YDGC, (I2S(YDWEH2I(t)) ), ( "steeps"))) // INLINED!!
local integer steepsMax=(GetStoredInteger(YDGC, (I2S(YDWEH2I(t)) ), ( "steepsMax"))) // INLINED!!
local real heightMax=(GetStoredReal(YDGC, (I2S(YDWEH2I(t)) ), ( "heightMax"))) // INLINED!!
local real dist=(GetStoredReal(YDGC, (I2S(YDWEH2I(t)) ), ( "dist"))) // INLINED!!
local real dheig=(GetStoredReal(YDGC, (I2S(YDWEH2I(t)) ), ( "dheig"))) // INLINED!!
local real OriginHeight=(GetStoredReal(YDGC, (I2S(YDWEH2I(t)) ), ( "OriginHeight"))) // INLINED!!
local real x=(GetStoredReal(YDGC, (I2S(YDWEH2I(t)) ), ( "X"))) // INLINED!!
local real y=(GetStoredReal(YDGC, (I2S(YDWEH2I(t)) ), ( "Y"))) // INLINED!!
local real x1=0
local real y1=0
local real height=0
local integer lvJumpTimer=MoveMoreLevel_JumpTimer
local integer lvUnitMove=(GetStoredInteger(YDGC, (I2S(YDWEH2I(hero)) ), ( "lvUnitMove"))) // INLINED!!
if steeps < steepsMax and lvJumpTimer >= lvUnitMove then
set x1=x + steeps * dist * Cos(angle * 3.14159 / 180.0)
set y1=y + steeps * dist * Sin(angle * 3.14159 / 180.0)
set x1=YDWECoordinateX(x1)
set y1=YDWECoordinateY(y1)
call SetUnitX(hero, x1)
call SetUnitY(hero, y1)
set steeps=steeps + 1
call StoreInteger(YDGC, (I2S(YDWEH2I(t)) ), ( "steeps" ), ( steeps)) // INLINED!!
set height=( - ( 2 * I2R(steeps) * dheig - 1 ) * ( 2 * I2R(steeps) * dheig - 1 ) + 1 ) * heightMax + OriginHeight
call SetUnitFlyHeight(hero, height, 99999)
call SetUnitFacing(hero, angle)
else
call SetUnitFlyHeight(hero, OriginHeight, 99999)
call SetUnitPathing(hero, true)
call DestroyTimer(t)
call FlushStoredMission(YDGC, (I2S(YDWEH2I(t)))) // INLINED!!
call StoreInteger(YDGC, (I2S(YDWEH2I(hero)) ), ( "lvUnitMove" ), ( 0)) // INLINED!!
call YDWESyStemAbilityCastingOverTriggerAction(hero , 2)
endif
set t=null
set hero=null
endfunction
function YDWEJumpTimer takes unit hero,real angle,real distance,real lasttime,real timeout,real heightMax returns nothing
local timer t=null
local real x=GetUnitX(hero)
local real y=GetUnitY(hero)
local integer steepsMax=R2I(lasttime / timeout)
local integer steeps=0
local real dist=distance / steepsMax
local real dheig=1.0 / steepsMax
local real OriginHeight=GetUnitFlyHeight(hero)
local integer lvJumpTimer=MoveMoreLevel_JumpTimer
local integer lvUnitMove=(GetStoredInteger(YDGC, (I2S(YDWEH2I(hero)) ), ( "lvUnitMove"))) // INLINED!!
if lvJumpTimer > lvUnitMove then
set t=CreateTimer()
set lvUnitMove=lvJumpTimer
call StoreInteger(YDGC, (I2S(YDWEH2I(hero)) ), ( "lvUnitMove" ), ( lvUnitMove)) // INLINED!!
else
return
endif
call UnitAddAbility(hero, 'Amrf')
call UnitRemoveAbility(hero, 'Amrf')
call SetUnitPathing(hero, false)
call StoreInteger(YDGC, (I2S(YDWEH2I(t)) ), ( "Hero" ), YDWEH2I(( hero))) // INLINED!!
call StoreReal(YDGC, (I2S(YDWEH2I(t)) ), ( "OriginHeight" ), (( OriginHeight)*1.0)) // INLINED!!
call StoreReal(YDGC, (I2S(YDWEH2I(t)) ), ( "Angle" ), (( angle)*1.0)) // INLINED!!
call StoreReal(YDGC, (I2S(YDWEH2I(t)) ), ( "dist" ), (( dist)*1.0)) // INLINED!!
call StoreReal(YDGC, (I2S(YDWEH2I(t)) ), ( "heightMax" ), (( heightMax)*1.0)) // INLINED!!
call StoreReal(YDGC, (I2S(YDWEH2I(t)) ), ( "dheig" ), (( dheig)*1.0)) // INLINED!!
call StoreReal(YDGC, (I2S(YDWEH2I(t)) ), ( "X" ), (( x)*1.0)) // INLINED!!
call StoreReal(YDGC, (I2S(YDWEH2I(t)) ), ( "Y" ), (( y)*1.0)) // INLINED!!
call StoreInteger(YDGC, (I2S(YDWEH2I(t)) ), ( "steeps" ), ( steeps)) // INLINED!!
call StoreInteger(YDGC, (I2S(YDWEH2I(t)) ), ( "steepsMax" ), ( steepsMax)) // INLINED!!
call TimerStart(t, timeout, true, function YDWEJumpTimerLoop)
set t=null
endfunction
//library YDWEJumpTimer ends
//library YDWEMath:
//library YDWEMath ends
//library YDWESetGuard:
function YDWEGetUnitCurrentFree_Func takes unit u returns boolean
local string s= OrderId2String(GetUnitCurrentOrder(u))
if s == null then
return true
endif
return false
endfunction
function YDWERemoveGuard takes unit pet returns nothing
local integer tm= (GetStoredInteger(YDGC, (I2S(YDWEH2I(pet)) ), ( "Timer"))) // INLINED!!
call FlushStoredMission(YDGC, (I2S(YDWEH2I(pet)))) // INLINED!!
call FlushStoredMission(YDGC, (I2S(tm))) // INLINED!!
call DestroyTimer((YDWEI2Tm(GetStoredInteger(YDGC, (I2S(YDWEH2I(pet)) ), ( "Timer"))))) // INLINED!!
endfunction
function YDWESetGuard_Func takes nothing returns nothing
local timer tm= GetExpiredTimer()
local unit pet= ( (YDWEI2U(GetStoredInteger(YDGC, (I2S(YDWEH2I(tm)) ), ( "Pet")))) ) // INLINED!!
local unit captain= ( (YDWEI2U(GetStoredInteger(YDGC, (I2S(YDWEH2I(tm)) ), ( "Captain")))) ) // INLINED!!
local real x= GetUnitX(captain) - GetUnitX(pet)
local real y= GetUnitY(captain) - GetUnitY(pet)
local real d= x * x + y * y
local real v
local real a
local effect e=null
local real life= (GetStoredReal(YDGC, (I2S(YDWEH2I(tm)) ), ( "Life"))) // INLINED!!
local integer p= (GetStoredInteger(YDGC, (I2S(YDWEH2I(tm)) ), ( "Percent"))) // INLINED!!
set v=(GetStoredReal(YDGC, (I2S(YDWEH2I(tm)) ), ( "GuardRanger"))) // INLINED!!
if GetUnitState(pet, UNIT_STATE_LIFE) > 0 and GetUnitState(captain, UNIT_STATE_LIFE) > 0 then
if d < v * v then
if YDWEGetUnitCurrentFree_Func(pet) == true and GetRandomInt(0, 100) < p then
set x=GetUnitX(captain)
set y=GetUnitY(captain)
set d=GetRandomReal(0, v)
set a=GetRandomReal(0, 360)
call IssuePointOrder(pet, "patrol", x + d * CosBJ(a), y + d * SinBJ(a))
endif
else
set v=(GetStoredReal(YDGC, (I2S(YDWEH2I(tm)) ), ( "ReturnRanger"))) // INLINED!!
if d < v * v then
if YDWEGetUnitCurrentFree_Func(pet) == true then
call IssuePointOrder(pet, "patrol", GetUnitX(captain), GetUnitY(captain))
endif
else
set v=(GetStoredReal(YDGC, (I2S(YDWEH2I(tm)) ), ( "OutRanger"))) // INLINED!!
if d != 0 and d > v * v then
call SetUnitPosition(pet, GetUnitX(captain), GetUnitY(captain))
set e=AddSpecialEffectTarget("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl", captain, "chest")
call DestroyEffect(e)
else
call IssuePointOrder(pet, "move", GetUnitX(captain), GetUnitY(captain))
endif
endif
endif
else
call IssuePointOrder(pet, "attack", GetUnitX(captain), GetUnitY(captain))
call YDWERemoveGuard(pet)
endif
set tm=null
set pet=null
set captain=null
set e=null
endfunction
function YDWETimerRunTrigger takes real time,trigger trg returns nothing
local integer index=R2I(100 * time) + yd_ctimer_current_index
local integer i=YDWETimerSystem_list_index_limit(index , yd_ctimer_RunTrigger_proc)
call StoreInteger(YDGC, (I2S(YDWEH2I(TimerSystem_Timer)) ), ( I2S(index) + "data" + I2S(i) ), YDWEH2I(( trg))) // INLINED!!
endfunction
//删除漂浮文字
function YDWETimerDestroyTextTag takes real time,texttag tt returns nothing
local integer N=0
local integer i=0
if time <= 0 then
set time=0.01
endif
call SetTextTagPermanent(tt, false)
call SetTextTagLifespan(tt, time)
call SetTextTagFadepoint(tt, time)
endfunction
//中心计时器主函数
function YDWETimerSystem_Main takes nothing returns nothing
local integer i=0
local integer index=0
set yd_ctimer_current_index=yd_ctimer_current_index + 1 //执行步数累加
set i=(GetStoredInteger(YDGC, (I2S(YDWEH2I(TimerSystem_Timer)) ), ( "MaxIndex" + I2S(yd_ctimer_current_index)))) // INLINED!!
if i > 0 then
loop
set index=(GetStoredInteger(YDGC, (I2S(YDWEH2I(TimerSystem_Timer)) ), ( I2S(yd_ctimer_current_index) + "Index" + I2S(i)))) // INLINED!!
set yd_ctimer_list_proc_index=i
call ForceEnumPlayers(yd_RunBoolexpr, yd_ctimer_list_proc[index])
set yd_ctimer_list_index_boolean[index]=false
// call DestroyLightning(YDWEGetLightningByString(I2S(YDWEH2I(TimerSystem_Timer)),I2S(yd_ctimer_current_index)+"data"+I2S(yd_ctimer_list_proc_index)))
call FlushStoredInteger(YDGC, (I2S(YDWEH2I(TimerSystem_Timer)) ), ( I2S(yd_ctimer_current_index) + "Index" + I2S(i))) // INLINED!!
//初始化函数
function YDWETimerSystem_Init takes nothing returns nothing
set yd_RunBoolexpr=CreateForce()
call ForceAddPlayer(yd_RunBoolexpr, Player(0))
set TimerSystem_Timer=CreateTimer()
set yd_ctimer_list_index=0
set yd_ctimer_current_index=0
set yd_ctimer_list_proc_index=0
set yd_ctimer_RemoveUnit_proc=Filter(function YDWETimerSystem_RemoveUnit_CallBack)
set yd_ctimer_DestroyTimer_proc=Filter(function YDWETimerSystem_DestroyTimer_CallBack)
set yd_ctimer_RemoveItem_proc=Filter(function YDWETimerSystem_RemoveItem_CallBack)
set yd_ctimer_DestroyEffect_proc=Filter(function YDWETimerSystem_DestroyEffect_CallBack)
set yd_ctimer_DestroyLightning_proc=Filter(function YDWETimerSystem_DestroyLightning_CallBack)
set yd_ctimer_RunTrigger_proc=Filter(function YDWETimerSystem_RunTrigger_CallBack)
call TimerStart(TimerSystem_Timer, 0.01, true, function YDWETimerSystem_Main)
endfunction
//暂时先改下原来中心计时器的流程,这里暂时用普通计时器代替
function YDWETimerSystemGetRunIndex takes nothing returns integer
return TimerSystem_RunIndex
endfunction
//循环类仍用独立计时器
function YDWETimerRunPeriodicTriggerFunction takes nothing returns nothing
local timer t=GetExpiredTimer()
local trigger trg=(YDWEI2T(GetStoredInteger(YDGC, (I2S(YDWEH2I(t)) ), ( "Trigger")))) // INLINED!!
local integer RunIndex=(GetStoredInteger(YDGC, (I2S(YDWEH2I(t)) ), ( "RunIndex"))) // INLINED!!
call StoreInteger(YDGC, (I2S(YDWEH2I(trg)) ), ( "RunIndex" ), ( RunIndex)) // INLINED!!
call ConditionalTriggerExecute(trg)
set t=null
set trg=null
endfunction
function YDWETimerRunPeriodicTriggerFunctionByTimes takes nothing returns nothing
local timer t=GetExpiredTimer()
local trigger trg=(YDWEI2T(GetStoredInteger(YDGC, (I2S(YDWEH2I(t)) ), ( "Trigger")))) // INLINED!!
local integer RunIndex=(GetStoredInteger(YDGC, (I2S(YDWEH2I(t)) ), ( "RunIndex"))) // INLINED!!
local integer times=(GetStoredInteger(YDGC, (I2S(YDWEH2I(t)) ), ( "Times"))) // INLINED!!
call StoreInteger(YDGC, (I2S(YDWEH2I(trg)) ), ( "RunIndex" ), ( RunIndex)) // INLINED!!
call ConditionalTriggerExecute(trg)
set times=times - 1
if times > 0 then
call StoreInteger(YDGC, (I2S(YDWEH2I(t)) ), ( "Times" ), ( times)) // INLINED!!
else
call DestroyTimer(t)
call FlushStoredMission(YDGC, (I2S(YDWEH2I(t)))) // INLINED!!
endif
set t=null
set trg=null
endfunction
function YDWETimerRunPeriodicTrigger takes real timeout,trigger trg,boolean b,integer times,integer data returns nothing
local timer t=null
local integer i=0
local integer index=0
if timeout < 0 then
return
else
set t=CreateTimer()
endif
set TimerSystem_RunIndex=TimerSystem_RunIndex + 1
call StoreInteger(YDGC, (I2S(YDWEH2I(t)) ), ( "Trigger" ), YDWEH2I(( trg))) // INLINED!!
call StoreInteger(YDGC, (I2S(YDWEH2I(t)) ), ( "RunIndex" ), ( TimerSystem_RunIndex)) // INLINED!!
set index=(GetStoredInteger(YDGC, (I2S(YDWEH2I(trg)) ), ( "YDWETimerNumber" + I2S(data)))) // INLINED!!
set index=index + 1
call StoreInteger(YDGC, (I2S(YDWEH2I(trg)) ), ( "YDWETimerNumber" + I2S(data) ), ( index)) // INLINED!!
call StoreInteger(YDGC, (I2S(YDWEH2I(trg)) ), ( "YDWETimer" + I2S(data) + "Index" + I2S(index) ), YDWEH2I(( t))) // INLINED!!
if b == false then
call StoreInteger(YDGC, (I2S(YDWEH2I(t)) ), ( "Times" ), ( times)) // INLINED!!
call TimerStart(t, timeout, true, function YDWETimerRunPeriodicTriggerFunctionByTimes)
else
call TimerStart(t, timeout, true, function YDWETimerRunPeriodicTriggerFunction)
endif
set t=null
endfunction
function YDWETimerRunPeriodicTriggerOver takes trigger trg,integer data returns nothing
local integer index=(GetStoredInteger(YDGC, (I2S(YDWEH2I(trg)) ), ( "YDWETimerNumber" + I2S(data)))) // INLINED!!
local timer t=null
loop
exitwhen index <= 0
set t=(YDWEI2Tm(GetStoredInteger(YDGC, (I2S(YDWEH2I(trg)) ), ( "YDWETimer" + I2S(data) + "Index" + I2S(index))))) // INLINED!!
call DestroyTimer(t)
call FlushStoredMission(YDGC, (I2S(YDWEH2I(t)))) // INLINED!!
set t=null
set index=index - 1
endloop
endfunction
//library YDWETimerSystem ends
//library YDWETriggerEvent:
//===========================================================================
//任意单位伤害事件
//===========================================================================
//call YDWESaveBooleanByString(I2S(YDWEH2I(u)),"GetAdvancedUnitDataing",false)
function YDWEAnyUnitDamagedTriggerAction takes nothing returns nothing
local integer i=(GetStoredInteger(YDGC, ("YDWESyStemAnyUnitDamagedTrigger" ), ( "TriggerNumber"))) // INLINED!!
local boolean b=(GetStoredBoolean(YDGC, (I2S(YDWEH2I(GetTriggerUnit())) ), ( "GetAdvancedUnitDataing"))) // INLINED!!
local trigger array trg
loop
set trg[i]=(YDWEI2T(GetStoredInteger(YDGC, ("YDWESyStemAnyUnitDamagedTrigger" ), ( I2S(i))))) // INLINED!!
if trg[i] != null and IsTriggerEnabled(trg[i]) == true and b == false then
call ConditionalTriggerExecute(trg[i])
endif
set trg[i]=null
set i=i - 1
exitwhen i <= 0
endloop
//return
endfunction
function YDWEAnyUnitDamagedEnumUnitFunction takes nothing returns nothing
local trigger trg=(YDWEI2T(GetStoredInteger(YDGC, ("YDWESyStemAnyUnitDamagedTrigger" ), ( "Trigger")))) // INLINED!!
if GetUnitAbilityLevel(GetEnumUnit(), 'Aloc') == 0 then
call TriggerRegisterUnitEvent(trg, GetEnumUnit(), EVENT_UNIT_DAMAGED)
endif
set trg=null
endfunction
function YDWESyStemAnyUnitEnterMapRectTriggerAction takes nothing returns nothing
local trigger trg=(YDWEI2T(GetStoredInteger(YDGC, ("YDWESyStemAnyUnitDamagedTrigger" ), ( "Trigger")))) // INLINED!!
if GetUnitAbilityLevel(GetTriggerUnit(), 'Aloc') == 0 then
call TriggerRegisterUnitEvent(trg, GetTriggerUnit(), EVENT_UNIT_DAMAGED)
endif
set trg=null
endfunction
function YDWEAnyUnitDamagedEnumUnit takes nothing returns nothing
local trigger trg=CreateTrigger()
local group g=CreateGroup()
set g=GetUnitsInRectAll(GetPlayableMapRect())
call ForGroup(g, function YDWEAnyUnitDamagedEnumUnitFunction)
//call YDWESaveGroupByString("YDWESyStemAnyUnitDamagedTrigger","Group",g)
call TriggerRegisterEnterRectSimple(trg, GetPlayableMapRect())
call TriggerAddAction(trg, function YDWESyStemAnyUnitEnterMapRectTriggerAction)
call StoreInteger(YDGC, ("YDWESyStemAnyUnitEnterMapRectTrigger" ), ( "Trigger" ), YDWEH2I(( trg))) // INLINED!!
call DestroyGroup(g)
set trg=null
set g=null
//return
endfunction
function YDWESyStemAnyUnitDamagedRegistTrigger takes trigger trg returns nothing
local integer i=(GetStoredInteger(YDGC, ("YDWESyStemAnyUnitDamagedTrigger" ), ( "TriggerNumber"))) // INLINED!!
local trigger SystemTrigger=null
if i == 0 then
set SystemTrigger=CreateTrigger()
call TriggerAddAction(SystemTrigger, function YDWEAnyUnitDamagedTriggerAction)
call StoreInteger(YDGC, ("YDWESyStemAnyUnitDamagedTrigger" ), ( "Trigger" ), YDWEH2I(( SystemTrigger))) // INLINED!!
call YDWEAnyUnitDamagedEnumUnit()
endif
set i=i + 1
call StoreInteger(YDGC, ("YDWESyStemAnyUnitDamagedTrigger" ), ( "TriggerNumber" ), ( i)) // INLINED!!
call StoreInteger(YDGC, ("YDWESyStemAnyUnitDamagedTrigger" ), ( I2S(i) ), YDWEH2I(( trg))) // INLINED!!
set SystemTrigger=null
//return
endfunction
//===========================================================================
//移动物品事件
//===========================================================================
function YDWESyStemItemUnmovableTriggerAction takes nothing returns nothing
local integer i
local trigger trg
if GetIssuedOrderId() >= 852002 and GetIssuedOrderId() <= 852007 then
set i=(GetStoredInteger(YDGC, ("YDWESyStemItemUnmovableRegistTrigger" ), ( "TriggerNumber"))) // INLINED!!
set bj_lastMovedItemInItemSlot=GetOrderTargetItem()
loop
set trg=(YDWEI2T(GetStoredInteger(YDGC, ("YDWESyStemItemUnmovableRegistTrigger" ), ( I2S(i))))) // INLINED!!
if trg != null and IsTriggerEnabled(trg) and TriggerEvaluate(trg) then
call TriggerExecute(trg)
endif
set i=i - 1
exitwhen i <= 0
endloop
set trg=null
endif
endfunction
function YDWESyStemItemUnmovableRegistTrigger takes trigger trg returns nothing
local integer i=(GetStoredInteger(YDGC, ("YDWESyStemItemUnmovableRegistTrigger" ), ( "TriggerNumber"))) // INLINED!!
local trigger SystemTrigger=null
if i == 0 then
set SystemTrigger=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(SystemTrigger, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER)
call TriggerAddAction(SystemTrigger, function YDWESyStemItemUnmovableTriggerAction)
call StoreInteger(YDGC, ("YDWESyStemItemUnmovableRegistTrigger" ), ( "Trigger" ), YDWEH2I(( SystemTrigger))) // INLINED!!
endif
set i=i + 1
call StoreInteger(YDGC, ("YDWESyStemItemUnmovableRegistTrigger" ), ( "TriggerNumber" ), ( i)) // INLINED!!
call StoreInteger(YDGC, ("YDWESyStemItemUnmovableRegistTrigger" ), ( I2S(i) ), YDWEH2I(( trg))) // INLINED!!
set SystemTrigger=null
endfunction
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Timer Pattern Union //
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function YDWETimerPattern__SingleMagic takes unit sour,unit targ,real x,real y,real h,integer uid,integer aid,integer lv,integer order returns nothing
local unit dummy= CreateUnit(GetOwningPlayer(sour), uid, x, y, GetUnitFacing(sour))
call UnitApplyTimedLife(dummy, 'BHwe', 1.0)
call UnitAddAbility(dummy, aid)
call SetUnitAbilityLevel(dummy, aid, lv)
call SetUnitFlyHeight(dummy, h, 0.0)
call IssueTargetOrderById(dummy, order, targ)
set dummy=null
endfunction
function YDWETimerPattern__GetUnitZ takes unit u returns real
call MoveLocation(yd_locHelper, GetUnitX(u), GetUnitY(u))
return GetUnitFlyHeight(u) + GetLocationZ(yd_locHelper)
endfunction
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Filter Funcs //
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function YDWETimerPattern__EnemyFilter takes unit u,unit caster returns boolean
return IsUnitType(u, UNIT_TYPE_MAGIC_IMMUNE) == false and IsUnitType(u, UNIT_TYPE_RESISTANT) == false and IsUnitType(u, UNIT_TYPE_SLEEPING) == false and GetUnitState(u, UNIT_STATE_LIFE) > 0.405 and IsUnitType(u, UNIT_TYPE_STRUCTURE) == false and IsUnitIllusion(u) == false and IsUnitHidden(u) == false and IsUnitEnemy(u, GetOwningPlayer(caster)) and IsUnitVisible(u, GetOwningPlayer(caster))
endfunction
function YDWETimerPattern__TreeFilter takes nothing returns boolean
local integer id= GetDestructableTypeId(GetFilterDestructable())
return id == 'LTlt' or id == 'ATtr' or id == 'BTtw' or id == 'KTtw' or id == 'YTft' or id == 'JTct' or id == 'YTst' or id == 'YTct' or id == 'YTwt' or id == 'JTtw' or id == 'DTsh' or id == 'FTtw' or id == 'CTtr' or id == 'ITtw' or id == 'NTtw' or id == 'OTtw' or id == 'ZTtw' or id == 'WTst' or id == 'GTsh' or id == 'VTlt' or id == 'WTtw' or id == 'ATtc' or id == 'BTtc' or id == 'CTtc' or id == 'ITtc' or id == 'NTtc' or id == 'ZTtc'
endfunction
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Major Structure Code //
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function s__YDWETimerPattern__Thread__staticgetindex takes handle h returns integer
return (GetStoredInteger(YDGC, ("YDWETimerPattern" ), ( I2S(YDWEH2I(h))))) // INLINED!!
endfunction
function s__YDWETimerPattern__Thread__staticsetindex takes handle h,integer value returns nothing
call StoreInteger(YDGC, ("YDWETimerPattern" ), ( I2S(YDWEH2I(h)) ), ( value)) // INLINED!!
endfunction
function s__YDWETimerPattern__Thread_flush takes handle h returns nothing
call FlushStoredInteger(YDGC, ("YDWETimerPattern" ), ( I2S(YDWEH2I(h)))) // INLINED!!
endfunction
function s__YDWETimerPattern__Thread__set_x takes integer this,real value returns nothing
set s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]]=value
call SetUnitX(s__YDWETimerPattern__Thread_obj[this], value)
endfunction
function s__YDWETimerPattern__Thread__set_y takes integer this,real value returns nothing
set s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]]=value
call SetUnitY(s__YDWETimerPattern__Thread_obj[this], value)
endfunction
function s__YDWETimerPattern__Thread__set_z takes integer this,real value returns nothing
set s__YDVector3_z[s__YDWETimerPattern__Thread_pos[this]]=value
call MoveLocation(yd_locHelper, s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]], s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]])
call SetUnitFlyHeight(s__YDWETimerPattern__Thread_obj[this], value - GetLocationZ(yd_locHelper), 0)
endfunction
function s__YDWETimerPattern__Thread_TreeKill takes nothing returns nothing
local destructable d= GetEnumDestructable()
if GetWidgetLife(d) > 0.405 then
call KillDestructable(d)
endif
set d=null
endfunction
function s__YDWETimerPattern__Thread_damage takes integer this,unit sour,real x,real y,real z,boolean monomer,boolean break returns nothing
local group g= CreateGroup()
local unit f
call GroupEnumUnitsInRange(g, x, y, YDWETimerPattern__TIMER_PATTERN_RADIUS, null)
loop
set f=FirstOfGroup(g)
exitwhen f == null
if IsUnitInGroup(f, s__YDWETimerPattern__Thread_except[this]) == false then
if YDWETimerPattern__EnemyFilter(f , sour) then
if s__YDWETimerPattern__Thread_isInRange(GetUnitX(f) - x , GetUnitY(f) - y , YDWETimerPattern__GetUnitZ(f) - z , YDWETimerPattern__TIMER_PATTERN_RADIUS) then
call GroupAddUnit(s__YDWETimerPattern__Thread_except[this], f)
call UnitDamageTarget(sour, f, s__YDWETimerPattern__Thread_amount[this], true, true, bj_lastSetAttackType, bj_lastSetDamageType, bj_lastSetWeaponType)
call DestroyEffect(AddSpecialEffectTarget(s__YDWETimerPattern__Thread_dsfx[this], f, s__YDWETimerPattern__Thread_part[this]))
set s__YDWETimerPattern__Thread_target[this]=f
if s__YDWETimerPattern__Thread_skills[this] > '0000' and s__YDWETimerPattern__Thread_skills[this] != null and s__YDWETimerPattern__Thread_order[this] > 0 and s__YDWETimerPattern__Thread_order[this] != null then
call YDWETimerPattern__SingleMagic(sour , f , x , y , GetUnitFlyHeight(s__YDWETimerPattern__Thread_obj[this]) , s__YDWETimerPattern__Thread_unitid[this] , s__YDWETimerPattern__Thread_skills[this] , s__YDWETimerPattern__Thread_level[this] , s__YDWETimerPattern__Thread_order[this])
endif
if break then
set s__YDWETimerPattern__Thread_switch[this]=0
exitwhen true
endif
exitwhen monomer
endif
endif
endif
call GroupRemoveUnit(g, f)
set f=null
endloop
call GroupClear(g)
call DestroyGroup(g)
set g=null
set f=null
endfunction
function s__YDWETimerPattern__Thread_onDestroy takes integer this returns nothing
call GroupClear(s__YDWETimerPattern__Thread_except[this])
call DestroyGroup(s__YDWETimerPattern__Thread_except[this])
call FlushStoredInteger(YDGC, ("YDWETimerPattern" ), ( I2S(YDWEH2I((s__YDWETimerPattern__Thread_obj[this]))))) // INLINED!!
call FlushStoredInteger(YDGC, ("YDWETimerPattern" ), ( I2S(YDWEH2I((s__YDWETimerPattern__Thread_t[this]))))) // INLINED!!
call PauseTimer(s__YDWETimerPattern__Thread_t[this])
call DestroyTimer(s__YDWETimerPattern__Thread_t[this])
call s__YDVector3_deallocate(s__YDWETimerPattern__Thread_des[this])
call s__YDVector3_deallocate(s__YDWETimerPattern__Thread_pos[this])
call s__YDVector3_deallocate(s__YDWETimerPattern__Thread_vel[this])
call s__YDVector3_deallocate(s__YDWETimerPattern__Thread_dec[this])
set s__YDWETimerPattern__Thread_except[this]=null
set s__YDWETimerPattern__Thread_caster[this]=null
set s__YDWETimerPattern__Thread_target[this]=null
set s__YDWETimerPattern__Thread_obj[this]=null
set s__YDWETimerPattern__Thread_t[this]=null
set s__YDWETimerPattern__Thread_amount[this]=0
set s__YDWETimerPattern__Thread_skills[this]=0
set s__YDWETimerPattern__Thread_order[this]=0
set s__YDWETimerPattern__Thread_dsfx[this]=""
set s__YDWETimerPattern__Thread_gsfx[this]=""
set s__YDWETimerPattern__Thread_wsfx[this]=""
set s__YDWETimerPattern__Thread_part[this]=""
endfunction
function s__Parabola_move takes nothing returns nothing
local integer this= (GetStoredInteger(YDGC, ("YDWETimerPattern" ), ( I2S(YDWEH2I((GetExpiredTimer())))))) // INLINED!!
local real vx= s__YDVector3_x[s__YDWETimerPattern__Thread_des[this]] - s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]]
local real vy= s__YDVector3_y[s__YDWETimerPattern__Thread_des[this]] - s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]]
local real vz= s__YDVector3_z[s__YDWETimerPattern__Thread_des[this]] - s__YDVector3_z[s__YDWETimerPattern__Thread_pos[this]]
if vx * vx + vy * vy + vz * vz > 900.0 then
call s__YDWETimerPattern__Thread__set_x(this,s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]] + s__YDVector3_x[s__YDWETimerPattern__Thread_vel[this]])
call s__YDWETimerPattern__Thread__set_y(this,s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]] + s__YDVector3_y[s__YDWETimerPattern__Thread_vel[this]])
call s__YDWETimerPattern__Thread__set_z(this,s__YDVector3_z[s__YDWETimerPattern__Thread_pos[this]] + s__YDWETimerPattern__Thread_ac[this] * s__YDWETimerPattern__Thread_step[this] * 2 + s__YDWETimerPattern__Thread_ac[this] * s__YDWETimerPattern__Thread_dist[this] + s__YDWETimerPattern__Thread_bc[this])
set s__YDWETimerPattern__Thread_step[this]=s__YDWETimerPattern__Thread_step[this] + s__YDWETimerPattern__Thread_dist[this]
if YDWECoordinateX(s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]]) != s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]] or YDWECoordinateY(s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]]) != s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]] then
set s__YDWETimerPattern__Thread_switch[this]=0
endif
if s__YDWETimerPattern__Thread_amount[this] > 0.0 then
call s__YDWETimerPattern__Thread_damage(this,s__YDWETimerPattern__Thread_caster[this] , s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]] + s__YDVector3_x[s__YDWETimerPattern__Thread_vel[this]] , s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]] + s__YDVector3_y[s__YDWETimerPattern__Thread_vel[this]] , YDWETimerPattern__GetUnitZ(s__YDWETimerPattern__Thread_obj[this]) , false , false)
endif
else
set s__YDWETimerPattern__Thread_switch[this]=0
endif
function s__Parabola_create takes unit source,unit object,real angle,real distance,real time,real interval,real high,real damage,string attach,string deff returns integer
local integer this= s__Parabola__allocate()
local real vx= 0.0
local real vy= 0.0
local real vz= 0.0
set s__YDWETimerPattern__Thread_pos[this]=s__YDVector3__allocate()
set s__YDWETimerPattern__Thread_des[this]=s__YDVector3__allocate()
set s__YDWETimerPattern__Thread_vel[this]=s__YDVector3__allocate()
set s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]]=GetUnitX(object)
set s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]]=GetUnitY(object)
set s__YDVector3_z[s__YDWETimerPattern__Thread_pos[this]]=YDWETimerPattern__GetUnitZ(object)
set s__YDVector3_x[s__YDWETimerPattern__Thread_des[this]]=s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]] + distance * Cos(angle)
set s__YDVector3_y[s__YDWETimerPattern__Thread_des[this]]=s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]] + distance * Sin(angle)
call MoveLocation(yd_locHelper, s__YDVector3_x[s__YDWETimerPattern__Thread_des[this]], s__YDVector3_y[s__YDWETimerPattern__Thread_des[this]])
set s__YDVector3_z[s__YDWETimerPattern__Thread_des[this]]=GetLocationZ(yd_locHelper)
set vx=s__YDVector3_x[s__YDWETimerPattern__Thread_des[this]] - s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]]
set vy=s__YDVector3_y[s__YDWETimerPattern__Thread_des[this]] - s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]]
set vz=s__YDVector3_z[s__YDWETimerPattern__Thread_des[this]] - s__YDVector3_z[s__YDWETimerPattern__Thread_pos[this]]
if s__YDVector3_z[s__YDWETimerPattern__Thread_pos[this]] > s__YDVector3_z[s__YDWETimerPattern__Thread_des[this]] then
set high=high + s__YDVector3_z[s__YDWETimerPattern__Thread_pos[this]]
else
set high=high + s__YDVector3_z[s__YDWETimerPattern__Thread_des[this]]
endif
set s__YDWETimerPattern__Thread_ac[this]=( 2 * ( s__YDVector3_z[s__YDWETimerPattern__Thread_pos[this]] + s__YDVector3_z[s__YDWETimerPattern__Thread_des[this]] ) - 4 * high ) / ( distance * distance )
set s__YDWETimerPattern__Thread_bc[this]=( s__YDVector3_z[s__YDWETimerPattern__Thread_des[this]] - s__YDVector3_z[s__YDWETimerPattern__Thread_pos[this]] - s__YDWETimerPattern__Thread_ac[this] * distance * distance ) / distance
set s__YDWETimerPattern__Thread_dist[this]=distance * interval / time
set s__YDWETimerPattern__Thread_ac[this]=s__YDWETimerPattern__Thread_ac[this] * s__YDWETimerPattern__Thread_dist[this]
set s__YDWETimerPattern__Thread_bc[this]=s__YDWETimerPattern__Thread_bc[this] * s__YDWETimerPattern__Thread_dist[this]
set s__YDVector3_x[s__YDWETimerPattern__Thread_vel[this]]=s__YDWETimerPattern__Thread_dist[this] * Cos(angle)
set s__YDVector3_y[s__YDWETimerPattern__Thread_vel[this]]=s__YDWETimerPattern__Thread_dist[this] * Sin(angle)
set s__YDWETimerPattern__Thread_step[this]=0.0
set s__YDWETimerPattern__Thread_caster[this]=source
set s__YDWETimerPattern__Thread_obj[this]=object
set s__YDWETimerPattern__Thread_amount[this]=damage
set s__YDWETimerPattern__Thread_dsfx[this]=deff
set s__YDWETimerPattern__Thread_part[this]=attach
set s__YDWETimerPattern__Thread_switch[this]=1
set s__YDWETimerPattern__Thread_t[this]=CreateTimer()
set s__YDWETimerPattern__Thread_except[this]=CreateGroup()
call UnitAddAbility(s__YDWETimerPattern__Thread_obj[this], 'Amrf')
call UnitRemoveAbility(s__YDWETimerPattern__Thread_obj[this], 'Amrf')
call TimerStart(s__YDWETimerPattern__Thread_t[this], interval, true, function s__Parabola_move)
call GroupAddUnit(s__YDWETimerPattern__Thread_except[this], object)
call StoreInteger(YDGC, ("YDWETimerPattern" ), ( I2S(YDWEH2I((object))) ), ( ( (this)))) // INLINED!!
call StoreInteger(YDGC, ("YDWETimerPattern" ), ( I2S(YDWEH2I((s__YDWETimerPattern__Thread_t[this]))) ), ( ( (this)))) // INLINED!!
return this
endfunction
// uniform speed
function s__Linear_move takes nothing returns nothing
local integer this= (GetStoredInteger(YDGC, ("YDWETimerPattern" ), ( I2S(YDWEH2I((GetExpiredTimer())))))) // INLINED!!
if s__YDWETimerPattern__Thread_step[this] > s__YDWETimerPattern__Thread_dist[this] then
call s__YDWETimerPattern__Thread__set_x(this,s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]] + s__YDVector3_x[s__YDWETimerPattern__Thread_vel[this]])
call s__YDWETimerPattern__Thread__set_y(this,s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]] + s__YDVector3_y[s__YDWETimerPattern__Thread_vel[this]])
set s__YDVector3_z[s__YDWETimerPattern__Thread_pos[this]]=YDWETimerPattern__GetUnitZ(s__YDWETimerPattern__Thread_obj[this])
set s__YDWETimerPattern__Thread_step[this]=s__YDWETimerPattern__Thread_step[this] - s__YDWETimerPattern__Thread_dist[this]
call s__YDWETimerPattern__Thread_damage(this,s__YDWETimerPattern__Thread_caster[this] , s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]] , s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]] , s__YDVector3_z[s__YDWETimerPattern__Thread_pos[this]] , true , true)
if YDWECoordinateX(s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]]) != s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]] or YDWECoordinateY(s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]]) != s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]] then
set s__YDWETimerPattern__Thread_switch[this]=0
endif
else
set s__YDWETimerPattern__Thread_switch[this]=0
endif
if s__YDWETimerPattern__Thread_switch[this] == 0 then
// YDWETriggerEvent
if s__YDWETimerPattern__Thread_target[this] != null then
//call YDWESaveUnitByString(I2S(YDWEH2I(.caster)), "MoonPriestessArrow", .target)
set bj_lastAbilityTargetUnit=s__YDWETimerPattern__Thread_target[this]
call YDWESyStemAbilityCastingOverTriggerAction(s__YDWETimerPattern__Thread_caster[this] , 8)
else
call YDWESyStemAbilityCastingOverTriggerAction(s__YDWETimerPattern__Thread_caster[this] , 9)
endif
//call KillUnit(.obj)
call RemoveUnit(s__YDWETimerPattern__Thread_obj[this])
call sc__YDWETimerPattern__Thread_deallocate(this)
endif
endfunction
function s__Linear_create takes unit source,unit object,real angle,real distance,real time,real interval,integer uid,integer aid,integer lv,integer orderid,string attach,string sfx returns integer
local integer this= s__Linear__allocate()
set s__YDWETimerPattern__Thread_pos[this]=s__YDVector3__allocate()
set s__YDWETimerPattern__Thread_vel[this]=s__YDVector3__allocate()
set s__YDWETimerPattern__Thread_step[this]=distance
set s__YDWETimerPattern__Thread_dist[this]=distance * interval / time
set s__YDVector3_x[s__YDWETimerPattern__Thread_vel[this]]=s__YDWETimerPattern__Thread_dist[this] * Cos(angle)
set s__YDVector3_y[s__YDWETimerPattern__Thread_vel[this]]=s__YDWETimerPattern__Thread_dist[this] * Sin(angle)
set s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]]=GetUnitX(object)
set s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]]=GetUnitY(object)
set s__YDWETimerPattern__Thread_caster[this]=source
set s__YDWETimerPattern__Thread_obj[this]=object
set s__YDWETimerPattern__Thread_unitid[this]=uid
set s__YDWETimerPattern__Thread_skills[this]=aid
set s__YDWETimerPattern__Thread_level[this]=lv
set s__YDWETimerPattern__Thread_order[this]=orderid
set s__YDWETimerPattern__Thread_part[this]=attach
set s__YDWETimerPattern__Thread_gsfx[this]=sfx
set s__YDWETimerPattern__Thread_switch[this]=1
set s__YDWETimerPattern__Thread_t[this]=CreateTimer()
call TimerStart(s__YDWETimerPattern__Thread_t[this], interval, true, function s__Linear_move)
call StoreInteger(YDGC, ("YDWETimerPattern" ), ( I2S(YDWEH2I((s__YDWETimerPattern__Thread_t[this]))) ), ( ( (this)))) // INLINED!!
return this
endfunction
// Uniform deceleration
function s__Deceleration_move takes nothing returns nothing
local integer this= (GetStoredInteger(YDGC, ("YDWETimerPattern" ), ( I2S(YDWEH2I((GetExpiredTimer())))))) // INLINED!!
local real xp= s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]] + s__YDVector3_x[s__YDWETimerPattern__Thread_vel[this]]
local real yp= s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]] + s__YDVector3_y[s__YDWETimerPattern__Thread_vel[this]]
if s__YDWETimerPattern__Thread_volume[this] == false then
if IsTerrainPathable(xp, yp, PATHING_TYPE_WALKABILITY) then
set s__YDWETimerPattern__Thread_switch[this]=0
else
call s__YDWETimerPattern__Thread__set_x(this,xp)
call s__YDWETimerPattern__Thread__set_y(this,yp)
endif
else
call s__YDWETimerPattern__Thread__set_x(this,xp)
call s__YDWETimerPattern__Thread__set_y(this,yp)
endif
if s__YDWETimerPattern__Thread_follow[this] == 0 then
if GetUnitFlyHeight(s__YDWETimerPattern__Thread_obj[this]) < 5. then
if IsTerrainPathable(s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]], s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]], PATHING_TYPE_FLOATABILITY) then
call DestroyEffect(AddSpecialEffect(s__YDWETimerPattern__Thread_gsfx[this], s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]], s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]]))
else
call DestroyEffect(AddSpecialEffect(s__YDWETimerPattern__Thread_wsfx[this], s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]], s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]]))
endif
endif
endif
set s__YDWETimerPattern__Thread_follow[this]=s__YDWETimerPattern__Thread_follow[this] + 1
if s__YDWETimerPattern__Thread_follow[this] == 2 then
set s__YDWETimerPattern__Thread_follow[this]=0
endif
if s__YDWETimerPattern__Thread_killdest[this] then
call MoveRectTo(YDWETimerPattern__area, s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]], s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]])
call EnumDestructablesInRect(YDWETimerPattern__area, YDWETimerPattern__bexpr, function s__YDWETimerPattern__Thread_TreeKill)
endif
if s__YDWETimerPattern__Thread_amount[this] > 0.0 then
call s__YDWETimerPattern__Thread_damage(this,s__YDWETimerPattern__Thread_caster[this] , s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]] , s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]] , 0.0 , false , s__YDWETimerPattern__Thread_recyclable[this])
endif
if s__YDVector3_x[s__YDWETimerPattern__Thread_vel[this]] * s__YDVector3_x[s__YDWETimerPattern__Thread_vel[this]] + s__YDVector3_y[s__YDWETimerPattern__Thread_vel[this]] * s__YDVector3_y[s__YDWETimerPattern__Thread_vel[this]] < 100.0 or YDWECoordinateX(s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]]) != s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]] or YDWECoordinateY(s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]]) != s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]] then
set s__YDWETimerPattern__Thread_switch[this]=0
else
set s__YDVector3_x[s__YDWETimerPattern__Thread_vel[this]]=s__YDVector3_x[s__YDWETimerPattern__Thread_vel[this]] - s__YDVector3_x[s__YDWETimerPattern__Thread_dec[this]]
set s__YDVector3_y[s__YDWETimerPattern__Thread_vel[this]]=s__YDVector3_y[s__YDWETimerPattern__Thread_vel[this]] - s__YDVector3_y[s__YDWETimerPattern__Thread_dec[this]]
endif
function s__Deceleration_create takes unit source,unit object,real angle,real distance,real time,real interval,real damage,boolean killtrees,boolean cycle,boolean path,string part,string geff,string weff returns integer
local integer this= ((GetStoredInteger(YDGC, ("YDWETimerPattern" ), ( I2S(YDWEH2I((object))))))) // INLINED!!
local real vx= 0.0
local real vy= 0.0
local real l= 0.0
if IsUnitInGroup(object, s__YDWETimerPattern__Thread_except[this]) then
return - 1
endif
set vx=2 * distance * Cos(angle) * interval / time
set vy=2 * distance * Sin(angle) * interval / time
if (this) > 0 then
set s__YDVector3_x[s__YDWETimerPattern__Thread_vel[this]]=s__YDVector3_x[s__YDWETimerPattern__Thread_vel[this]] + vx
set s__YDVector3_y[s__YDWETimerPattern__Thread_vel[this]]=s__YDVector3_y[s__YDWETimerPattern__Thread_vel[this]] + vy
set l=SquareRoot(s__YDVector3_x[s__YDWETimerPattern__Thread_vel[this]] * s__YDVector3_x[s__YDWETimerPattern__Thread_vel[this]] + s__YDVector3_y[s__YDWETimerPattern__Thread_vel[this]] * s__YDVector3_y[s__YDWETimerPattern__Thread_vel[this]]) / SquareRoot(vx * vx + vy * vy)
set s__YDVector3_x[s__YDWETimerPattern__Thread_dec[this]]=s__YDVector3_x[s__YDWETimerPattern__Thread_vel[this]] * interval / ( time * l )
set s__YDVector3_y[s__YDWETimerPattern__Thread_dec[this]]=s__YDVector3_y[s__YDWETimerPattern__Thread_vel[this]] * interval / ( time * l )
else
set this=s__Deceleration__allocate()
set s__YDWETimerPattern__Thread_pos[this]=s__YDVector3__allocate()
set s__YDWETimerPattern__Thread_vel[this]=s__YDVector3__allocate()
set s__YDWETimerPattern__Thread_dec[this]=s__YDVector3__allocate()
set s__YDVector3_x[s__YDWETimerPattern__Thread_vel[this]]=vx
set s__YDVector3_y[s__YDWETimerPattern__Thread_vel[this]]=vy
set s__YDVector3_x[s__YDWETimerPattern__Thread_dec[this]]=s__YDVector3_x[s__YDWETimerPattern__Thread_vel[this]] * interval / time
set s__YDVector3_y[s__YDWETimerPattern__Thread_dec[this]]=s__YDVector3_y[s__YDWETimerPattern__Thread_vel[this]] * interval / time
endif
set s__YDVector3_x[s__YDWETimerPattern__Thread_pos[this]]=GetUnitX(object)
set s__YDVector3_y[s__YDWETimerPattern__Thread_pos[this]]=GetUnitY(object)
set s__YDWETimerPattern__Thread_caster[this]=source
set s__YDWETimerPattern__Thread_obj[this]=object
set s__YDWETimerPattern__Thread_amount[this]=damage
set s__YDWETimerPattern__Thread_killdest[this]=killtrees
set s__YDWETimerPattern__Thread_recyclable[this]=cycle
set s__YDWETimerPattern__Thread_volume[this]=path
set s__YDWETimerPattern__Thread_gsfx[this]=geff
set s__YDWETimerPattern__Thread_wsfx[this]=weff
set s__YDWETimerPattern__Thread_switch[this]=1
set s__YDWETimerPattern__Thread_follow[this]=0
set s__YDWETimerPattern__Thread_except[this]=CreateGroup()
if s__YDWETimerPattern__Thread_t[this] == null then
set s__YDWETimerPattern__Thread_t[this]=CreateTimer()
endif
call PauseTimer(s__YDWETimerPattern__Thread_t[this])
call TimerStart(s__YDWETimerPattern__Thread_t[this], interval, true, function s__Deceleration_move)
call StoreInteger(YDGC, ("YDWETimerPattern" ), ( I2S(YDWEH2I((object))) ), ( ( (this)))) // INLINED!!
call StoreInteger(YDGC, ("YDWETimerPattern" ), ( I2S(YDWEH2I((s__YDWETimerPattern__Thread_t[this]))) ), ( ( (this)))) // INLINED!!
return this
endfunction
// Jump Attack PUI
function YDWETimerPatternJumpAttack takes unit u,real face,real dis,real lasttime,real timeout,real high,real damage,string part,string dsfx returns nothing
if u == null then
return
endif
call s__Parabola_create(u , u , Deg2Rad(face) , RMaxBJ(dis, 0) , RMaxBJ(lasttime, 0) , RMaxBJ(timeout, 0) , high , damage , part , dsfx)
endfunction
// Moon Priestess Arrow PUI
function YDWETimerPatternMoonPriestessArrow takes unit u,real face,real dis,real lasttime,real timeout,integer lv,integer aid,integer uid,string order,string part,string dsfx returns nothing
local unit sour= null
if u == null then
return
endif
set sour=(YDWEI2U(GetStoredInteger(YDGC, (I2S(YDWEH2I(u)) ), ( "MoonPriestessArrow")))) // INLINED!!
if sour == null then
set sour=u
endif
call s__Linear_create(sour , u , Deg2Rad(face) , RMaxBJ(dis, 0) , RMaxBJ(lasttime, 0) , RMaxBJ(timeout, 0) , uid , aid , IMaxBJ(lv, 1) , OrderId(order) , part , dsfx)
call FlushStoredMission(YDGC, (I2S(YDWEH2I(u)))) // INLINED!!
set sour=null
endfunction
// Rush Slide PUI
function YDWETimerPatternRushSlide takes unit u,real face,real dis,real lasttime,real timeout,real damage,boolean killtrees,boolean cycle,boolean path,string part,string gsfx,string wsfx returns nothing
if u == null then
return
endif
call s__Deceleration_create(u , u , Deg2Rad(face) , RMaxBJ(dis, 0) , RMaxBJ(lasttime, 0) , RMaxBJ(timeout, 0) , damage , killtrees , cycle , path , part , gsfx , wsfx)
endfunction
function YDWETimerPattern__Init takes nothing returns nothing
set YDWETimerPattern__area=Rect(- YDWETimerPattern__TIMER_PATTERN_RADIUS, - YDWETimerPattern__TIMER_PATTERN_RADIUS, YDWETimerPattern__TIMER_PATTERN_RADIUS, YDWETimerPattern__TIMER_PATTERN_RADIUS)
set YDWETimerPattern__bexpr=Filter(function YDWETimerPattern__TreeFilter)
endfunction