Lua接口/状态效果

来自天龙知识库
雪舞留言 | 贡献2026年9月12日 (六) 13:37的版本 (维护服务端 Lua 接口:核对参数、返回值、边界条件与调用示例)
跳到导航跳到搜索

首页 · 服务端接口 · 调用约定

查询、施加与移除角色单位的增益 / 减益(Impact)效果。效果编号(impactDataIndex)来自效果表,集合编号(collectionId)来自效果集合配置。

查询

接口 参数与返回
LuaFnHaveImpactOfSpecificDataIndex sceneId, selfId, dataIndex → 是否拥有该效果;失败 -1。
LuaFnHaveImpactInSpecificCollection sceneId, selfId, collectionId → 是否拥有集合中任一效果;失败 -1。

LuaFnHaveImpactInSpecificCollection 只要角色拥有该集合中的**任一**效果即返回真值,用于判断一组互斥或同类效果。

施加

接口 参数与返回
LuaFnSendSpecificImpactToUnit sceneId, nSelfID, nSenderID, nTargetID, nImpactDataIndex, nDelayTime → 返回值;失败 -1。
LuaFnSendSpecificImpactBySkillToUnit sceneId, selfId, senderId, targetId, impactDataIndex, delayTime → 返回值;失败 -1。
LuaFnSendImpactAroundPosition sceneId, selfId, x, z, radius, standFlag, levelRequire, effectCount, impact, delayTime → 10 个参数;失败 -1。

LuaFnSendSpecificImpactToUnitLuaFnSendSpecificImpactBySkillToUnit 都是 6 个参数,区别是后者按战斗结算规则处理(命中、抗性等)。LuaFnSendImpactAroundPosition 需要 10 个参数,在指定坐标按半径和筛选条件对范围内角色施加效果。

移除

接口 参数与返回
LuaFnCancelSpecificImpact sceneId, nSelfID, nImpactDataIndex → 返回值;失败 -1。
LuaFnDispelAllHostileImpacts sceneId, selfId → 部分分支无返回值。
LuaFnCancelMoveSpeedBuff sceneId, selfId → 1 成功、-1 失败。
LuaFnIsModelOrMount sceneId, selfId → 是否有模型替换或坐骑修正;失败 -1。

LuaFnCancelSpecificImpact 移除指定编号的效果,LuaFnDispelAllHostileImpacts 清除全部敌对效果(部分分支无返回值)。LuaFnIsModelOrMount 判断人物当前是否具有模型替换或坐骑模型修正。

查询并移除效果

local has = LuaFnHaveImpactOfSpecificDataIndex(sceneId, selfId, dataIndex)
if type(has) == "number" and has ~= -1 then
    LuaFnCancelSpecificImpact(sceneId, selfId, dataIndex)
end

LuaFnHaveImpactOfSpecificDataIndex 失败返回 -1,先判类型再排除 -1。

施加效果

LuaFnSendSpecificImpactToUnit(sceneId, selfId, senderId, targetId, impactDataIndex, delayTime)
-- 6 个参数;失败 -1

LuaFnSendSpecificImpactToUnit 需要 6 个参数。要按战斗结算规则(含命中与抗性)施加,改用 LuaFnSendSpecificImpactBySkillToUnit

相关主题

服务端调用约定 · 服务端调用示例 · 服务端函数索引

函数不存在或提示 nil · 参数类型与顺序 · 返回值判断 · 对象 ID 与 GUID

本页函数签名与返回约定依据当前服务端注册表整理;sceneId、selfId 由实际回调提供,业务枚举、属性类型编号与运行效果需要实测。