一键治疗宏(全职业)
2026年6月8日大约 7 分钟
一键治疗宏(全职业通用)
第一步:打开黑兔客户端 → 点击"超级宏" → 新建一个宏 → 把下面代码粘贴进去。
第二步:在游戏里创建一个普通宏,全团治疗用 /s S HealRaid(),本小队治疗用 /s S HealRaidP(),绑到按键上使用。
-- ============================================================
-- 配 置 区(按需修改) 一键奶四大核心功能在下面 宏太长请仔细寻找
-- ============================================================
-- 是否输出治疗调试信息(true=打印,false=静默)
local CFG_DEBUG_HEAL = false
-- 是否同时治疗宠物(true=开启,false=关闭)
local CFG_INCLUDE_PETS = false
-- 优先目标最低血量缺口,低于此值不奶
local CFG_PRIORITY_MIN_LOST = 100
-- 优先目标数组(通过 HealRaid_AddTarget() 添加)
local CFG_priorityTargets = {}
-- 治疗等级配置,按优先级从高到低排列
-- minLost: 最低血量缺口 maxDist: 最大施法距离(码)
-- spellId: 技能ID name: 技能名称(仅用于调试输出)
-- noAura: 跳过已持有该光环的目标(如恢复/回春),0=不判断
-- 注意:血量缺口相同的等级,靠前的优先级更高
-- 每次调用根据当前职业重新获取治疗等级配置
function GetCfgLevels()
local me = GetMeInfo()
local classId = me and me.classId or 0
if classId == 2 then -- 圣骑士
-- 60级策略:圣骑士不缺蓝全用满级
return {
{ minLost = 2000, maxDist = 40, spellId = 25292, name = "圣光术(满级)", noAura = 0 },
{ minLost = 100, maxDist = 40, spellId = 19943, name = "圣光闪现(满级)", noAura = 0 },
}
elseif classId == 5 then -- 牧师
-- 60级策略:治疗术R2是牧师最知名下级治疗,强效治疗术给坦克,快速治疗应急
return {
{ minLost = 5000, maxDist = 40, spellId = 10929, name = "恢复(满级)", noAura = 10929 }, -- 目标没有恢复,就先上恢复
{ minLost = 5000, maxDist = 40, spellId = 10965, name = "强效治疗术(满级)", noAura = 0 },
{ minLost = 1500, maxDist = 40, spellId = 6064, name = "治疗术(等级4)", noAura = 0 },
{ minLost = 1000, maxDist = 40, spellId = 9474, name = "快速治疗(4级)", noAura = 0 },
{ minLost = 500, maxDist = 40, spellId = 2055, name = "治疗术(等级2)", noAura = 0 },
{ minLost = 1, maxDist = 40, spellId = 2054, name = "治疗术(等级1)", noAura = 0 },
}
elseif classId == 7 then -- 萨满
-- 60级策略:治疗链自动跳转智能团刷,治疗波给坦克,次级治疗波快速抬血
return {
{ minLost = 5000, maxDist = 40, spellId = 25357, name = "治疗波(满级)", noAura = 0 },
{ minLost = 1000, maxDist = 40, spellId = 10622, name = "治疗链(等级2)", noAura = 0 },
{ minLost = 1, maxDist = 40, spellId = 1064, name = "治疗链(等级1)", noAura = 0 },
}
elseif classId == 11 then -- 德鲁伊
-- 60级策略:治疗之触R4是德鲁伊最省蓝下级治疗,R11满级给坦克,愈合应急+HOT
return {
{ minLost = 5000, maxDist = 40, spellId = 25299, name = "回春(满级)", noAura = 25299 }, -- 如果没有回春,就先套回春
{ minLost = 5000, maxDist = 40, spellId = 25297, name = "治疗之触(满级)", noAura = 0 },
{ minLost = 1500, maxDist = 40, spellId = 5188, name = "治疗之触(等级4)", noAura = 0 },
{ minLost = 1000, maxDist = 40, spellId = 8941, name = "愈合(等级5)", noAura = 0 },
{ minLost = 500, maxDist = 40, spellId = 8938, name = "愈合(等级2)", noAura = 0 },
{ minLost = 1, maxDist = 40, spellId = 8936, name = "愈合(等级1)", noAura = 0 },
}
end
return {}
end
-- ============================================================
-- =================一键奶四大核心功能 1.【将当前目标加入优先列表 】=========================
-- 使用方式: 做一个指定优先人员宏:/s S HealRaid_AddTarget() 鼠标选中人员点一下宏,就加入了优先列表
function HealRaid_AddTarget()
local info = GetMeInfo()
if not info or not info.targetGuid or info.targetGuid == "0" then
print("请先选中一个目标")
return
end
local tInfo = GetUnitInfo(info.targetGuid)
if not tInfo then
print("无法获取目标信息")
return
end
-- 去重检查:目标已在列表中则提示并返回当前数量
for _, guid in ipairs(CFG_priorityTargets) do
if guid == info.targetGuid then
print("目标已在优先列表中: " .. tInfo.name .. ",当前共 " .. #CFG_priorityTargets .. " 个优先目标")
return
end
end
table.insert(CFG_priorityTargets, info.targetGuid)
print("已添加优先目标: " .. tInfo.name .. " (guid=" .. info.targetGuid .. "),当前共 " .. #CFG_priorityTargets .. " 个优先目标")
end
-- =================一键奶四大核心功能 2.【清空所有优先目标】=========================
-- 使用方式:做一个宏:/s S HealRaid_ClearTargets() ,按一下就清空前面指定优先人员名单
function HealRaid_ClearTargets()
local count = #CFG_priorityTargets
CFG_priorityTargets = {}
print("已清空" .. count .. "个优先目标")
end
-- 记录上次治疗的目标,用于再次按键时判断是否需要取消施法
local CFG_lastHealTarget = nil
-- ============================================================
-- 通用扫描治疗函数:按 LEVELS 优先级遍历 scanList,对符合条件的目标施法
-- scanList: 形如 { { guid="xxx" }, ... } 的数组
-- minLostThreshold: 额外的最低血量缺口阈值,0=不限制
-- logPrefix: 调试输出的前缀(如 "优先治疗" / "治疗")
-- 返回 true 表示已施法,false 表示无合适目标
-- ============================================================
function TryHealScan(scanList, minLostThreshold, logPrefix)
minLostThreshold = minLostThreshold or 0
for _, lv in ipairs(GetCfgLevels()) do
local bestLost = 0
local bestInfo = nil
local bestGuid = ""
for _, m in ipairs(scanList) do
local guid = type(m) == "table" and m.guid or m
local info = GetUnitInfo(guid)
if info and info.health > 0 and info.maxHealth > 0 then
local lost = info.maxHealth - info.health
if lost >= lv.minLost and lost >= minLostThreshold then
local dist = Distance(guid)
if dist <= lv.maxDist and lost > bestLost then
-- noAura 判断:跳过已有该光环的目标
local noAuraOk = true
if lv.noAura and lv.noAura ~= 0 then
if info.auras then
for _, aura in ipairs(info.auras) do
if aura.spellId == lv.noAura then
noAuraOk = false
break
end
end
end
end
if noAuraOk then
bestLost = lost
bestInfo = info
bestGuid = guid
end
end
end
end
end
if bestInfo ~= nil then
if CFG_DEBUG_HEAL then
print(logPrefix .. ": " .. bestInfo.name .. "[" .. lv.name .. "] 缺口:" .. bestLost .. " 距离:" .. math.floor(Distance(bestGuid)))
end
Spell(lv.spellId, bestGuid)
CFG_lastHealTarget = bestGuid
return true
end
end
return false
end
-- ============================================================
-- =================一键奶四大核心功能 3.【自动奶全团】=========================
-- 使用方式:做一个宏:/s S HealRaid()
function HealRaid()
-- ============ 智能取消:如果上次治疗的目标已满血,取消当前施法 ============
if CFG_lastHealTarget then
local lastInfo = GetUnitInfo(CFG_lastHealTarget)
if lastInfo and lastInfo.health > 0 and lastInfo.health >= lastInfo.maxHealth then
StopCasting()
if CFG_DEBUG_HEAL then print("取消施法:" .. lastInfo.name .. " 已满血") end
CFG_lastHealTarget = nil
-- 继续往下扫描,寻找下一个需要治疗的队友
end
end
-- 每次根据当前职业重新获取治疗等级配置
local cfgLevels = GetCfgLevels()
if not cfgLevels or #cfgLevels == 0 then
if CFG_DEBUG_HEAL then print("一键奶:职业配置为空,请检查职业是否支持") end
return
end
-- ============ V6新功能:优先目标扫描 ============
-- 先扫描优先目标数组,只有血量缺口>=CFG_PRIORITY_MIN_LOST才奶
if CFG_priorityTargets and #CFG_priorityTargets > 0 then
if TryHealScan(CFG_priorityTargets, CFG_PRIORITY_MIN_LOST, "优先治疗") then
return
end
end
-- ==========================================
local me = GetMeInfo()
local members = TeamMembers()
-- ============ V5新增:不在团队时,把自己加入扫描列表 ============
local scanList = {}
if members and #members > 0 then
-- 在团队中,正常添加所有成员
for i, m in ipairs(members) do
scanList[#scanList + 1] = m
end
else
-- 不在团队,把自己加进去
if me and me.guid then
scanList[#scanList + 1] = { guid = me.guid, name = "(自己)" }
if CFG_DEBUG_HEAL then print("一键奶:不在团队中,仅治疗自己") end
end
end
-- 大团扫描
if not TryHealScan(scanList, 0, "治疗") then
if CFG_DEBUG_HEAL then print("无需治疗") end
end
end
-- =================一键奶四大核心功能 4.【自动奶自己所在小队】=========================
-- 使用方式:做一个宏:/s S HealRaidP()
function HealRaidP()
-- ============ 智能取消:如果上次治疗的目标已满血,取消当前施法 ============
if CFG_lastHealTarget then
local lastInfo = GetUnitInfo(CFG_lastHealTarget)
if lastInfo and lastInfo.health > 0 and lastInfo.health >= lastInfo.maxHealth then
StopCasting()
if CFG_DEBUG_HEAL then print("取消施法:" .. lastInfo.name .. " 已满血") end
CFG_lastHealTarget = nil
-- 继续往下扫描,寻找下一个需要治疗的队友
end
end
-- 每次根据当前职业重新获取治疗等级配置
local cfgLevels = GetCfgLevels()
if not cfgLevels or #cfgLevels == 0 then
if CFG_DEBUG_HEAL then print("一键奶:职业配置为空,请检查职业是否支持") end
return
end
-- ============ V6新功能:优先目标扫描 ============
-- 先扫描优先目标数组,只有血量缺口>=CFG_PRIORITY_MIN_LOST才奶
if CFG_priorityTargets and #CFG_priorityTargets > 0 then
if TryHealScan(CFG_priorityTargets, CFG_PRIORITY_MIN_LOST, "优先治疗") then
return
end
end
-- ==========================================
local me = GetMeInfo()
local members = TeamMembers()
-- ========= 核心修改:仅筛选【本小队】成员 =========
local scanList = {}
if members and #members > 0 then
-- 获取自己所在小队编号
local mySubGroup = nil
for _, m in ipairs(members) do
if m.guid == me.guid then
mySubGroup = m.subgroup
break
end
end
-- 只加入同小队成员
if mySubGroup ~= nil then
for _, m in ipairs(members) do
if m.subgroup == mySubGroup then
scanList[#scanList + 1] = m
end
end
end
else
-- 不在团队/小队,只治疗自己
if me and me.guid then
scanList[#scanList + 1] = { guid = me.guid, name = "(自己)" }
if CFG_DEBUG_HEAL then print("一键奶:不在团队中,仅治疗自己") end
end
end
-- 本小队扫描
if not TryHealScan(scanList, 0, "小队治疗") then
if CFG_DEBUG_HEAL then print("小队无需治疗") end
end
end