diff --git a/data/balance.json b/data/balance.json index 2d5c2df..66f52df 100644 --- a/data/balance.json +++ b/data/balance.json @@ -8,5 +8,6 @@ "boss_hp": { "4": 450.0, "5": 1800.0 - } + }, + "aether_thresholds": [[1, 0], [5, 3], [10, 8], [15, 14], [20, 20]] } diff --git a/scripts/autoloads/settings_manager.gd b/scripts/autoloads/settings_manager.gd index 4280fc8..333be4a 100644 --- a/scripts/autoloads/settings_manager.gd +++ b/scripts/autoloads/settings_manager.gd @@ -33,6 +33,7 @@ func complete_ftue(chosen_difficulty: int) -> void: ## get() 的默认仅为防崩溃,非内容副本 var _MULTS: Dictionary = {} # key → [初学者, 标准, 挑战] var _BOSS_HP: Dictionary = {} # 原型→基础血量 +var _AETHER_THRESHOLDS: Array = [] # [[到达波次, 碎片], ...] 升序 const BALANCE_JSON: String = "res://data/balance.json" @@ -49,6 +50,17 @@ func boss_hp_mult() -> float: return _mult("boss_hp") func get_boss_base_hp(boss_type: int) -> float: return float(_BOSS_HP.get(str(boss_type), 500.0)) +## 到达波次 → 以太碎片(阶梯查表:取"波次阈值 ≤ wave"的最高阶梯值;升序表) +func aether_for_wave(wave: int) -> int: + var table: Array = _AETHER_THRESHOLDS + if table.is_empty(): + table = [[1, 0], [5, 3], [10, 8], [15, 14], [20, 20]] + var result: int = 0 + for entry in table: + if entry is Array and entry.size() >= 2 and int(entry[0]) <= wave: + result = int(entry[1]) + return result + ## 数据驱动:加载 balance.json(难度乘子 + Boss 血量) func _load_balance() -> void: if not FileAccess.file_exists(BALANCE_JSON): @@ -63,6 +75,8 @@ func _load_balance() -> void: _MULTS[k] = data["difficulty_mults"][k] if data.has("boss_hp") and data["boss_hp"] is Dictionary: _BOSS_HP = data["boss_hp"] + if data.has("aether_thresholds") and data["aether_thresholds"] is Array: + _AETHER_THRESHOLDS = data["aether_thresholds"] func difficulty_name() -> String: return ["DIFF_BEGINNER", "DIFF_STANDARD", "DIFF_CHALLENGE"][difficulty] @@ -111,6 +125,7 @@ func clear_all_local_data() -> void: var pm: Node = get_node_or_null("/root/ProfileManager") if pm and pm.has_method("clear_run"): pm.clear_run() + MetaProgress.clear() _apply_audio() func _remove_dir_recursive(path: String) -> void: