systems rework: buffs, prestige graph, research, modular architecture
Decouples core systems from centralized globals in favor of catalogue-based architecture and data-driven content. Key changes: - Prestige: node-based buff tech tree, graph panel, progress bar - Research: multi-worker system, per-generator research, xp generation - Ascension: meta-currency layer via multi-currency prestige resets - Buffs: refactored as generator-independent via catalogues - UI: currency panel, edge-scrolling camera + zoom, current-goal panel - Alchemy Tower: crafting building with recipe/cost system - Testing: 7 test suites (ascension, prestige, research, goals) - Content: migrated from hardcoded idles/ to gym format (tiny_sword)
This commit was merged in pull request #1.
This commit is contained in:
128
tests/test_research_prestige_reset.gd
Normal file
128
tests/test_research_prestige_reset.gd
Normal file
@@ -0,0 +1,128 @@
|
||||
extends SceneTree
|
||||
|
||||
var passed: int = 0
|
||||
var failed: int = 0
|
||||
var _game_root: Node = null
|
||||
var _test_complete: bool = false
|
||||
|
||||
func _init():
|
||||
print("\n=== TEST: Research Level and XP Reset After Prestige ===\n")
|
||||
TestUtils.set_test_name("research_prestige_reset")
|
||||
|
||||
var scene = load("res://docs/gyms/tiny_sword/tiny_sword.tscn")
|
||||
change_scene_to_packed(scene)
|
||||
|
||||
await _wait()
|
||||
|
||||
_game_root = root.get_child(0)
|
||||
|
||||
var game_state: LevelGameState = _game_root.find_child("LevelGameState")
|
||||
var prestige_manager = _game_root.find_child("PrestigeManager") as PrestigeManager
|
||||
|
||||
if game_state == null:
|
||||
print("[ERROR] LevelGameState not found")
|
||||
_print_summary()
|
||||
_test_complete = true
|
||||
quit(1)
|
||||
return
|
||||
|
||||
if prestige_manager == null:
|
||||
print("[ERROR] PrestigeManager not found")
|
||||
_print_summary()
|
||||
_test_complete = true
|
||||
quit(1)
|
||||
return
|
||||
|
||||
var research_id: StringName = &"gold_research"
|
||||
|
||||
var initial_xp: BigNumber = game_state.get_research_xp(research_id)
|
||||
var initial_level: int = game_state.get_research_level(research_id)
|
||||
print("[TARGET] initial_research_xp: mantissa=%s, exponent=%s" % [initial_xp.mantissa, initial_xp.exponent])
|
||||
print("[TARGET] initial_research_level: %d" % initial_level)
|
||||
|
||||
TestUtils.assert_equals(
|
||||
0,
|
||||
initial_xp.mantissa,
|
||||
"Initial research XP should be 0"
|
||||
)
|
||||
|
||||
TestUtils.assert_equals(
|
||||
0,
|
||||
initial_level,
|
||||
"Initial research level should be 0"
|
||||
)
|
||||
|
||||
game_state.add_currency_by_id(&"gold", BigNumber.from_float(100000.0))
|
||||
game_state.add_currency_by_id(&"gems", BigNumber.from_float(100.0))
|
||||
|
||||
await _wait()
|
||||
|
||||
for i in range(10):
|
||||
game_state.add_research_xp(research_id, BigNumber.from_float(500.0))
|
||||
await _wait(0.05)
|
||||
|
||||
var pre_prestige_xp: BigNumber = game_state.get_research_xp(research_id)
|
||||
var pre_prestige_level: int = game_state.get_research_level(research_id)
|
||||
print("[TARGET] pre_prestige_research_xp: mantissa=%s, exponent=%s" % [pre_prestige_xp.mantissa, pre_prestige_xp.exponent])
|
||||
print("[TARGET] pre_prestige_research_level: %d" % pre_prestige_level)
|
||||
|
||||
TestUtils.assert_true(
|
||||
pre_prestige_xp.mantissa > 0,
|
||||
"Research XP should be > 0 before prestige"
|
||||
)
|
||||
|
||||
TestUtils.assert_true(
|
||||
pre_prestige_level > 0,
|
||||
"Research level should be > 0 before prestige"
|
||||
)
|
||||
|
||||
var can_prestige: bool = prestige_manager.can_prestige()
|
||||
print("[TARGET] can_prestige: %s" % str(can_prestige))
|
||||
|
||||
TestUtils.assert_true(
|
||||
can_prestige,
|
||||
"Should be able to prestige after accumulating currencies"
|
||||
)
|
||||
|
||||
if can_prestige:
|
||||
prestige_manager.perform_prestige()
|
||||
|
||||
await _wait()
|
||||
|
||||
var post_prestige_xp: BigNumber = game_state.get_research_xp(research_id)
|
||||
var post_prestige_level: int = game_state.get_research_level(research_id)
|
||||
print("[TARGET] post_prestige_research_xp: mantissa=%s, exponent=%s" % [post_prestige_xp.mantissa, post_prestige_xp.exponent])
|
||||
print("[TARGET] post_prestige_research_level: %d" % post_prestige_level)
|
||||
|
||||
TestUtils.assert_equals(
|
||||
0,
|
||||
post_prestige_xp.mantissa,
|
||||
"Research XP should be reset to 0 after prestige"
|
||||
)
|
||||
|
||||
TestUtils.assert_equals(
|
||||
0,
|
||||
post_prestige_level,
|
||||
"Research level should be reset to 0 after prestige"
|
||||
)
|
||||
|
||||
_print_summary()
|
||||
_test_complete = true
|
||||
if failed == 0:
|
||||
quit(0)
|
||||
else:
|
||||
quit(1)
|
||||
|
||||
func _wait(seconds: float = 0.1) -> void:
|
||||
await create_timer(seconds).timeout
|
||||
|
||||
func _print_summary():
|
||||
TestUtils.print_result()
|
||||
passed = TestUtils.get_passed()
|
||||
failed = TestUtils.get_failed()
|
||||
|
||||
func get_passed() -> int:
|
||||
return passed
|
||||
|
||||
func get_failed() -> int:
|
||||
return failed
|
||||
Reference in New Issue
Block a user