From 0c1ce5b4e25a879e3836433bbd4e127aa367d7cb 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: Thu, 28 Aug 2025 11:26:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=99=90=E5=88=B6=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E7=9A=84=E6=9C=80=E5=A4=A7=E5=80=BC=E4=BB=A5?= =?UTF-8?q?=E9=98=B2=E6=AD=A2=E6=95=B0=E5=80=BC=E6=BA=A2=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在FieldStore.gd中添加entityMaxValueMap定义各字段的最大值 在Feed.gd中应用clamp确保字段值不超过定义的最大值 --- scripts/Structs/Feed.gd | 1 + scripts/Tools/FieldStore.gd | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/scripts/Structs/Feed.gd b/scripts/Structs/Feed.gd index 99f8acc..ad75e2c 100644 --- a/scripts/Structs/Feed.gd +++ b/scripts/Structs/Feed.gd @@ -71,6 +71,7 @@ func apply(entity: EntityBase): var applier = FieldStore.entityApplier.get(field, null) if !applier or applier.call(entity, value): entity.fields[field] += value + entity.fields[field] = clamp(entity.fields[field], 0, FieldStore.entityMaxValueMap.get(field, INF)) hide() selected.emit(allHave) return allHave diff --git a/scripts/Tools/FieldStore.gd b/scripts/Tools/FieldStore.gd index d58ddb5..b4f658c 100644 --- a/scripts/Tools/FieldStore.gd +++ b/scripts/Tools/FieldStore.gd @@ -69,6 +69,14 @@ static var entityMapType = { Entity.MAX_ENERGY: DataType.VALUE, Entity.LUCK_VALUE: DataType.VALUE } +static var entityMaxValueMap = { + Entity.CRIT_RATE: 1, + Entity.PENERATE: 1, + Entity.PENARATION_RESISTANCE: 1, + Entity.PRICE_REDUCTION: 0.8, + Entity.DROP_APPLE_RATE: 0.5, + Entity.FEED_COUNT_SHOW: 6 +} static var entityApplier = { Entity.MAX_HEALTH: func(entity, value): entity.health += value