|
我想做出的效果是这样的:
使周围的地方单位在一定时间内停止任何生命回复,并将原本的生命回复数值给予施法者。
但是前一半就出问题了,不知道这段代码有什么问题
[jass]
globals
hashtable UnitHashtable
endglobals
function BloodFrost_Conditions takes nothing returns boolean
return (GetSpellAbilityId() == 'A000')
endfunction
function BloodFrost_Actions3 takes nothing returns nothing
local real UnitLife0=LoadReal(UnitHashtable,GetHandleId(GetEnumUnit()),1)
local real UnitLife1=GetUnitState(GetEnumUnit(),UNIT_STATE_LIFE)
if UnitHasBuffBJ(GetEnumUnit(), 'B000') == true then
if UnitLife1>=UnitLife0 then
call SetUnitState(GetEnumUnit(),UNIT_STATE_LIFE,UnitLife0)
else
call SaveReal(UnitHashtable,GetHandleId(GetEnumUnit()),1,UnitLife1)
endif
endif
endfunction
function BloodFrost_Actions2 takes nothing returns nothing
local timer t = CreateTimer()
if UnitHasBuffBJ(GetEnumUnit(), 'B000') == true then
call SaveReal(UnitHashtable,GetHandleId(GetEnumUnit()),1,GetUnitState(GetEnumUnit(),UNIT_STATE_LIFE))
call TimerStart(t, 0.01,true,function BloodFrost_Actions3)
endif
set t = null
endfunction
function BloodFrost_Actions takes nothing returns nothing
call ForGroup(GetUnitsInRangeOfLocAll(600.00, GetUnitLoc(GetTriggerUnit())),function BloodFrost_Actions2)
endfunction
function InitTrig_BloodFrost takes nothing returns nothing
local trigger BloodFrost=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(BloodFrost,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(BloodFrost,Condition(function BloodFrost_Conditions))
call TriggerAddAction(BloodFrost,function BloodFrost_Actions)
set BloodFrost=null
endfunction
[/jass] |
|