Add prestige graph

This commit is contained in:
2026-05-06 23:37:52 +02:00
parent af62e379ee
commit 1ccb498947
32 changed files with 1537 additions and 279 deletions

View File

@@ -24,7 +24,7 @@ signal goal_achieved(generator_id: StringName, goal_id: StringName)
const HUGE_COST_EXPONENT: int = 1000000
## Currency target updated by this generator.
@export var currency: Resource
@export var currency: Currency
## Data resource containing balancing values and defaults (required).
@export var data: CurrencyGeneratorData
## Enables per-cycle automatic production when true.
@@ -218,7 +218,7 @@ func buy_max() -> int:
if purchase_currency_id == &"":
return 0
var available_currency: float = _big_number_to_float(_get_currency_amount_by_id(purchase_currency_id))
var available_currency: float = _get_currency_amount_by_id(purchase_currency_id).to_float()
var estimated_max: int = data.max_affordable(owned, available_currency)
if estimated_max <= 0:
return 0
@@ -355,7 +355,7 @@ func get_automatic_production_multiplier() -> float:
return _get_multiplier_for_buff_kind(GeneratorBuffData.BuffKind.AUTO_PRODUCTION_MULTIPLIER)
func get_effective_auto_run_multiplier() -> float:
return run_multiplier * get_research_multiplier() * get_automatic_production_multiplier() * _get_prestige_multiplier()
return run_multiplier * get_research_multiplier() * get_automatic_production_multiplier() * _get_prestige_buff_production_multiplier()
func get_research_multiplier() -> float:
if data == null or data.research_data == null:
@@ -477,25 +477,10 @@ func _get_click_cooldown_seconds() -> float:
func _grants_click_while_hovering() -> bool:
return grants_click_while_hovering
func _get_prestige_multiplier() -> float:
func _get_prestige_buff_production_multiplier() -> float:
if game_state == null:
return 1.0
var parent: Node = get_parent()
if parent == null:
return 1.0
var prestige_manager: PrestigeManager = parent.find_child("PrestigeManager", true, false)
if prestige_manager == null:
return 1.0
var raw_multiplier: Variant = prestige_manager.get_total_multiplier()
if raw_multiplier is float:
return maxf(raw_multiplier, 0.0)
if raw_multiplier is int:
return maxf(float(raw_multiplier), 0.0)
return 1.0
return game_state.get_prestige_buff_multiplier(PrestigeBuffNode.EffectType.CURRENCY_PRODUCTION_MULTIPLIER, _generator_id)
## Returns this generator's resolved state id.
func get_generator_id() -> StringName:
@@ -580,20 +565,13 @@ func _float_to_big_number(value: float) -> BigNumber:
return BigNumber.from_float(value)
## Converts BigNumber to float for approximate estimate math.
func _big_number_to_float(value: BigNumber) -> float:
if value.mantissa <= 0.0:
return 0.0
if value.exponent > 308:
return INF
if value.exponent < -308:
return 0.0
return value.mantissa * pow(10.0, float(value.exponent))
func _resolve_buff_cost_currency_id(buff: GeneratorBuffData) -> StringName:
if buff == null:
return &""
var cost_currency: Resource = buff.cost_currency if buff.cost_currency != null else currency
var cost_currency: Currency = buff.cost_currency if buff.cost_currency != null else currency
if cost_currency == null:
return &""
@@ -611,7 +589,7 @@ func _resolve_buff_target_currency_id(buff: GeneratorBuffData) -> StringName:
if buff == null:
return &""
var target_currency: Resource = buff.resource_target_currency if buff.resource_target_currency != null else currency
var target_currency: Currency = buff.resource_target_currency if buff.resource_target_currency != null else currency
if target_currency == null:
return &""

View File

@@ -109,7 +109,7 @@ func _refresh_buff_rows(can_interact: bool) -> void:
var buff_unlocked: bool = _generator.is_buff_unlocked(buff.id)
if not buff_unlocked:
var locked_hint: String = "Locked"
var unlock_goal_currency: Resource = buff.get_unlock_goal_currency()
var unlock_goal_currency: Currency = buff.get_unlock_goal_currency()
if buff.has_unlock_goal() and unlock_goal_currency != null and _generator.game_state:
var goal_currency_id: StringName = _generator.game_state.get_currency_id(unlock_goal_currency)
var currency_name: String = _generator.game_state.get_currency_name(goal_currency_id)