From 8137b398a9587107ebe7fce410ca003ad2ce0eb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=A8=E8=90=BD=E5=9F=BA=E5=9B=B4=E8=99=BE?= <3161880837@qq.com> Date: Mon, 4 May 2026 21:52:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(Feed):=20=E4=BF=AE=E5=A4=8D=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=BA=94=E7=94=A8=E9=80=BB=E8=BE=91=E5=B9=B6=E7=A1=AE?= =?UTF-8?q?=E4=BF=9D=E6=95=B0=E5=80=BC=E8=8C=83=E5=9B=B4=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 调整字段值应用顺序,先增加值再检查applier回调。如果applier存在且返回true,则减去之前增加的值。最后确保所有字段值在有效范围内。 --- scripts/Structs/Feed.gd | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/Structs/Feed.gd b/scripts/Structs/Feed.gd index 882a9b2..0dcb86d 100644 --- a/scripts/Structs/Feed.gd +++ b/scripts/Structs/Feed.gd @@ -49,10 +49,11 @@ func apply(entity: EntityBase): for i in range(min(fields.size(), fieldValues.size())): var field = fields[i] var value = fieldValues[i] + entity.fields[field] += value var applier = FieldStore.entityApplier.get(field) - if !applier or applier.call(entity, value): - entity.fields[field] += value - entity.fields[field] = clamp(entity.fields[field], FieldStore.entityMinValueMap.get(field, 0), FieldStore.entityMaxValueMap.get(field, INF)) + if applier and applier.call(entity, value): + entity.fields[field] -= value + entity.fields[field] = clamp(entity.fields[field], FieldStore.entityMinValueMap.get(field, 0), FieldStore.entityMaxValueMap.get(field, INF)) for i in weapons: var instance = i.instantiate() as Weapon if UIState.player.weaponBag.has(instance.displayName):