feat(mana): balance.json mana_heat/infinite_spells 配置 + SettingsManager getters
This commit is contained in:
+3
-1
@@ -9,5 +9,7 @@
|
|||||||
"4": 450.0,
|
"4": 450.0,
|
||||||
"5": 1800.0
|
"5": 1800.0
|
||||||
},
|
},
|
||||||
"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 },
|
||||||
|
"infinite_spells": { "hp_per_shot": 1.0, "hp_cost_cap_ratio": 0.15 }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ func complete_ftue(chosen_difficulty: int) -> void:
|
|||||||
var _MULTS: Dictionary = {} # key → [初学者, 标准, 挑战]
|
var _MULTS: Dictionary = {} # key → [初学者, 标准, 挑战]
|
||||||
var _BOSS_HP: Dictionary = {} # 原型→基础血量
|
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 _INFINITE: Dictionary = {"hp_per_shot": 1.0, "hp_cost_cap_ratio": 0.15}
|
||||||
|
|
||||||
const BALANCE_JSON: String = "res://data/balance.json"
|
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 阶梯中的最大值,容忍无序表(设计师手填不必排序)
|
result = maxi(result, int(entry[1])) # 取 ≤wave 阶梯中的最大值,容忍无序表(设计师手填不必排序)
|
||||||
return result
|
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 血量)
|
## 数据驱动:加载 balance.json(难度乘子 + Boss 血量)
|
||||||
func _load_balance() -> void:
|
func _load_balance() -> void:
|
||||||
if not FileAccess.file_exists(BALANCE_JSON):
|
if not FileAccess.file_exists(BALANCE_JSON):
|
||||||
@@ -77,6 +85,12 @@ func _load_balance() -> void:
|
|||||||
_BOSS_HP = data["boss_hp"]
|
_BOSS_HP = data["boss_hp"]
|
||||||
if data.has("aether_thresholds") and data["aether_thresholds"] is Array:
|
if data.has("aether_thresholds") and data["aether_thresholds"] is Array:
|
||||||
_AETHER_THRESHOLDS = data["aether_thresholds"]
|
_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:
|
func difficulty_name() -> String:
|
||||||
return ["DIFF_BEGINNER", "DIFF_STANDARD", "DIFF_CHALLENGE"][difficulty]
|
return ["DIFF_BEGINNER", "DIFF_STANDARD", "DIFF_CHALLENGE"][difficulty]
|
||||||
|
|||||||
Reference in New Issue
Block a user