Files
game-code-4/tests/unit/cases/test_balance_data.gd
T

41 lines
2.4 KiB
GDScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
extends RefCounted
# 用例:BalanceData 载入 + 跨表引用 + CSV/Bible 关键值(数据门)
func run(a, data) -> void:
a.true_(data.load_errors.is_empty(), "load_errors 为空(%s)" % str(data.load_errors))
a.eq(data.generators.size(), 12, "12 班底")
a.eq(data.upgrades.size(), 108, "108 升级")
a.eq(data.meta_upgrades.size(), 12, "12 宿慧商品")
a.eq(data.halls.size(), 10, "10 殿")
a.eq(data.palettes.size(), 10, "10 色板")
a.eq(data.bosses.size(), 10, "10 殿王战")
a.eq(data.events.size(), 4, "4 事件")
# 关键数值(Balance Bible v1.0 逐值一致)
a.near(data.generators[11].base_rate, 1073741824.0, 0.5, "gen12 rate = 8^10")
a.near(data.generators[1].payback_seconds(), 120.0, 0.5, "gen2 回本 120s")
a.near(data.generators[5].payback_seconds(), 293.0, 0.5, "gen6 回本 293s")
a.near(data.generators[11].payback_seconds(), 1118.0, 0.5, "gen12 回本 1118s")
a.near(data.hall_by_no(1).gate_merit, 2000.0, 0.5, "H1 门 2K")
a.near(data.hall_by_no(10).gate_merit, 1.5e9, 0.5, "H10 门 1.5B")
a.true_(data.hall_by_no(10).is_prestige_gate, "H10 = prestige 门")
a.near(data.boss_for_hall("hall_01_qinguang").hp_factor, 15.0, 1e-9, "殿王 HP 系数 15([B§5])")
# 敕封诏书(P-12:requires = enthrone_ready)
var edict := data.upgrade("up_gate_tianzi")
a.true_(edict != null, "敕封诏书存在")
a.eq(edict.requires, "enthrone_ready", "诏书 requires = enthrone_ready")
a.eq(edict.cost, 800000000000, "诏书成本 800B")
# 调参数(balance_tuning)
a.near(data.tune_num("tune_souls_div", 0.0), 10000.0, 1e-9, "超度除数 10000")
a.near(data.tune_num("tune_enthrone_suihui_req", 0.0), 60.0, 1e-9, "敕封宿慧门槛 60")
a.near(data.tune_num("tune_enthrone_rebirths", 0.0), 2.0, 1e-9, "敕封转世门槛 2")
a.eq(data.tune_text("tune_restart_curve", ""), "1:0.6:0.4:0.3", "重开曲线文本")
a.near(data.tune_num("tune_wrath_layers", 0.0), 22.0, 1e-9, "冤煞 22 层")
a.near(data.tune_num("tune_click_base", 0.0), 1.0, 1e-9, "点击基础值 1")
# 跨表引用完整性(schema 管单表;这里查跨表)
a.true_(data.check_references().is_empty(), "跨表引用无悬挂(%s)" % str(data.check_references()))
# 每殿恰一场殿王战 + 色板
for h in data.halls:
a.true_(data.boss_for_hall(h.id) != null, "%s 有 boss 行" % h.id)
a.true_(data.palette_for_hall(h.id) != null, "%s 有色板行" % h.id)