-- 定义变量
local target = currTarget
local itemList = {"天霜神剑", "雷鸣神剑", "春晖神剑", "夏弦神剑", "秋杀神剑", "残冬神剑", "昀霜「羽化」剑", "灵虚「九霄」神剑", "幻想|断仙|神剑"}
-- 检查是否有目标
if (target == nil) then
return
end
-- 检查玩家是否持有特定武器
for i, itemName in ipairs(itemList) do
if (checkItemW(itemName, 1)) then
-- 触发BUFF特效
if (random(1, 100) <= 50) then
-- 扣除对方生命
local reduceHP = math.floor(target.HumanHP * 0.01 * i)
if (reduceHP > 0) then
target.HumanHP = target.HumanHP - reduceHP
sendCenterMsg(249, 0, "(重伤):您触发了'" .. itemName .. "'·BUFF特效,将玩家'" .. userName .. "'的生命减少百分之" .. i .. "!", 0, 3)
target.SendCenterMsg(249, 0, "对方的[" .. itemName .. "]触发:使你的生命减少百分之" .. i .. "!", 0, 3)
end
end
break
end
end
Copy
以上代码实现了使用特定武器时触发BUFF特效,对对方造成固定百分比的生命值减少。具体实现方式如下: