|
一个跟【群体技能模板】差不多的模板,在一些设置上还有些问题,不过大体概念的给出来了,大家模仿我这个做就行了。
设置还是蛮好弄的。
[trigger]Spell
事件
单位 - 圣骑士 0001 <预设> 学习技能
条件
动作
如果所有条件成立则做动作1,否则做动作2
If - 条件
(学习技能) 等于 闪避光环
Then - 动作
-------- 闪避光环 --------
如果所有条件成立则做动作1,否则做动作2
If - 条件
Test_Boolean[0] 等于 FALSE
Then - 动作
自定义代码: set udg_Aura_Ability = 'A000'
-------- 真技能(如:闪避、重击等) --------
自定义代码: set udg_Aura_Condition = Condition( function Aura_Condition_1 )
-------- 选取单位的条件(不用范围) --------
如果所有条件成立则做动作1,否则做动作2
If - 条件
((触发单位) 是 英雄) 等于 TRUE
Then - 动作
设置 Aura_IsDestroyAllWhenUnitDeath = FALSE
-------- 在单位死亡时【不】删除Timer和Group,等待单位复活 --------
Else - 动作
设置 Aura_IsDestroyAllWhenUnitDeath = TRUE
-------- 在单位死亡时删除Timer和Group --------
自定义代码: set udg_Aura_MagicBook = 'A001'
-------- 用来隐藏的魔法书技能(需要提前禁用) --------
设置 Aura_Radius = 900.00
-------- 选取单位的范围 --------
设置 Aura_U = (触发单位)
-------- 拥有光环技能的单位 --------
自定义代码: set udg_Aura_AuraAbility = GetLearnedSkill()
-------- 光环技能ID --------
自定义代码: call Aura_Start(udg_Aura_U,udg_Aura_Radius,udg_Aura_MagicBook,udg_Aura_Ability,udg_Aura_Condition,udg_Aura_IsDestroyAllWhenUnitDeath,udg_Aura_AuraAbility)
设置 Test_Boolean[0] = TRUE
-------- 由于这个模板是不能判断已经有了Timer/没有Timer --------
-------- 所以如果再一次运行这个函数的话,那么就会出现两个Timer在干同一件事情,从而减少运行效率。 --------
Else - 动作
Else - 动作
-------- 重击光环 --------
如果所有条件成立则做动作1,否则做动作2
If - 条件
Test_Boolean[1] 等于 FALSE
Then - 动作
自定义代码: set udg_Aura_Ability = 'A004'
-------- 真技能(如:闪避、重击等) --------
自定义代码: set udg_Aura_Condition = Condition( function Aura_Condition_1 )
-------- 选取单位的条件(不用范围) --------
如果所有条件成立则做动作1,否则做动作2
If - 条件
((触发单位) 是 英雄) 等于 TRUE
Then - 动作
设置 Aura_IsDestroyAllWhenUnitDeath = FALSE
-------- 在单位死亡时【不】删除Timer和Group,等待单位复活 --------
Else - 动作
设置 Aura_IsDestroyAllWhenUnitDeath = TRUE
-------- 在单位死亡时删除Timer和Group --------
自定义代码: set udg_Aura_MagicBook = 'A002'
-------- 用来隐藏的魔法书技能(需要提前禁用) --------
设置 Aura_Radius = 900.00
-------- 选取单位的范围 --------
设置 Aura_U = (触发单位)
-------- 拥有光环技能的单位 --------
自定义代码: set udg_Aura_AuraAbility = GetLearnedSkill()
-------- 光环技能ID --------
自定义代码: call Aura_Start(udg_Aura_U,udg_Aura_Radius,udg_Aura_MagicBook,udg_Aura_Ability,udg_Aura_Condition,udg_Aura_IsDestroyAllWhenUnitDeath,udg_Aura_AuraAbility)
设置 Test_Boolean[1] = TRUE
-------- 由于这个模板是不能判断已经有了Timer/没有Timer --------
-------- 所以如果再一次运行这个函数的话,那么就会出现两个Timer在干同一件事情,从而减少运行效率。 --------
Else - 动作
[/trigger]
基础函数:
[codes=jass]globals
gamecache gg_TheGC = null
integer aura_MagicBook = 0
integer aura_Ability = 0
integer aura_Ability_level = 0
real aura_radius = 0.0
unit aura_unit = null
endglobals
function GetGC takes nothing returns gamecache
if gg_TheGC == null then
call FlushGameCache( InitGameCache( "XLdeGC.w3v" ) )
set gg_TheGC = InitGameCache( "XLdeGC.w3v" )
return gg_TheGC
endif
return gg_TheGC
endfunction
function H2I takes handle h returns integer
return h
return 0
endfunction
function SHI takes handle h, string key, integer i returns nothing
call StoreInteger( GetGC(), I2S(H2I(h)), key, i)
endfunction
function SHR takes handle h, string key, real r returns nothing
call StoreReal( GetGC(), I2S(H2I(h)), key, r)
endfunction
function SHB takes handle h, string key, boolean b returns nothing
call StoreBoolean( GetGC(), I2S(H2I(h)), key, b)
endfunction
function SHH takes handle h, string key, handle target returns nothing
call SHI(h,key,H2I(target))
endfunction
function GHI takes handle h, string key returns integer
return GetStoredInteger( GetGC(), I2S(H2I(h)), key)
endfunction
function GHR takes handle h, string key returns real
return GetStoredReal( GetGC(), I2S(H2I(h)), key)
endfunction
function GHB takes handle h, string key returns boolean
return GetStoredBoolean( GetGC(), I2S(H2I(h)), key)
endfunction
function GHU takes handle h, string key returns unit
return GHI(h,key)
return null
endfunction
function GHBE takes handle h, string key returns boolexpr
return GHI(h,key)
return null
endfunction
function GHG takes handle h, string key returns group
return GHI(h,key)
return null
endfunction
function GHTa takes handle h, string key returns triggeraction
return GHI(h,key)
return null
endfunction
function GHTi takes handle h, string key returns timer
return GHI(h,key)
return null
endfunction
function FHM takes handle h returns nothing
call FlushStoredMission( GetGC(), I2S(H2I(h)) )
endfunction
function DistanceBetweenUnits takes unit uA, unit uB returns real
local real dx = GetUnitX(uB) - GetUnitX(uA)
local real dy = GetUnitY(uB) - GetUnitY(uA)
return SquareRoot(dx * dx + dy * dy)
endfunction[/codes]
[codes=jass]
function Aura_CleanUdg_Valve takes nothing returns nothing
set aura_MagicBook = 0
set aura_Ability = 0
set aura_Ability_level = 0
set aura_radius = 0.0
set aura_unit = null
endfunction
function Aura_RemoveAbility takes nothing returns nothing
call UnitRemoveAbility( GetEnumUnit(), aura_MagicBook )
endfunction
function Aura_GroupRemoveAbility takes nothing returns nothing
local unit u = GetEnumUnit( )
if DistanceBetweenUnits( u, aura_unit ) > aura_radius then
call UnitRemoveAbility( u, aura_MagicBook )
endif
set u = null
endfunction
function Aura_GroupAddAbility takes nothing returns nothing
local unit u = GetEnumUnit( )
if GetUnitAbilityLevel( u, aura_MagicBook ) <= 0 then
call UnitAddAbility( u, aura_MagicBook )
call UnitMakeAbilityPermanent( u, true, aura_MagicBook )
endif
call SetUnitAbilityLevel( u, aura_Ability, aura_Ability_level )
set u = null
endfunction
function Aura_GetAbilityLevel takes unit u,integer AuraAbility returns integer
return GetUnitAbilityLevel( u, AuraAbility )
endfunction
function Aura_TimerAction takes nothing returns nothing
local timer t = GetExpiredTimer( )
local unit AuraUnit = GHU( t, "Aura_Unit" )
local integer magicbook = GHI( t, "Aura_MagicBook" )
local integer ab_id = GHI( t, "Aura_Ability" )
local integer AuraAbility = GHI( t, "Aura_AuraAbility" )
local integer ab_level = Aura_GetAbilityLevel( AuraUnit, AuraAbility )
local real radius = GHR( t, "Aura_Radius" )
local boolexpr T_condition = GHBE( t, "Aura_TargetCondition" )
local group Targets = GHG( t, "Aura_Group" )
local boolean IsDestroyAllWhenUnitDeath = GHB( t, "Aura_IsDestroyAllWhenUnitDeath" )
set aura_MagicBook = magicbook
set aura_Ability = ab_id
set aura_Ability_level = ab_level
set aura_radius = radius
set aura_unit = AuraUnit
call ForGroup( Targets, function Aura_GroupRemoveAbility )
if GetUnitState( AuraUnit, UNIT_STATE_LIFE ) <= 0.0 then
call ForGroup( Targets, function Aura_RemoveAbility )
call GroupClear( Targets )
if IsDestroyAllWhenUnitDeath then
call DestroyGroup( Targets )
call FHM( t )
call DestroyTimer( t )
set t = null
set AuraUnit = null
set T_condition = null
set Targets = null
call Aura_CleanUdg_Valve()
return
else
set t = null
set AuraUnit = null
set T_condition = null
set Targets = null
call Aura_CleanUdg_Valve()
return
endif
endif
call GroupClear( Targets )
call GroupEnumUnitsInRange( Targets, GetUnitX(AuraUnit), GetUnitY(AuraUnit), radius, T_condition)
call ForGroup( Targets, function Aura_GroupAddAbility )
call Aura_CleanUdg_Valve()
set t = null
set AuraUnit = null
set T_condition = null
set Targets = null
endfunction
function Aura_Start takes unit AuraUnit, real radius, integer MagicBook_ID, integer ab_id, boolexpr ab_t_condition, boolean IsDestroyAllWhenUnitDeath, integer AuraAbilityId returns nothing
local timer t = null
local group g = null
set t = CreateTimer()
set g = CreateGroup()
call SHH( t, "Aura_Unit", AuraUnit )
call SHI( t, "Aura_MagicBook", MagicBook_ID )
call SHI( t, "Aura_Ability", ab_id )
call SHR( t, "Aura_Radius", radius )
call SHH( t, "Aura_TargetCondition", ab_t_condition )
call SHI( t, "Aura_AuraAbility", AuraAbilityId )
call SHH( t, "Aura_Group", g )
call SHB( t, "Aura_IsDestroyAllWhenUnitDeath", IsDestroyAllWhenUnitDeath )
call TimerStart( t, 1.0, true, function Aura_TimerAction )
set t = null
set g = null
endfunction
[/codes] |
评分
-
查看全部评分
|