Files
idle/tests/test_prestige.gd
Michele Rossi 81a4058b04 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)
2026-05-07 20:36:21 +00:00

93 lines
2.6 KiB
GDScript

extends Node
var passed: int = 0
var failed: int = 0
var _game_root: Node = null
func _ready():
await run()
# Let test_runner handle exit
pass
func run():
print("\n=== TEST: Prestige Mechanics ===\n")
TestUtils.set_test_name("prestige")
var scene = load("res://docs/gyms/tiny_sword/tiny_sword.tscn")
_game_root = scene.instantiate()
add_child(_game_root)
await _wait()
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()
return
if prestige_manager == null:
print("[ERROR] PrestigeManager not found")
_print_summary()
return
# Setup: Accumulate currencies to meet prestige threshold
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()
# Check if can 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:
# Perform prestige
prestige_manager.perform_prestige()
await _wait()
# Check ascension currency
var ascension: BigNumber = game_state.get_currency_amount_by_id(&"ascension")
print("[TARGET] ascension_currency: %s" % ascension.to_string_suffix(2))
TestUtils.assert_true(
ascension.mantissa > 0,
"Should receive ascension currency after prestige"
)
# Check prestige multiplier increased
var total_multiplier = prestige_manager.get_total_multiplier()
print("[TARGET] total_multiplier: %s" % str(total_multiplier))
var mult_value: float
if total_multiplier is float:
mult_value = total_multiplier
else:
mult_value = float(total_multiplier)
TestUtils.assert_greater_than(
mult_value,
1.0,
"Prestige multiplier should be > 1.0"
)
_print_summary()
func _wait() -> void:
await get_tree().create_timer(0.5).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