From 595acb2472a9c31dd1e6f2e91b7780d0d4bac7f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E7=88=B1=E5=90=83=E7=99=BD=E8=90=9D?= =?UTF-8?q?=E5=8D=9C?= Date: Wed, 6 May 2026 11:24:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=A1=80=E7=B2=BE?= =?UTF-8?q?=E7=9F=B3=E6=BB=A1=E5=85=85=E8=83=BD=E5=90=8E=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/components/aipc_oldone.lua | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/scripts/components/aipc_oldone.lua b/scripts/components/aipc_oldone.lua index b40f0a8f..676cebdd 100644 --- a/scripts/components/aipc_oldone.lua +++ b/scripts/components/aipc_oldone.lua @@ -24,17 +24,22 @@ local function OnIsDay(inst, isday) if factor > 0 then local pt = inst:GetPosition() - local stones = TheSim:FindEntities(pt.x, pt.y, pt.z, 0.1, { "aip_bloodstone" }) - local first = stones[1] - if first ~= nil and first.components.finiteuses ~= nil then - first.components.finiteuses:Use(-factor) - - if first.components.finiteuses:GetPercent() > 1 then - first.components.finiteuses:SetPercent(1) - end - end - end -end + local stones = TheSim:FindEntities(pt.x, pt.y, pt.z, 0.1, { "aip_bloodstone" }) + local first = stones[1] + if first ~= nil and first.components.finiteuses ~= nil then + local finiteuses = first.components.finiteuses + local maxUses = finiteuses.total + + -- 满充能时重复叠加会导致次数异常,直接按上限截断 + if maxUses ~= nil and maxUses > 0 then + local currUses = finiteuses:GetUses() + if currUses < maxUses then + finiteuses:SetUses(math.min(maxUses, currUses + factor)) + end + end + end + end +end ------------------------------- 组件 ------------------------------- local Oldone = Class(function(self, inst) @@ -90,4 +95,4 @@ function Oldone:OnLoad(data) end end -return Oldone \ No newline at end of file +return Oldone