找回密码
 点一下
查看: 4680|回复: 13

被动技能光环模板

[复制链接]
发表于 2008-10-4 11:49:26 | 显示全部楼层 |阅读模式
一个跟【群体技能模板】差不多的模板,在一些设置上还有些问题,不过大体概念的给出来了,大家模仿我这个做就行了。

设置还是蛮好弄的。
[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]

光环模板.w3x

38 KB, 下载次数: 202

评分

参与人数 1威望 +72 收起 理由
kook + 72 优秀演示

查看全部评分

发表于 2008-10-4 12:38:14 | 显示全部楼层
看了Jass就头晕,看你写的那么辛苦支持一下
回复

使用道具 举报

 楼主| 发表于 2008-10-4 13:02:53 | 显示全部楼层
这个……………………………………
支持……………………………………
怎么我离开GA一个月,众人的口头禅就变了??…………………………
看来我家没网线还真是个问题……………………
回复

使用道具 举报

发表于 2008-10-13 16:51:03 | 显示全部楼层
能不能稍微介绍下 这个是干嘛的
回复

使用道具 举报

发表于 2008-10-14 18:43:57 | 显示全部楼层
光环模版,比如:致命,闪避,复活.等的光环技能.
回复

使用道具 举报

发表于 2008-10-21 17:08:37 | 显示全部楼层
哦 看起来不错哦
回复

使用道具 举报

发表于 2008-11-8 15:19:55 | 显示全部楼层
好。。好屌!
回复

使用道具 举报

w
发表于 2008-11-15 01:03:17 | 显示全部楼层
单位同时处在多个有光环的英雄影响之下,而且这些英雄们,光环的等级又不一样呢??

比如:
if GetUnitState( AuraUnit, UNIT_STATE_LIFE ) <= 0.0 then
          call ForGroup( Targets, function Aura_RemoveAbility )
不能英雄死了就删光环吧,人家还可能受到别的英雄的保护呢。


还有:
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 )
万一人家现在受到一个更高等级的光环影响呢?


if GetUnitState( AuraUnit, UNIT_STATE_LIFE ) <= 0.0 then
(**
  *这个用法很强大, 我以前怕麻烦,以为是找到死亡事件就关闭触发呢,
  *后来才知道,挂掉了,身上有重生,是不产生死亡事件的,要看HP。。。
  *)

还一下,那个光环的魔法书,不用disable么?   不disable好像会有一个可恶的图标的吧。

还有一个,我没试过。 wc3c那些家伙说是loop group比forgroup高效。
(这个可以无视,反正缓存都用了,这个就不用管了。。)
回复

使用道具 举报

w
发表于 2008-11-15 01:05:17 | 显示全部楼层
引用第2楼血戮魔动冰于2008-10-04 13:02发表的  :
这个……………………………………
支持……………………………………
怎么我离开GA一个月,众人的口头禅就变了??…………………………
看来我家没网线还真是个问题……………………


嗯,我的口头禅还是: 倒塌啊。。。
回复

使用道具 举报

w
发表于 2008-11-15 01:06:04 | 显示全部楼层
回复

使用道具 举报

w
发表于 2008-11-15 01:06:34 | 显示全部楼层
三连会死人的。 但四连不会。
回复

使用道具 举报

发表于 2009-2-11 11:06:35 | 显示全部楼层
朋友,别累坏了!
回复

使用道具 举报

发表于 2009-2-11 11:12:19 | 显示全部楼层
J盲飘过
回复

使用道具 举报

发表于 2009-3-5 13:54:23 | 显示全部楼层
8楼说得我都不敢用了.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-5-2 20:19 , Processed in 0.120306 second(s), 25 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表