From d6f4f2b5a67cba4698ed80caf56259062afa8f72 Mon Sep 17 00:00:00 2001 From: Joywayer Date: Tue, 21 Jul 2026 11:43:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(meta):=20=E7=A2=8E=E7=89=87=E5=A5=96?= =?UTF-8?q?=E5=8A=B1=E9=98=88=E5=80=BC=E8=A1=A8(balance.json)+aether=5Ffor?= =?UTF-8?q?=5Fwave+=E6=B8=85=E9=99=A4=E6=95=B0=E6=8D=AE=E9=92=A9=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/balance.json | 3 ++- scripts/autoloads/settings_manager.gd | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) 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: