From daf34ac1bb0c5ef58678cb4e2afbe03569096619 Mon Sep 17 00:00:00 2001 From: Joywayer Date: Fri, 24 Jul 2026 09:15:48 +0800 Subject: [PATCH] =?UTF-8?q?feat(iframe):=20balance.json=20=E5=A2=9E=20play?= =?UTF-8?q?er=5Fiframe=5Fsec=20=E9=94=AE=20+=20SettingsManager=20=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E5=99=A8=EF=BC=88=E9=BB=98=E8=AE=A40.5s=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- data/balance.json | 3 ++- scripts/autoloads/settings_manager.gd | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/data/balance.json b/data/balance.json index faea819..e844399 100644 --- a/data/balance.json +++ b/data/balance.json @@ -11,5 +11,6 @@ }, "aether_thresholds": [[1, 0], [5, 3], [10, 8], [15, 14], [20, 20]], "mana_heat": { "per_cast": 0.01, "decay_per_sec": 0.1, "max": 1.0 }, - "infinite_spells": { "hp_per_shot": 1.0, "hp_cost_cap_ratio": 0.15 } + "infinite_spells": { "hp_per_shot": 1.0, "hp_cost_cap_ratio": 0.15 }, + "player_iframe_sec": 0.5 } diff --git a/scripts/autoloads/settings_manager.gd b/scripts/autoloads/settings_manager.gd index 6b1c587..3001fd2 100644 --- a/scripts/autoloads/settings_manager.gd +++ b/scripts/autoloads/settings_manager.gd @@ -36,6 +36,7 @@ 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} +var _IFRAME_SEC: float = 0.5 # 玩家受击无敌窗口(秒);balance.json player_iframe_sec const BALANCE_JSON: String = "res://data/balance.json" @@ -68,6 +69,7 @@ func mana_heat_decay() -> float: return float(_MANA_HEAT.get("decay_per_sec 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)) +func player_iframe_sec() -> float: return _IFRAME_SEC ## 数据驱动:加载 balance.json(难度乘子 + Boss 血量) func _load_balance() -> void: @@ -91,6 +93,8 @@ func _load_balance() -> void: if data.has("infinite_spells") and data["infinite_spells"] is Dictionary: for k in data["infinite_spells"]: _INFINITE[k] = data["infinite_spells"][k] + if data.has("player_iframe_sec"): + _IFRAME_SEC = float(data["player_iframe_sec"]) func difficulty_name() -> String: return ["DIFF_BEGINNER", "DIFF_STANDARD", "DIFF_CHALLENGE"][difficulty]