|
[jass]function ItemYMS takes nothing returns nothing
local integer TimeInt = H2I(GetExpiredTimer())
local integer TrigUnit = GetHandleInt(TimeInt,"英雄")
local real x = GetUnitX(I2U(TrigUnit))
local real X = GetHandleReal(TrigUnit,"YMSX")
if x != X and (GetUnitState(I2U(TrigUnit), UNIT_STATE_LIFE) < GetUnitState(I2U(TrigUnit), UNIT_STATE_MAX_LIFE) or GetUnitState(I2U(TrigUnit), UNIT_STATE_MANA) < GetUnitState(I2U(TrigUnit), UNIT_STATE_MAX_MANA)) then
call SetUnitState(I2U(TrigUnit), UNIT_STATE_LIFE,GetUnitState(I2U(TrigUnit), UNIT_STATE_LIFE) + ( GetUnitState(I2U(TrigUnit), UNIT_STATE_MAX_LIFE) * 0.01 * GetHandleInt(H2I(gg_trg_ItemAbililty),ConvertIdString(GetItemTypeId(ItemUs(I2U(TrigUnit),'ratc'))) + "装备等级") ))
call SetUnitState(I2U(TrigUnit), UNIT_STATE_MANA,GetUnitState(I2U(TrigUnit), UNIT_STATE_MANA) + ( GetUnitState(I2U(TrigUnit), UNIT_STATE_MAX_MANA) * 0.01 * GetHandleInt(H2I(gg_trg_ItemAbililty),ConvertIdString(GetItemTypeId(ItemUs(I2U(TrigUnit),'ratc'))) + "装备等级") ))
endif
call SetHandleReal(TrigUnit,"YMSX",x)
endfunction
function LoopTimer takes integer TrigUnit,real TimerReal,item ItemInt,code LoopFun,boolean boo returns nothing
local integer TimeInt
if boo then
set TimeInt = H2I(CreateTimer())
call SetHandleInt(TimeInt,"英雄",TrigUnit)
call SetHandleInt(TrigUnit,I2S(H2I(ItemInt)),TimeInt)
call TimerStart( I2t(TimeInt),TimerReal,true,LoopFun )
else
set TimeInt = GetHandleInt(TrigUnit,I2S(H2I(ItemInt)))
call FlushHandleInt(TimeInt,"英雄")
call FlushHandleInt(TrigUnit,I2S(H2I(ItemInt)))
call StopTimer(TimeInt)
endif
endfunction
function Trig_ItemLoopEvent_Conditions takes nothing returns boolean
if GetItemTypeId(GetManipulatedItem()) == 'ratc' then
call SetHandleReal(H2I(GetTriggerUnit()),"YMSX",GetUnitX(GetTriggerUnit()))
call LoopTimer(H2I(GetTriggerUnit()),1,GetManipulatedItem(),function ItemYMS,true)
endif
return false
endfunction
function InitTrig_ItemLoopEvent takes nothing returns nothing
local integer t
local integer index
set t = H2I(CreateTrigger())
set index = 0
loop
call TriggerRegisterPlayerUnitEvent(I2T(t), Player(index), EVENT_PLAYER_UNIT_PICKUP_ITEM, null)
set index = index + 1
exitwhen index == 15
endloop
if Trig_ItemLoopEvent_Conditions() then
endif
call TriggerAddCondition(I2T(t), Condition( function Trig_ItemLoopEvent_Conditions ) )
endfunction[/jass]
这个物品获得后大概50%的几率会使所有人的屏幕和操作一秒一卡,有50%几率就正常不会卡
卡的时候函数内容正常运行....
求助= = |
|