找回密码
 点一下
查看: 2747|回复: 2

关于老狼教程中这段代码的意思是什么?

[复制链接]
发表于 2008-1-29 20:27:38 | 显示全部楼层 |阅读模式
[codes=jass]
function Trig_gamecache_TimerFunc takes nothing returns nothing
local integer iu = GetStoredInteger(udg_GC, I2S(h2i(GetExpiredTimer())), "DamagedUnit")
call UnitDamageTarget(i2u(GetStoredInteger(udg_GC, I2S(h2i(GetExpiredTimer())), "Caster")), i2u(iu), 10.0, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_LIGHTNING, WEAPON_TYPE_WHOKNOWS)
if GetUnitAbilityLevel(i2u(iu), 'BHtc') <= 0 then
call FlushStoredMission(udg_GC, I2S(h2i(GetExpiredTimer())))
call FlushStoredInteger(udg_GC, I2S(iu), "ThunderClapTimer")
call DestroyTimer(GetExpiredTimer())
endif
endfunction

function Trig_gamecache_FilterFunc takes nothing returns boolean
if GetUnitAbilityLevel(GetFilterUnit(), 'BHtc') > 0 and not HaveStoredInteger(udg_GC, I2S(h2i(GetFilterUnit())), "ThunderClapTimer") then
set bj_lastStartedTimer = CreateTimer()
call StoreInteger(udg_GC, I2S(h2i(GetFilterUnit())), "ThunderClapTimer", h2i(bj_lastStartedTimer))
call StoreInteger(udg_GC, I2S(h2i(bj_lastStartedTimer)), "DamagedUnit", h2i(GetFilterUnit()))
call StoreInteger(udg_GC, I2S(h2i(bj_lastStartedTimer)), "Caster", h2i(GetTriggerUnit()))
call TimerStart(bj_lastStartedTimer,1.0,true, function Trig_gamecache_TimerFunc)
endif
return false
endfunction

function Trig_gamecache_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'AHtc' then
call GroupEnumUnitsInRange(udg_TC_Group, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()),400, Condition(function Trig_gamecache_FilterFunc))
endif
return false
endfunction

function InitTrig_gamecache takes nothing returns nothing
set gg_trg_gamecache = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_gamecache, EVENT_PLAYER_UNIT_SPELL_FINISH)
call TriggerAddCondition(gg_trg_gamecache, Condition(function Trig_gamecache_Conditions))
endfunction
[/codes]
其中这一段
[codes=jass]
if GetUnitAbilityLevel(GetFilterUnit(), 'BHtc') > 0 and not HaveStoredInteger(udg_GC, I2S(h2i(GetFilterUnit())), "ThunderClapTimer")
[/codes]
选取单位'BHtc'技能等级大于0 并且选取单位没有被绑定特定计时器
AND后面的都好理解 这个'BHtc'是个什么技能啊?  判断选取单位这个技能等级大于0 到底有什么意义
发表于 2008-1-29 20:30:06 | 显示全部楼层
BHtc是某个buff的id,这句就是判断是否拥有buff
回复

使用道具 举报

发表于 2008-1-30 02:16:33 | 显示全部楼层
这个是判断单位身上有没有雷霆一击的buff~~

楼主只要明白~~

1]很多用于buff的函数同样能作用于技能~~反之亦然~~当然不是所有~~比如删除技能的函数同样可以用于删除buff~~但添加技能的函数却无法用于添加buff~~

2]buff也是有等级的~~这个等级等于施展这个buff的技能的等级~~通常来说单位身上有buff~~这个buff的等级显然就会在1级以上~~所以通常用这个方式来判断单位身上是否有buff~~单位身上是否有技能也一样~~当然这个法子并非最严密的~~因为实际上存在0级的技能~~不过一般情况下这样用没有任何问题~~
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-18 23:28 , Processed in 0.051962 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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