效果函数¶
GetMaxEffect(aIndex)¶
返回对象可拥有的最大效果槽位数。
AddEffect(lpObj, type, index, count, v1, v2, v3, v4, v5, v6, buffSendValue, attackerIndex, rmv)¶
为对象添加 Buff/Debuff 效果。
- 参数:
lpObj(GameObject) — 目标对象type(number) — 效果类型(0 或 1)index(number) — 效果 IDcount(number) — 持续时间(秒)或次数v1..v6(number) — 效果数值(伤害、防御等)buffSendValue(number) — 客户端 Buff 图标值attackerIndex(number) — 效果来源的索引rmv(number) — 成功几率(0-100),-1 表示必定成功- 返回值:
number— 成功返回 1,失败返回 0
-- 添加 +50 物理伤害 Buff,持续 60 秒,必定成功
AddEffect(player, 1, 15, 60, 50, 0, 0, 0, 0, 0, 0, player.Index, -1)
DelEffect(lpObj, index)¶
按效果 ID 移除指定效果。
- 返回值:
boolean
DelEffectByGroup(lpObj, group)¶
移除属于指定组的所有效果。
- 返回值:
boolean
GetEffect(lpObj, index)¶
返回指定效果 ID 的 GameCEffect 对象,未找到则返回 nil。
local eff = GetEffect(player, 1)
if eff then
LogAdd(LOG_RED, "Poison remaining: " .. eff.m_time .. "s")
end
GetEffectByGroup(lpObj, group)¶
返回指定组中的第一个 GameCEffect,未找到则返回 nil。
local scroll = GetEffectByGroup(player, 20)
if scroll then
LogAdd(LOG_BLUE, "Scroll value: " .. scroll.m_value[1])
end
CheckEffect(lpObj, index)¶
对象拥有该效果时返回 true。
if CheckEffect(target, 16) then -- Mana Shield
LogAdd(LOG_BLUE, "Target has Mana Shield active.")
end
CheckEffectByGroup(lpObj, group)¶
对象拥有指定组中任一效果时返回 true。
if CheckEffectByGroup(player, 35) then
GCNoticeSend(player.Index, 1, "You already have an event buff.")
end
CheckStunEffect(lpObj)¶
对象处于眩晕状态时返回 true。
CheckImmobilizeEffect(lpObj)¶
对象处于定身状态时返回 true。
if CheckImmobilizeEffect(player) then
GCNoticeSend(player.Index, 1, "You are frozen and cannot move!")
end
CheckDebuffSend(index)¶
指定效果索引为客户端显示的 Debuff 时返回 true。
ClearAllEffect(lpObj)¶
移除对象的所有效果。
ClearDebuffEffect(lpObj, count)¶
移除对象最多 count 个 Debuff 效果。
UpgradeDamageByClass(lpObj)¶
根据角色职业和属性计算并返回伤害加成。
- 返回值:
number
Help