Improve prestige and add ascension as currency

This commit is contained in:
2026-04-14 00:10:57 +02:00
parent 9d10ccb8dc
commit 0e8c682ae7
18 changed files with 294 additions and 61 deletions

View File

@@ -464,9 +464,11 @@ func get_external_save_data(section_key: StringName) -> Dictionary:
return {} return {}
func reset_for_prestige(reset_total_currency: bool = false, emit_currency_signals: bool = true) -> void: func reset_for_prestige(reset_total_currency: bool = false, emit_currency_signals: bool = true, preserve_currency_ids: Array[StringName] = []) -> void:
var currency_ids: Array[StringName] = _collect_currency_ids_for_save() var currency_ids: Array[StringName] = _collect_currency_ids_for_save()
for currency_id in currency_ids: for currency_id in currency_ids:
if currency_id in preserve_currency_ids:
continue
_set_current_currency(currency_id, BigNumber.from_float(0.0)) _set_current_currency(currency_id, BigNumber.from_float(0.0))
if reset_total_currency: if reset_total_currency:
_set_total_currency(currency_id, BigNumber.from_float(0.0)) _set_total_currency(currency_id, BigNumber.from_float(0.0))

View File

@@ -33,9 +33,10 @@ Resource defining prestige rules.
```gdscript ```gdscript
enum BasisType { enum BasisType {
LIFETIME_TOTAL, # All-time currency acquired LIFETIME_TOTAL, # All-time currency acquired (single currency)
RUN_TOTAL, # Currency this run RUN_TOTAL, # Currency this run (single currency)
RUN_MAX # Peak currency this run RUN_MAX, # Peak currency this run (single currency)
ALL_CURRENCIES # Sum of all currencies (multi-currency tracking)
} }
enum FormulaType { enum FormulaType {
@@ -59,10 +60,13 @@ enum MultiplierMode {
@export var id: StringName = &"primary" @export var id: StringName = &"primary"
@export var display_name: String = "Ascension" @export var display_name: String = "Ascension"
@export var prestige_currency_id: StringName = &"prestige" @export var prestige_currency_id: StringName = &"prestige"
@export var source_currency_id: StringName = &"magic" # What to measure @export var source_currency_id: StringName = &"magic" # What to measure (ignored for ALL_CURRENCIES)
@export var basis: BasisType = LIFETIME_TOTAL @export var basis: BasisType = LIFETIME_TOTAL
@export var formula: FormulaType = POWER @export var formula: FormulaType = POWER
# Currency tracking
@export var include_currency_ids: Array[StringName] = [] # Empty = all currencies (for ALL_CURRENCIES basis)
# Threshold: minimum source currency needed # Threshold: minimum source currency needed
@export var threshold_mantissa: float = 1.0 @export var threshold_mantissa: float = 1.0
@export var threshold_exponent: int = 4 # 1e4 = 10,000 @export var threshold_exponent: int = 4 # 1e4 = 10,000
@@ -132,6 +136,22 @@ if basis == LIFETIME_TOTAL:
gain = target_total - total_prestige_earned gain = target_total - total_prestige_earned
``` ```
**Basis Value Calculation**:
```gdscript
if basis == ALL_CURRENCIES:
# Sum of all tracked currencies
basis_value = sum(get_total_currency_acquired(currency_id) for currency_id in tracked_currencies)
elif basis == RUN_TOTAL:
# Currency earned since last reset
basis_value = lifetime_total - run_start_total
elif basis == RUN_MAX:
# Peak currency reached this run
basis_value = run_peak_currency
else: # LIFETIME_TOTAL
# All-time currency acquired
basis_value = lifetime_total
```
### Multiplier Application ### Multiplier Application
**Additive Mode**: **Additive Mode**:
@@ -151,15 +171,20 @@ multiplier = base_multiplier * (growth_base ^ total_prestige)
1. Player clicks "Prestige" button 1. Player clicks "Prestige" button
2. `perform_prestige()` called 2. `perform_prestige()` called
3. Gain calculated and added to total 3. Gain calculated and added to total:
- For ALL_CURRENCIES: sum of all tracked currencies is used
- For single-currency: source currency is used
4. `GameState.reset_for_prestige()` called: 4. `GameState.reset_for_prestige()` called:
- Current currencies reset to 0 - Current currencies reset to 0
- Generator states cleared - Generator states cleared
- Buff levels reset to 0 - Buff levels reset to 0
- Goal completion cleared and re-initialized - Goal completion cleared and re-initialized
- Lifetime totals preserved - Lifetime totals preserved
5. Generators reinitialized 5. Run tracking reinitialized:
6. Save triggered - For ALL_CURRENCIES: sum of all currencies at reset time
- For single-currency: source currency at reset time
6. Generators reinitialized
7. Save triggered
## PrestigePanel ## PrestigePanel
@@ -171,7 +196,8 @@ UI component for prestige interaction.
_total_value.text = "123.45" # Total prestige earned _total_value.text = "123.45" # Total prestige earned
_pending_value.text = "56.78" # Gain available now _pending_value.text = "56.78" # Gain available now
_multiplier_value.text = "x2.34" # Current multiplier _multiplier_value.text = "x2.34" # Current multiplier
_basis_label.text = "Lifetime Total (1.50e6 Magic)" _basis_label.text = "Total Currency (1.50e6)" # For ALL_CURRENCIES basis
# Or: "Lifetime Total (1.50e6 Magic)" # For LIFETIME_TOTAL basis
``` ```
### Buttons ### Buttons
@@ -213,7 +239,7 @@ Prestige state stored in `GameState` external save:
## Configuration Example ## Configuration Example
For a typical idle game: For a typical idle game with single currency:
```gdscript ```gdscript
# Primary prestige currency # Primary prestige currency
@@ -237,6 +263,33 @@ multiplier_mode = ADDITIVE
multiplier_per_prestige = 0.10 multiplier_per_prestige = 0.10
``` ```
For multi-currency tracking (ALL_CURRENCIES):
```gdscript
id = &"ascension"
display_name = "Ascension"
prestige_currency_id = &"ascension"
# Track sum of ALL currencies (gold + wood + food + etc.)
basis = ALL_CURRENCIES
# Empty include_currency_ids means all currencies from catalog
# Set specific IDs to track only those: include_currency_ids = [&"gold", &"wood"]
include_currency_ids = []
# Need 1e4 total currency sum to get first prestige
threshold_mantissa = 1.0
threshold_exponent = 4
# Square root scaling
formula = POWER
exponent = 0.5
# +5% multiplier per prestige point
multiplier_mode = ADDITIVE
multiplier_per_prestige = 0.05
```
## See Also ## See Also
- `core/game_state.gd` - State persistence - `core/game_state.gd` - State persistence

View File

@@ -5,6 +5,7 @@ enum BasisType {
LIFETIME_TOTAL, LIFETIME_TOTAL,
RUN_TOTAL, RUN_TOTAL,
RUN_MAX, RUN_MAX,
ALL_CURRENCIES,
} }
enum FormulaType { enum FormulaType {
@@ -41,6 +42,7 @@ enum MultiplierMode {
@export var base_multiplier: float = 1.0 @export var base_multiplier: float = 1.0
@export var multiplier_per_prestige: float = 0.05 @export var multiplier_per_prestige: float = 0.05
@export var multiplier_exponent: float = 1.0 @export var multiplier_exponent: float = 1.0
@export var include_currency_ids: Array[StringName] = []
func get_threshold() -> BigNumber: func get_threshold() -> BigNumber:
return BigNumber.new(threshold_mantissa, threshold_exponent) return BigNumber.new(threshold_mantissa, threshold_exponent)
@@ -48,7 +50,7 @@ func get_threshold() -> BigNumber:
func is_valid() -> bool: func is_valid() -> bool:
if String(id).strip_edges().is_empty(): if String(id).strip_edges().is_empty():
return false return false
if String(source_currency_id).strip_edges().is_empty(): if String(source_currency_id).strip_edges().is_empty() and basis != BasisType.ALL_CURRENCIES:
return false return false
if threshold_mantissa <= 0.0: if threshold_mantissa <= 0.0:
return false return false

View File

@@ -16,6 +16,7 @@ const LAST_RESET_TIME_KEY: String = "last_reset_time"
const BASIS_LIFETIME_TOTAL: int = 0 const BASIS_LIFETIME_TOTAL: int = 0
const BASIS_RUN_TOTAL: int = 1 const BASIS_RUN_TOTAL: int = 1
const BASIS_RUN_MAX: int = 2 const BASIS_RUN_MAX: int = 2
const BASIS_ALL_CURRENCIES: int = 3
const FORMULA_POWER: int = 0 const FORMULA_POWER: int = 0
const FORMULA_TRIANGULAR_INVERSE: int = 1 const FORMULA_TRIANGULAR_INVERSE: int = 1
@@ -66,6 +67,38 @@ func get_source_currency_id() -> StringName:
return _normalize_currency_id(_get_config_string_name("source_currency_id", &"")) return _normalize_currency_id(_get_config_string_name("source_currency_id", &""))
func get_prestige_currency_id() -> StringName:
if not _is_config_valid():
return &""
return _normalize_currency_id(_get_config_string_name("prestige_currency_id", &""))
func get_tracked_currency_ids() -> Array[StringName]:
if not _is_config_valid():
return []
var basis_type: int = _get_config_int("basis", BASIS_LIFETIME_TOTAL)
if basis_type == BASIS_ALL_CURRENCIES:
var include_ids: Array[StringName] = _get_config_array("include_currency_ids", [])
if not include_ids.is_empty():
return include_ids
if game_state and game_state.currency_catalogue:
return game_state.currency_catalogue.get_all_ids()
return []
return [get_source_currency_id()]
func _get_config_array(property_name: String, fallback: Array = []) -> Array:
if config == null:
return fallback
var value: Variant = config.get(property_name)
if value is Array:
return value
return fallback
func get_total_prestige() -> BigNumber: func get_total_prestige() -> BigNumber:
return _copy_big_number(total_prestige_earned) return _copy_big_number(total_prestige_earned)
@@ -137,11 +170,19 @@ func perform_prestige() -> bool:
total_prestige_earned.add_in_place(gain) total_prestige_earned.add_in_place(gain)
current_prestige_unspent.add_in_place(gain) current_prestige_unspent.add_in_place(gain)
var prestige_currency_id: StringName = get_prestige_currency_id()
if prestige_currency_id != &"" and game_state:
game_state.add_currency_by_id(prestige_currency_id, gain)
prestige_resets_count += 1 prestige_resets_count += 1
last_reset_time = Time.get_unix_time_from_system() last_reset_time = Time.get_unix_time_from_system()
if game_state: if game_state:
game_state.reset_for_prestige(true, false) var preserve_currencies: Array[StringName] = []
var prestige_currency_id: StringName = get_prestige_currency_id()
if prestige_currency_id != &"":
preserve_currencies.append(prestige_currency_id)
game_state.reset_for_prestige(false, false, preserve_currencies)
_reset_all_buff_levels() _reset_all_buff_levels()
_reinitialize_generators_after_prestige_reset() _reinitialize_generators_after_prestige_reset()
if game_state: if game_state:
@@ -162,8 +203,10 @@ func get_next_prestige_threshold() -> BigNumber:
if not _is_config_valid(): if not _is_config_valid():
return BigNumber.from_float(0.0) return BigNumber.from_float(0.0)
match _get_config_int("basis", BASIS_LIFETIME_TOTAL): var basis_type: int = _get_config_int("basis", BASIS_LIFETIME_TOTAL)
BASIS_RUN_TOTAL:
match basis_type:
BASIS_RUN_TOTAL, BASIS_ALL_CURRENCIES:
return _get_config_threshold() return _get_config_threshold()
_: _:
var current_total: float = _big_number_to_float(total_prestige_earned) var current_total: float = _big_number_to_float(total_prestige_earned)
@@ -177,11 +220,15 @@ func get_basis_label() -> String:
if not _is_config_valid(): if not _is_config_valid():
return "-" return "-"
match _get_config_int("basis", BASIS_LIFETIME_TOTAL): var basis_type: int = _get_config_int("basis", BASIS_LIFETIME_TOTAL)
match basis_type:
BASIS_RUN_TOTAL: BASIS_RUN_TOTAL:
return "Run Total" return "Run Total"
BASIS_RUN_MAX: BASIS_RUN_MAX:
return "Run Max" return "Run Max"
BASIS_ALL_CURRENCIES:
return "Total Currency"
_: _:
return "Lifetime Total" return "Lifetime Total"
@@ -189,6 +236,12 @@ func _on_currency_changed(changed_currency_id: StringName, new_amount: BigNumber
if config == null: if config == null:
return return
var basis_type: int = _get_config_int("basis", BASIS_LIFETIME_TOTAL)
if basis_type == BASIS_ALL_CURRENCIES:
if new_amount.is_greater_than(run_peak_source_currency):
run_peak_source_currency = _copy_big_number(new_amount)
else:
var source_currency_id: StringName = get_source_currency_id() var source_currency_id: StringName = get_source_currency_id()
if source_currency_id == &"": if source_currency_id == &"":
return return
@@ -266,15 +319,18 @@ func _get_basis_value() -> BigNumber:
if config == null: if config == null:
return BigNumber.from_float(0.0) return BigNumber.from_float(0.0)
var source_currency_id: StringName = get_source_currency_id()
if source_currency_id == &"":
return BigNumber.from_float(0.0)
if game_state == null: if game_state == null:
return BigNumber.from_float(0.0) return BigNumber.from_float(0.0)
match _get_config_int("basis", BASIS_LIFETIME_TOTAL): var basis_type: int = _get_config_int("basis", BASIS_LIFETIME_TOTAL)
match basis_type:
BASIS_ALL_CURRENCIES:
return _get_total_all_currencies()
BASIS_RUN_TOTAL: BASIS_RUN_TOTAL:
var source_currency_id: StringName = get_source_currency_id()
if source_currency_id == &"":
return BigNumber.from_float(0.0)
var lifetime_now: BigNumber = game_state.get_total_currency_acquired_by_id(source_currency_id) var lifetime_now: BigNumber = game_state.get_total_currency_acquired_by_id(source_currency_id)
var run_total: BigNumber = lifetime_now.subtract(run_start_total_source_currency) var run_total: BigNumber = lifetime_now.subtract(run_start_total_source_currency)
if run_total.mantissa < 0.0: if run_total.mantissa < 0.0:
@@ -283,12 +339,38 @@ func _get_basis_value() -> BigNumber:
BASIS_RUN_MAX: BASIS_RUN_MAX:
return _copy_big_number(run_peak_source_currency) return _copy_big_number(run_peak_source_currency)
_: _:
var source_currency_id: StringName = get_source_currency_id()
if source_currency_id == &"":
return BigNumber.from_float(0.0)
return _copy_big_number(game_state.get_total_currency_acquired_by_id(source_currency_id)) return _copy_big_number(game_state.get_total_currency_acquired_by_id(source_currency_id))
func _get_total_all_currencies() -> BigNumber:
var total: BigNumber = BigNumber.from_float(0.0)
var currency_ids: Array[StringName] = get_tracked_currency_ids()
for currency_id in currency_ids:
var currency_total: BigNumber = game_state.get_total_currency_acquired_by_id(currency_id)
total.add_in_place(currency_total)
return total
func _initialize_run_tracking_from_current_state() -> void: func _initialize_run_tracking_from_current_state() -> void:
if config == null: if config == null:
return return
var basis_type: int = _get_config_int("basis", BASIS_LIFETIME_TOTAL)
if basis_type == BASIS_ALL_CURRENCIES:
run_start_total_source_currency = _get_total_all_currencies()
run_peak_source_currency = BigNumber.from_float(0.0)
var currency_ids: Array[StringName] = get_tracked_currency_ids()
for currency_id in currency_ids:
var current: BigNumber = game_state.get_currency_amount_by_id(currency_id)
if current.is_greater_than(run_peak_source_currency):
run_peak_source_currency = _copy_big_number(current)
_save_state_to_game_state()
return
var source_currency_id: StringName = get_source_currency_id() var source_currency_id: StringName = get_source_currency_id()
if source_currency_id == &"": if source_currency_id == &"":
run_start_total_source_currency = BigNumber.from_float(0.0) run_start_total_source_currency = BigNumber.from_float(0.0)
@@ -308,6 +390,19 @@ func _validate_loaded_run_tracking() -> void:
if config == null: if config == null:
return return
var basis_type: int = _get_config_int("basis", BASIS_LIFETIME_TOTAL)
if basis_type == BASIS_ALL_CURRENCIES:
var currency_ids: Array[StringName] = get_tracked_currency_ids()
var peak: BigNumber = BigNumber.from_float(0.0)
for currency_id in currency_ids:
var current: BigNumber = game_state.get_currency_amount_by_id(currency_id)
if current.is_greater_than(peak):
peak = _copy_big_number(current)
if peak.is_greater_than(run_peak_source_currency):
run_peak_source_currency = _copy_big_number(peak)
return
var source_currency_id: StringName = get_source_currency_id() var source_currency_id: StringName = get_source_currency_id()
if source_currency_id == &"": if source_currency_id == &"":
run_start_total_source_currency = BigNumber.from_float(0.0) run_start_total_source_currency = BigNumber.from_float(0.0)
@@ -428,7 +523,9 @@ func _is_cumulative_basis() -> bool:
if config != null and config.has_method("is_cumulative_basis"): if config != null and config.has_method("is_cumulative_basis"):
return bool(config.call("is_cumulative_basis")) return bool(config.call("is_cumulative_basis"))
return _get_config_int("basis", BASIS_LIFETIME_TOTAL) != BASIS_RUN_TOTAL var basis_type: int = _get_config_int("basis", BASIS_LIFETIME_TOTAL)
return basis_type != BASIS_RUN_TOTAL and basis_type != BASIS_ALL_CURRENCIES
func _round_gain(value: float) -> float: func _round_gain(value: float) -> float:
if config != null and config.has_method("round_value"): if config != null and config.has_method("round_value"):

View File

@@ -33,11 +33,10 @@ func _on_reset_button_pressed() -> void:
return return
var pending: BigNumber = manager.call("calculate_pending_gain") var pending: BigNumber = manager.call("calculate_pending_gain")
var source_currency_id: StringName = manager.call("get_source_currency_id") var basis_label: String = String(manager.call("get_basis_label"))
var source_currency_name: String = game_state.get_currency_name(source_currency_id) if game_state else "" var basis_value: BigNumber = manager.call("get_basis_value_for_display")
var confirm_message: String = "Reset this run for +%s prestige?\n\nThis resets currencies, owned generators, and buff levels. Lifetime totals and prestige are kept." % pending.to_string_suffix(2) var confirm_message: String = "Reset this run for +%s prestige?\n\nThis resets currencies, owned generators, and buff levels. Lifetime totals and prestige are kept." % pending.to_string_suffix(2)
if not source_currency_name.is_empty(): confirm_message = "%s\n\nBased on %s: %s" % [confirm_message, basis_label, basis_value.to_string_suffix(2)]
confirm_message = "%s\n\nBased on %s progression." % [confirm_message, source_currency_name]
_confirm_dialog.dialog_text = confirm_message _confirm_dialog.dialog_text = confirm_message
_is_waiting_for_confirm = true _is_waiting_for_confirm = true

View File

@@ -8,6 +8,7 @@
[resource] [resource]
script = ExtResource("3_t5xb7") script = ExtResource("3_t5xb7")
id = &"farm_auto_flux" id = &"farm_auto_flux"
target_ids = Array[StringName]([&"farm"])
text = "Farm Dynamo" text = "Farm Dynamo"
max_level = 10 max_level = 10
unlock_goal = ExtResource("4_r8eth") unlock_goal = ExtResource("4_r8eth")

View File

@@ -8,6 +8,7 @@
[resource] [resource]
script = ExtResource("3_y6252") script = ExtResource("3_y6252")
id = &"forestry_auto_flux" id = &"forestry_auto_flux"
target_ids = Array[StringName]([&"forestry"])
text = "Forest Dynamo text = "Forest Dynamo
" "
max_level = 10 max_level = 10

View File

@@ -28,9 +28,9 @@ shape = SubResource("RectangleShape2D_82rmq")
[node name="GeneratorContainer" parent="." unique_id=1451609580 node_paths=PackedStringArray("_generator") instance=ExtResource("5_82rmq")] [node name="GeneratorContainer" parent="." unique_id=1451609580 node_paths=PackedStringArray("_generator") instance=ExtResource("5_82rmq")]
visible = false visible = false
offset_left = 48.0 offset_left = 138.0
offset_top = -100.0 offset_top = -100.0
offset_right = 312.0 offset_right = 402.0
offset_bottom = 110.0 offset_bottom = 110.0
_generator = NodePath("../CurrencyGenerator") _generator = NodePath("../CurrencyGenerator")

View File

@@ -1,7 +1,5 @@
[gd_resource type="Resource" script_class="CurrencyGeneratorData" format=3 uid="uid://d08h51y0pnsnf"] [gd_resource type="Resource" script_class="CurrencyGeneratorData" format=3 uid="uid://d08h51y0pnsnf"]
[ext_resource type="Script" uid="uid://dnhocfsuvmeyb" path="res://core/generator/generator_buff_data.gd" id="1_cl7uf"]
[ext_resource type="Resource" uid="uid://cg7os1rfknw05" path="res://docs/gyms/tiny_sword/buffs/farm_auto_flux_buff.tres" id="2_bbypn"]
[ext_resource type="Resource" uid="uid://dfxk30o34qe2s" path="res://docs/gyms/tiny_sword/currencies/worker.tres" id="3_bbypn"] [ext_resource type="Resource" uid="uid://dfxk30o34qe2s" path="res://docs/gyms/tiny_sword/currencies/worker.tres" id="3_bbypn"]
[ext_resource type="Script" uid="uid://b00tqsuhxdy0d" path="res://core/generator/currency_generator_data.gd" id="4_0kvfm"] [ext_resource type="Script" uid="uid://b00tqsuhxdy0d" path="res://core/generator/currency_generator_data.gd" id="4_0kvfm"]
[ext_resource type="Resource" uid="uid://cts0407h130d6" path="res://docs/gyms/tiny_sword/goals/gold_total_1300_goal.tres" id="5_qiy1b"] [ext_resource type="Resource" uid="uid://cts0407h130d6" path="res://docs/gyms/tiny_sword/goals/gold_total_1300_goal.tres" id="5_qiy1b"]
@@ -15,11 +13,7 @@ starts_available = false
initial_owned = 1 initial_owned = 1
purchase_currency = ExtResource("3_bbypn") purchase_currency = ExtResource("3_bbypn")
unlock_goal = ExtResource("5_qiy1b") unlock_goal = ExtResource("5_qiy1b")
unlock_goal_behavior = 1
initial_cost = 1.0 initial_cost = 1.0
coefficient = 1.0 coefficient = 1.0
initial_time = 3.0
initial_revenue = 60.0
initial_productivity = 20.0 initial_productivity = 20.0
buffs = Array[ExtResource("1_cl7uf")]([ExtResource("2_bbypn")])
metadata/_custom_type_script = "uid://b00tqsuhxdy0d" metadata/_custom_type_script = "uid://b00tqsuhxdy0d"

View File

@@ -27,9 +27,8 @@ position = Vector2(0.5, -2.5)
shape = SubResource("RectangleShape2D_v4aq3") shape = SubResource("RectangleShape2D_v4aq3")
[node name="GeneratorContainer" parent="." unique_id=1451609580 node_paths=PackedStringArray("_generator") instance=ExtResource("5_rh3m6")] [node name="GeneratorContainer" parent="." unique_id=1451609580 node_paths=PackedStringArray("_generator") instance=ExtResource("5_rh3m6")]
visible = false offset_left = 128.0
offset_left = 48.0
offset_top = -100.0 offset_top = -100.0
offset_right = 312.0 offset_right = 392.0
offset_bottom = 110.0 offset_bottom = 110.0
_generator = NodePath("../CurrencyGenerator") _generator = NodePath("../CurrencyGenerator")

View File

@@ -0,0 +1,11 @@
[gd_resource type="Resource" script_class="Currency" format=3 uid="uid://bfrb0ayrljac2"]
[ext_resource type="Texture2D" uid="uid://d3nymghus6x3" path="res://sandbox/tiny_swords/UI Elements/UI Elements/Icons/Icon_03.png" id="1_icon"]
[ext_resource type="Script" uid="uid://dtgqjf3bl7pm8" path="res://core/currency/currency.gd" id="2_script"]
[resource]
script = ExtResource("2_script")
id = &"ascension"
display_name = "Ascension"
icon = ExtResource("1_icon")
metadata/_custom_type_script = "uid://dtgqjf3bl7pm8"

View File

@@ -6,8 +6,9 @@
[ext_resource type="Resource" uid="uid://dfxk30o34qe2s" path="res://docs/gyms/tiny_sword/currencies/worker.tres" id="3_7hx6u"] [ext_resource type="Resource" uid="uid://dfxk30o34qe2s" path="res://docs/gyms/tiny_sword/currencies/worker.tres" id="3_7hx6u"]
[ext_resource type="Resource" uid="uid://bxg2au0ijp242" path="res://docs/gyms/tiny_sword/currencies/food.tres" id="4_c77gh"] [ext_resource type="Resource" uid="uid://bxg2au0ijp242" path="res://docs/gyms/tiny_sword/currencies/food.tres" id="4_c77gh"]
[ext_resource type="Resource" uid="uid://bgsk8h4w80h45" path="res://docs/gyms/tiny_sword/currencies/wood.tres" id="5_gyp05"] [ext_resource type="Resource" uid="uid://bgsk8h4w80h45" path="res://docs/gyms/tiny_sword/currencies/wood.tres" id="5_gyp05"]
[ext_resource type="Resource" uid="uid://bfrb0ayrljac2" path="res://docs/gyms/tiny_sword/currencies/ascension.tres" id="6_ascension"]
[resource] [resource]
script = ExtResource("2_hmju3") script = ExtResource("2_hmju3")
currencies = Array[ExtResource("1_501l6")]([ExtResource("2_ucsji"), ExtResource("3_7hx6u"), ExtResource("4_c77gh"), ExtResource("5_gyp05")]) currencies = Array[ExtResource("1_501l6")]([ExtResource("2_ucsji"), ExtResource("3_7hx6u"), ExtResource("4_c77gh"), ExtResource("5_gyp05"), ExtResource("6_ascension")])
metadata/_custom_type_script = "uid://621tus0uvbrd" metadata/_custom_type_script = "uid://621tus0uvbrd"

View File

@@ -6,5 +6,4 @@
script = ExtResource("1_3tg3a") script = ExtResource("1_3tg3a")
id = &"ascension" id = &"ascension"
prestige_currency_id = &"ascension" prestige_currency_id = &"ascension"
source_currency_id = &"gold" basis = 3
threshold_exponent = 6

View File

@@ -17,6 +17,7 @@
[ext_resource type="PackedScene" uid="uid://cf01wvy3f17i" path="res://docs/gyms/tiny_sword/buildings/forestry/forestry.tscn" id="11_pyqyw"] [ext_resource type="PackedScene" uid="uid://cf01wvy3f17i" path="res://docs/gyms/tiny_sword/buildings/forestry/forestry.tscn" id="11_pyqyw"]
[ext_resource type="Resource" uid="uid://bgsk8h4w80h45" path="res://docs/gyms/tiny_sword/currencies/wood.tres" id="12_l6a68"] [ext_resource type="Resource" uid="uid://bgsk8h4w80h45" path="res://docs/gyms/tiny_sword/currencies/wood.tres" id="12_l6a68"]
[ext_resource type="PackedScene" uid="uid://rejxvjwybkll" path="res://sandbox/tiny_swords/Terrain/Resources/Wood/Trees/tree_1.tscn" id="14_0cs5o"] [ext_resource type="PackedScene" uid="uid://rejxvjwybkll" path="res://sandbox/tiny_swords/Terrain/Resources/Wood/Trees/tree_1.tscn" id="14_0cs5o"]
[ext_resource type="Resource" uid="uid://bfrb0ayrljac2" path="res://docs/gyms/tiny_sword/currencies/ascension.tres" id="15_ascension"]
[node name="TinySwords" type="Node" unique_id=498237642] [node name="TinySwords" type="Node" unique_id=498237642]
@@ -115,9 +116,17 @@ offset_bottom = 125.0
currency = ExtResource("12_l6a68") currency = ExtResource("12_l6a68")
game_state = NodePath("../..") game_state = NodePath("../..")
[node name="AscensionCurrencyTile" parent="LevelGameState/UI" unique_id=5000000001 node_paths=PackedStringArray("game_state") instance=ExtResource("7_0cs5o")]
layout_mode = 0
offset_top = 125.0
offset_right = 160.0
offset_bottom = 156.0
currency = ExtResource("15_ascension")
game_state = NodePath("../..")
[node name="GoalsDebugUI" parent="LevelGameState/UI" unique_id=1494700185 instance=ExtResource("10_qifrv")] [node name="GoalsDebugUI" parent="LevelGameState/UI" unique_id=1494700185 instance=ExtResource("10_qifrv")]
layout_mode = 1 layout_mode = 1
offset_left = 1067.0 offset_left = 1275.0
offset_top = 817.0 offset_top = 4.0
offset_right = 1913.0 offset_right = 1913.0
offset_bottom = 1076.0 offset_bottom = 263.0

View File

@@ -21,8 +21,8 @@ class GoalRow extends RefCounted:
requirements_label = requirements requirements_label = requirements
button = unlock_button button = unlock_button
@onready var _summary_label: Label = $MarginContainer/VBoxContainer/SummaryLabel @onready var _summary_label: Label = $MarginContainer/ScrollContainer/VBoxContainer/SummaryLabel
@onready var _goals_list: VBoxContainer = $MarginContainer/VBoxContainer/ScrollContainer/GoalsList @onready var _goals_list: VBoxContainer = $MarginContainer/ScrollContainer/VBoxContainer/ScrollContainer/GoalsList
@onready var game_state: LevelGameState = find_parent("LevelGameState") @onready var game_state: LevelGameState = find_parent("LevelGameState")
var _loaded_goals: Array[GoalDefinition] = [] var _loaded_goals: Array[GoalDefinition] = []

View File

@@ -14,26 +14,29 @@ theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8 theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8 theme_override_constants/margin_bottom = 8
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer" unique_id=1555356181] [node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer" unique_id=2143335122]
layout_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/ScrollContainer" unique_id=1555356181]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
theme_override_constants/separation = 6 theme_override_constants/separation = 6
[node name="TitleLabel" type="Label" parent="MarginContainer/VBoxContainer" unique_id=811777252] [node name="TitleLabel" type="Label" parent="MarginContainer/ScrollContainer/VBoxContainer" unique_id=811777252]
layout_mode = 2 layout_mode = 2
text = "Goals Debug" text = "Goals Debug"
[node name="SummaryLabel" type="Label" parent="MarginContainer/VBoxContainer" unique_id=17196021] [node name="SummaryLabel" type="Label" parent="MarginContainer/ScrollContainer/VBoxContainer" unique_id=17196021]
layout_mode = 2 layout_mode = 2
text = "Goals: 0 | Ready: 0 | Unlocked: 0" text = "Goals: 0 | Ready: 0 | Unlocked: 0"
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/VBoxContainer" unique_id=1105060075] [node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/ScrollContainer/VBoxContainer" unique_id=1105060075]
custom_minimum_size = Vector2(0, 170) custom_minimum_size = Vector2(0, 170)
layout_mode = 2 layout_mode = 2
size_flags_vertical = 3 size_flags_vertical = 3
[node name="GoalsList" type="VBoxContainer" parent="MarginContainer/VBoxContainer/ScrollContainer" unique_id=1684633480] [node name="GoalsList" type="VBoxContainer" parent="MarginContainer/ScrollContainer/VBoxContainer/ScrollContainer" unique_id=1684633480]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3

View File

@@ -0,0 +1,61 @@
@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")

View File

@@ -0,0 +1 @@
uid://c5ubwdte41tsf