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():