extends Node var passed: int = 0 var failed: int = 0 var _game_root: Node = null func _ready(): pass # run() is called by the test runner; avoid double-execution. 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() # Use a unique save path to avoid contaminating the real game's save. var save_path: String = "user://test_prestige_%d.json" % randi() DirAccess.remove_absolute(ProjectSettings.globalize_path(save_path)) var gs: LevelGameState = _game_root.get_node("LevelGameState") gs.save_file_path = save_path 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