Files
idle/test_multi_currency_prestige.gd

62 lines
2.1 KiB
GDScript

@tool
extends Node
func _ready() -> void:
if not Engine.is_editor_hint():
test_multi_currency_prestige()
get_tree().quit()
func test_multi_currency_prestige() -> void:
var game_state: LevelGameState = find_child("LevelGameState")
var prestige_manager: PrestigeManager = game_state.find_child("PrestigeManager")
print("\n=== MULTI-CURRENCY PRESTIGE TEST ===\n")
# Check config
var config = prestige_manager.get_config()
var basis_type = config.get("basis", 0)
print("Basis type: %d (expected 3 for ALL_CURRENCIES)" % basis_type)
# Check tracked currencies
var tracked_ids = prestige_manager.get_tracked_currency_ids()
print("Tracked currency IDs: %s" % str(tracked_ids))
# Add some test currency amounts
var gold = game_state.get_currency_amount_by_id(&"gold")
print("Initial gold: %s" % gold.to_string_suffix(2))
# Simulate earning currencies
game_state.add_currency_by_id(&"gold", BigNumber.from_float(1000.0))
game_state.add_currency_by_id(&"wood", BigNumber.from_float(2000.0))
game_state.add_currency_by_id(&"food", BigNumber.from_float(1500.0))
game_state.add_currency_by_id(&"worker", BigNumber.from_float(500.0))
# Check total
var total = prestige_manager.get_basis_value_for_display()
print("Total currency sum: %s" % total.to_string_suffix(2))
# Check threshold
var threshold = prestige_manager.get_next_prestige_threshold()
print("Prestige threshold: %s" % threshold.to_string_suffix(2))
# Check if can prestige
var can_prestige = prestige_manager.can_prestige()
print("Can prestige: %s" % str(can_prestige))
# Check pending gain
var pending_gain = prestige_manager.calculate_pending_gain()
print("Pending gain: %s" % pending_gain.to_string_suffix(2))
# Perform prestige
if can_prestige:
var result = prestige_manager.perform_prestige()
print("Prestige performed: %s" % str(result))
var total_prestige = prestige_manager.get_total_prestige()
print("Total prestige earned: %s" % total_prestige.to_string_suffix(2))
var ascension = game_state.get_currency_amount_by_id(&"ascension")
print("Ascension currency: %s" % ascension.to_string_suffix(2))
print("\n=== TEST COMPLETE ===\n")