LUACN论坛

 找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
热搜: YJWOW MagicStone BoL
查看: 26896|回复: 13

[函数] 判断自己释放的buff和debuff

[复制链接]
发表于 2014-4-13 00:44:53 | 显示全部楼层 |阅读模式
  1. local type = type
  2. local pairs = pairs
  3. local UnitBuff = UnitBuff
  4. local UnitDebuff = UnitDebuff

  5. function UnitAura(unit, aura, harmful, mine)
  6.         if type(aura) ~= "string" then
  7.                 return
  8.         end

  9.         local func = harmful and UnitDebuff or UnitBuff
  10.         if mine then
  11.                 return func(unit or "target", aura, nil, "PLAYER")
  12.         else
  13.                 return func(unit or "target", aura)
  14.         end
  15. end

  16. function PlayerBuff(aura, mine)
  17.         return UnitAura("player", aura, nil, mine)
  18. end

  19. function PlayerDebuff(aura, mine)
  20.         return UnitAura("player", aura, 1, mine)
  21. end

  22. function TargetBuff(aura, mine)
  23.         return UnitAura("target", aura, nil, mine)
  24. end

  25. function TargetDebuff(aura, mine)
  26.         return UnitAura("target", aura, 1, mine)
  27. end
复制代码


使用示例
  1. /if PlayerBuff(战斗怒吼)==nil
  2. /cast 战斗怒吼
  3. /if TargetDebuff(巨人打击)==nil
  4. /cast 巨人打击
复制代码
回复

使用道具 举报

发表于 2014-4-15 06:02:44 | 显示全部楼层
小红猫 发表于 2014-4-14 23:59
我LUA不怎么会,能请教下。
local type = type
local pairs = pairs

作用域不同,这样写效率高一点
回复 支持 反对

使用道具 举报

发表于 2014-4-14 23:59:26 | 显示全部楼层
我LUA不怎么会,能请教下。
local type = type
local pairs = pairs
local UnitBuff = UnitBuff
这样写是啥意思不。

点评

只需要设置一次 然后其他地方都可以用到  发表于 2014-4-15 05:46 PM
这样是全局的。  发表于 2014-4-15 04:09 PM
回复 支持 反对

使用道具 举报

发表于 2014-8-21 05:07:49 | 显示全部楼层
每一个帖子里都能学到东西,所以每一个帖子都要回复,并表示感谢。
回复 支持 反对

使用道具 举报

发表于 2014-4-14 11:07:27 | 显示全部楼层
这个不错,学习下
回复 支持 反对

使用道具 举报

发表于 2014-4-15 15:38:53 | 显示全部楼层
自身的BUFF 不是很好判斷嗎
回复 支持 反对

使用道具 举报

发表于 2014-8-23 17:31:29 | 显示全部楼层
学习到了,谢谢
回复 支持 反对

使用道具 举报

发表于 2014-8-29 14:38:51 来自手机 | 显示全部楼层
yj里面的方案是用lua吗  那am函数是哪里的
回复 支持 反对

使用道具 举报

发表于 2014-9-25 01:37:02 | 显示全部楼层
顶贴赚金币!!!!!!!!
回复 支持 反对

使用道具 举报

发表于 2017-1-16 10:28:25 | 显示全部楼层
每个帖子都学习到了,感谢!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 加入我们

本版积分规则

小黑屋|手机版|Archiver|LUACN论坛

GMT+8, 2024-4-20 04:32 AM , Processed in 0.070048 second(s), 34 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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