Appearance
状态模块管理接口 Buff
具体函数名及描述如下:
序号 | 函数名 | 函数描述 |
---|---|---|
1 | AddBuff(...) | 给对象附加效果 |
2 | RemoveBuff(...) | 给对象移除指定效果 |
3 | ClearAllBuff(...) | 给对象清除所有效果 |
4 | ClearAllBadBuff(...) | 为对象清除所有负面效果 |
5 | ClearAllGoodBuff(...) | 为对象清除所有有益效果 |
6 | HasBuff(...) | 判断对象身上是否有指定效果 |
7 | GetBuffLeftTime(...) | 获取对象身上指定效果剩余时间 |
8 | GetBuffDefName(...) | 获取状态效果名称 |
9 | GetBuffDefDesc(...) | 获取状态效果描述 |
10 | ReplaceBuff(...) | 替换已有状态 |
AddBuff
- 参数及类型:
- 返回值及类型:
- ret:
bool
成功(true)
- ret:
- 该方法的主要作用: 给对象附加效果
- 具体使用案例如下:
lua
Buff:AddBuff(playerId,4001, 20)
RemoveBuff
lua
local isRemoveSuccess = Buff:RemoveBuff(playerId, "r5_7483041204932402166_23045")
ClearAllBuff
lua
local isSuccess = Buff:ClearAllBuff(playerId)
ClearAllBadBuff
lua
local isSuccess = Buff:ClearAllBadBuff(playerId)
ClearAllGoodBuff
lua
local isSuccess = Buff:ClearAllGoodBuff(playerId)
HasBuff
- 参数及类型:
- 返回值及类型:
- ret:
bool
成功(true)
- ret:
- 该方法的主要作用: 判断对象身上是否有指定效果
- 具体使用案例如下:
lua
local isHasBuff = Buff:HasBuff(playerId, 4001)
GetBuffLeftTime
- 参数及类型:
- objid:
number
对象ID - buffid:number,string效果ID
- objid:
- 返回值及类型:
- ret:
number
剩余时间(秒 - 0表示永久)
- ret:
- 该方法的主要作用: 获取对象身上指定效果剩余时间
- 具体使用案例如下:
lua
local time = Buff:GetBuffLeftTime(playerId, 4001)
GetBuffDefName
- 参数及类型:
- buffid:number,string效果ID
- 返回值及类型:
- ret:
string
效果名称
- ret:
- 该方法的主要作用: 获取状态效果名称
- 具体使用案例如下:
lua
local name = Buff:GetBuffDefName(4001)
GetBuffDefDesc
- 参数及类型:
- buffid:number,string效果ID
- 返回值及类型:
- ret:
string
状态效果描述
- ret:
- 该方法的主要作用: 获取状态效果描述
- 具体使用案例如下:
lua
local desc = Buff:GetBuffDefDesc(4001)
ReplaceBuff
- 参数及类型:
- 返回值及类型:
- ret:
boolean
替换成功(true)或失败(false)
- ret:
- 该方法的主要作用: 替换已有状态
- 具体使用案例如下:
lua
local isSuccess = Buff:ReplaceBuff(playerId, 4001, "r5_7483041204932402166_23045", 10)