fix(shop): can_buy_attribute 同样校验属性已接线;订正路线图残留表述

购买路径是独立守门人:货架 B / 出售退款等后来者会直接调 can_buy_attribute
而不必先过 get_sellable_attrs,只在展示侧拦截不足以保住不变量。未接线属性
生效值恒为 0,_at_soft_cap 因此永不封顶,可被无限买成空气。

同时把路线图第 99 行残留的「加属性零代码」括注收敛到下一条 ⚠️ 订正,避免
同一条目里两句话互相矛盾。
This commit is contained in:
2026-08-03 13:02:20 +08:00
parent ce4ce2b392
commit 06f0049221
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -164,6 +164,11 @@ func can_buy_attribute(attr_id: String) -> String:
var sp = d.get("shop", null)
if not (sp is Dictionary):
return "该属性不可购买"
# 与 get_sellable_attrs 同一条不变量,须在此再判一次:UI 只列可售项,但本函数是购买路径的
# 独立守门人(货架 B / 出售退款等后来者会直接调它,未必先过 get_sellable_attrs)。
# 缺这条则未接线属性可被买成空气,且 _at_soft_cap 因生效值恒为 0 永不封顶 → 可无限购买
if not PlayerStats.has_attr(attr_id):
return "该属性不可购买"
if _at_soft_cap(attr_id, d):
return "已达上限"
if PlayerStats.gold < get_attr_price(attr_id):