feat(meta): 商店池按 unlock_cost/已解锁门控(_available_pool)
This commit is contained in:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user