feat(iframe): balance.json 增 player_iframe_sec 键 + SettingsManager 访问器(默认0.5s)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-24 09:15:48 +08:00
co-authored by Claude Opus 4.8
parent c756423d57
commit daf34ac1bb
2 changed files with 6 additions and 1 deletions
+2 -1
View File
@@ -11,5 +11,6 @@
}, },
"aether_thresholds": [[1, 0], [5, 3], [10, 8], [15, 14], [20, 20]], "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 }, "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
} }
+4
View File
@@ -36,6 +36,7 @@ var _BOSS_HP: Dictionary = {} # 原型→基础血量
var _AETHER_THRESHOLDS: Array = [] # [[到达波次, 碎片], ...] 升序 var _AETHER_THRESHOLDS: Array = [] # [[到达波次, 碎片], ...] 升序
var _MANA_HEAT: Dictionary = {"per_cast": 0.01, "decay_per_sec": 0.1, "max": 1.0} 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 _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" 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 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 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 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 血量) ## 数据驱动:加载 balance.json(难度乘子 + Boss 血量)
func _load_balance() -> void: func _load_balance() -> void:
@@ -91,6 +93,8 @@ func _load_balance() -> void:
if data.has("infinite_spells") and data["infinite_spells"] is Dictionary: if data.has("infinite_spells") and data["infinite_spells"] is Dictionary:
for k in data["infinite_spells"]: for k in data["infinite_spells"]:
_INFINITE[k] = data["infinite_spells"][k] _INFINITE[k] = data["infinite_spells"][k]
if data.has("player_iframe_sec"):
_IFRAME_SEC = float(data["player_iframe_sec"])
func difficulty_name() -> String: func difficulty_name() -> String:
return ["DIFF_BEGINNER", "DIFF_STANDARD", "DIFF_CHALLENGE"][difficulty] return ["DIFF_BEGINNER", "DIFF_STANDARD", "DIFF_CHALLENGE"][difficulty]