feat(mana): balance.json mana_heat/infinite_spells 配置 + SettingsManager getters

This commit is contained in:
2026-07-21 15:09:28 +08:00
parent ea01ff1939
commit 7025f283f8
2 changed files with 17 additions and 1 deletions
+14
View File
@@ -34,6 +34,8 @@ func complete_ftue(chosen_difficulty: int) -> void:
var _MULTS: Dictionary = {} # key → [初学者, 标准, 挑战]
var _BOSS_HP: Dictionary = {} # 原型→基础血量
var _AETHER_THRESHOLDS: Array = [] # [[到达波次, 碎片], ...] 升序
var _MANA_HEAT: Dictionary = {"per_cast": 0.01, "decay_per_sec": 0.1, "max": 1.0}
var _INFINITE: Dictionary = {"hp_per_shot": 1.0, "hp_cost_cap_ratio": 0.15}
const BALANCE_JSON: String = "res://data/balance.json"
@@ -61,6 +63,12 @@ func aether_for_wave(wave: int) -> int:
result = maxi(result, int(entry[1])) # 取 ≤wave 阶梯中的最大值,容忍无序表(设计师手填不必排序)
return result
func mana_heat_per_cast() -> float: return float(_MANA_HEAT.get("per_cast", 0.01))
func mana_heat_decay() -> float: return float(_MANA_HEAT.get("decay_per_sec", 0.1))
func mana_heat_max() -> float: return float(_MANA_HEAT.get("max", 1.0))
func infinite_hp_per_shot() -> float: return float(_INFINITE.get("hp_per_shot", 1.0))
func hp_cost_cap_ratio() -> float: return float(_INFINITE.get("hp_cost_cap_ratio", 0.15))
## 数据驱动:加载 balance.json(难度乘子 + Boss 血量)
func _load_balance() -> void:
if not FileAccess.file_exists(BALANCE_JSON):
@@ -77,6 +85,12 @@ func _load_balance() -> void:
_BOSS_HP = data["boss_hp"]
if data.has("aether_thresholds") and data["aether_thresholds"] is Array:
_AETHER_THRESHOLDS = data["aether_thresholds"]
if data.has("mana_heat") and data["mana_heat"] is Dictionary:
for k in data["mana_heat"]:
_MANA_HEAT[k] = data["mana_heat"][k]
if data.has("infinite_spells") and data["infinite_spells"] is Dictionary:
for k in data["infinite_spells"]:
_INFINITE[k] = data["infinite_spells"][k]
func difficulty_name() -> String:
return ["DIFF_BEGINNER", "DIFF_STANDARD", "DIFF_CHALLENGE"][difficulty]