feat(meta): 商店池按 unlock_cost/已解锁门控(_available_pool)

This commit is contained in:
2026-07-21 11:45:32 +08:00
parent 427147d09d
commit 7682480a5f
+10 -4
View File
@@ -30,11 +30,17 @@ func open_shop(seed_override: int = -1) -> void:
_refresh_slots() _refresh_slots()
EventBus.emit(EventID.SHOP_OPENED, {"seed": _shop_seed}) EventBus.emit(EventID.SHOP_OPENED, {"seed": _shop_seed})
func _refresh_slots() -> void: ## 商店可抽池:shop_cost>0 且(未门控 unlock_cost==0 或 已解锁)
# 纯数据驱动池:SpellRegistrydata/spells.json)中可购买(shop_cost>0)的法术 func _available_pool() -> Array:
var pool: Array = SpellRegistry.get_all_ids().filter(func(id): return SpellRegistry.get_all_ids().filter(func(id):
var s: SpellNode = SpellRegistry.get_spell(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() current_slots.clear()
for _i in SLOT_COUNT: for _i in SLOT_COUNT:
if pool.is_empty(): if pool.is_empty():