From 7682480a5fa2445a2b9e634f25d37122af2baf82 Mon Sep 17 00:00:00 2001 From: Joywayer Date: Tue, 21 Jul 2026 11:45:32 +0800 Subject: [PATCH] =?UTF-8?q?feat(meta):=20=E5=95=86=E5=BA=97=E6=B1=A0?= =?UTF-8?q?=E6=8C=89=20unlock=5Fcost/=E5=B7=B2=E8=A7=A3=E9=94=81=E9=97=A8?= =?UTF-8?q?=E6=8E=A7=EF=BC=88=5Favailable=5Fpool=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/autoloads/shop_manager.gd | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/autoloads/shop_manager.gd b/scripts/autoloads/shop_manager.gd index 6c75d4b..3d34f27 100644 --- a/scripts/autoloads/shop_manager.gd +++ b/scripts/autoloads/shop_manager.gd @@ -30,11 +30,17 @@ func open_shop(seed_override: int = -1) -> void: _refresh_slots() EventBus.emit(EventID.SHOP_OPENED, {"seed": _shop_seed}) -func _refresh_slots() -> void: - # 纯数据驱动池:SpellRegistry(data/spells.json)中可购买(shop_cost>0)的法术 - var pool: Array = SpellRegistry.get_all_ids().filter(func(id): +## 商店可抽池:shop_cost>0 且(未门控 unlock_cost==0 或 已解锁) +func _available_pool() -> Array: + return SpellRegistry.get_all_ids().filter(func(id): var s: SpellNode = SpellRegistry.get_spell(id) - return s != null and int(s.meta.get("shop_cost", 0)) > 0) + if s == null or int(s.meta.get("shop_cost", 0)) <= 0: + return false + var uc: int = int(s.meta.get("unlock_cost", 0)) + return uc == 0 or MetaProgress.is_unlocked(id)) + +func _refresh_slots() -> void: + var pool: Array = _available_pool() current_slots.clear() for _i in SLOT_COUNT: if pool.is_empty():