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

@@ -33,9 +33,10 @@ Resource defining prestige rules.
```gdscript
enum BasisType {
LIFETIME_TOTAL, # All-time currency acquired
RUN_TOTAL, # Currency this run
RUN_MAX # Peak currency this run
LIFETIME_TOTAL, # All-time currency acquired (single currency)
RUN_TOTAL, # Currency this run (single currency)
RUN_MAX, # Peak currency this run (single currency)
ALL_CURRENCIES # Sum of all currencies (multi-currency tracking)
}
enum FormulaType {
@@ -59,10 +60,13 @@ enum MultiplierMode {
@export var id: StringName = &"primary"
@export var display_name: String = "Ascension"
@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 formula: FormulaType = POWER
# Currency tracking
@export var include_currency_ids: Array[StringName] = [] # Empty = all currencies (for ALL_CURRENCIES basis)
# Threshold: minimum source currency needed
@export var threshold_mantissa: float = 1.0
@export var threshold_exponent: int = 4 # 1e4 = 10,000
@@ -132,6 +136,22 @@ if basis == LIFETIME_TOTAL:
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
**Additive Mode**:
@@ -151,15 +171,20 @@ multiplier = base_multiplier * (growth_base ^ total_prestige)
1. Player clicks "Prestige" button
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:
- Current currencies reset to 0
- Generator states cleared
- Buff levels reset to 0
- Goal completion cleared and re-initialized
- Lifetime totals preserved
5. Generators reinitialized
6. Save triggered
5. Run tracking reinitialized:
- 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
@@ -171,7 +196,8 @@ UI component for prestige interaction.
_total_value.text = "123.45" # Total prestige earned
_pending_value.text = "56.78" # Gain available now
_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
@@ -213,7 +239,7 @@ Prestige state stored in `GameState` external save:
## Configuration Example
For a typical idle game:
For a typical idle game with single currency:
```gdscript
# Primary prestige currency
@@ -237,6 +263,33 @@ multiplier_mode = ADDITIVE
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
- `core/game_state.gd` - State persistence