bayuMIR/Mirserver/Mir200/Envir/QuestDiary/游戏功能/A1_一大陆/神兽淬体.lua
2026-06-18 02:06:14 +08:00

169 lines
4.3 KiB
Lua

ShenShouCuiTiOBJ = Up_BaseClass:new()
ShenShouCuiTiOBJ._name = "ShenShouCuiTiOBJ"
-- NPCID
ShenShouCuiTiOBJ.id = { 5 }
for i, v in ipairs(ShenShouCuiTiOBJ.id or {}) do
Npc.clicknpcCfg[v] = ShenShouCuiTiOBJ
end
-- 配置文件
ShenShouCuiTiOBJ.cfg = {
att = {
[1] = {
n = "青龙",
x = "神兽之血",
t = { "药品回复", 0.5 },
str = "青龙和白虎均达到10级后解锁护体神盾",
effectid = 1459,
effectpos = { 180, 185 },
where = 75,
skill = {
id = { 1, 2 },
magic = {
"护体神盾", 3
},
},
},
[2] = {
n = "白虎",
x = "神兽之骨",
t = { "对怪增伤", 1 },
str = "青龙和白虎均达到10级后解锁护体神盾",
effectid = 1460,
effectpos = { 120, 145 },
where = 76,
skill = {
id = { 1, 2 },
magic = {
"护体神盾", 3
},
},
},
[3] = {
n = "朱雀",
x = "神兽之精",
t = { "基础攻击力", 1 },
str = "朱雀和玄武均超过10级后解锁十步一杀",
effectid = 1461,
effectpos = { 120, 145 },
where = 77,
skill = {
id = { 3, 4 },
magic = {
"十步一杀", 3
},
},
},
[4] = {
n = "玄武",
x = "神兽之丹",
t = { "伤害减免", 1 },
str = "朱雀和玄武均超过10级后解锁十步一杀",
effectid = 1462,
effectpos = { 120, 145 },
where = 78,
skill = {
id = { 3, 4 },
magic = {
"十步一杀", 3
},
},
},
},
cl = { 10, 30, 50, 70, 100, 150, 150, 200, 300, 500, 800, 1200, 1700, 2300, 3000, 3700, 4500, 5400, 6400, 7500 },
xh = {
{ "金币", 10000, 1 },
--{脚本增加每个x的名字}
},
}
---* 加入上线同步数据
Player.sycCfg[ShenShouCuiTiOBJ._name] = ShenShouCuiTiOBJ.cfg
function ShenShouCuiTiOBJ:up(actor, p1, p2, p3, data)
local id = data[1]
if not id or not Npc.CheckNPCRange(actor, 5) then
return
end
local cfg = self.cfg.att[id]
local level = Player.getkeycount(actor, VarCfg.Player.str["神兽淬体"], id) or 0
if level >= #self.cfg.cl then
Func.sendmsg9(actor, "[神兽淬体]:#70|当前淬体已满级!")
return
end
local xh = table.Copy(self.cfg.xh)
table.insert(xh, { cfg.x, self.cfg.cl[level + 1], 0 })
if Func.takeitmes(actor, xh, true, true) then
local title_name = cfg.n
local itemobj = GetItemByPos(actor, cfg.where)
if delitembymakeindex(actor, itemobj, 1, "神兽淬体升级") then
giveonitem(actor, cfg.where, string.format("%s淬体Lv.%d", title_name, level + 1), 1, 0, "神兽淬体升级")
Player.setkeycount(actor, VarCfg.Player.str["神兽淬体"], id, level + 1)
self:addMagick(actor, id)
end
-- if level > 0 then
-- deprivetitle(actor, string.format("%s淬体Lv.%d", title_name, level))
-- end
-- confertitle(actor, string.format("%s淬体Lv.%d", title_name, level + 1), 0)
-- Player.setkeycount(actor, VarCfg.Player.str["神兽淬体"], id, level + 1)
-- ---* 检测双项增加技能
-- self:addMagick(actor, id)
end
end
function ShenShouCuiTiOBJ:addMagick(actor, id)
local cfg = self.cfg.att[id].skill
if not cfg then
return
end
local magick_id = getskillindex(cfg.magic[1])
if getskillinfo(actor, magick_id, 1) ~= nil then
return
end
local _str = {}
local g_level_num = 0
for i, v in ipairs(cfg.id) do
local level = Player.getkeycount(actor, VarCfg.Player.str["神兽淬体"], v) or 0
if level >= 10 then
table.insert(_str, self.cfg.att[v].n)
g_level_num = g_level_num + 1
end
end
if g_level_num >= #cfg.id then
addskill(actor, magick_id, cfg.magic[2])
Func.sendmsg9(actor, string.format("[神兽淬体]:#70|%s均已达到10级,获得技能:%s", table.concat(_str, ""), cfg.magic[1]))
end
end
ShenShouCuiTiOBJ.allowFunc = {"up"}
return ShenShouCuiTiOBJ