diff --git a/core/game_state.gd b/core/game_state.gd index 034653e..d4bf03d 100644 --- a/core/game_state.gd +++ b/core/game_state.gd @@ -321,10 +321,10 @@ func get_external_save_data(section_key: StringName) -> Dictionary: return {} -func reset_for_prestige(reset_total_currency: bool = false) -> void: - for currency_id in _collect_currency_ids_for_save(): +func reset_for_prestige(reset_total_currency: bool = false, emit_currency_signals: bool = true) -> void: + var currency_ids: Array[StringName] = _collect_currency_ids_for_save() + for currency_id in currency_ids: _set_current_currency(currency_id, BigNumber.from_float(0.0)) - currency_changed.emit(currency_id, _get_current_currency_ref(currency_id)) if reset_total_currency: _set_total_currency(currency_id, BigNumber.from_float(0.0)) @@ -332,6 +332,16 @@ func reset_for_prestige(reset_total_currency: bool = false) -> void: generator_buff_levels.clear() generator_buff_unlocked.clear() + if not emit_currency_signals: + return + + for currency_id in currency_ids: + currency_changed.emit(currency_id, _get_current_currency_ref(currency_id)) + +func emit_currency_changed_for_all() -> void: + for currency_id in _collect_currency_ids_for_save(): + currency_changed.emit(currency_id, _get_current_currency_ref(currency_id)) + # ========================================== # PERSISTENCE (Save/Load) # ========================================== diff --git a/core/generator/currency_generator.gd b/core/generator/currency_generator.gd index 5111362..d73d278 100644 --- a/core/generator/currency_generator.gd +++ b/core/generator/currency_generator.gd @@ -385,13 +385,13 @@ func _grants_click_while_hovering() -> bool: return grants_click_while_hovering func _get_prestige_multiplier() -> float: - var manager: Node = get_node_or_null("/root/PrestigeManager") + var manager: PrestigeManager = get_node_or_null("/root/PrestigeManager") if manager == null: return 1.0 - if not manager.has_method("get_total_multiplier"): + if not manager.get_total_multiplier(): return 1.0 - var raw_multiplier: Variant = manager.call("get_total_multiplier") + var raw_multiplier: Variant = manager.get_total_multiplier() if raw_multiplier is float: return maxf(raw_multiplier, 0.0) if raw_multiplier is int: diff --git a/core/prestige/prestige_manager.gd b/core/prestige/prestige_manager.gd index 381ea96..e5a77fb 100644 --- a/core/prestige/prestige_manager.gd +++ b/core/prestige/prestige_manager.gd @@ -129,8 +129,9 @@ func perform_prestige() -> bool: prestige_resets_count += 1 last_reset_time = Time.get_unix_time_from_system() - GameState.reset_for_prestige(true) + GameState.reset_for_prestige(true, false) _reinitialize_generators_after_prestige_reset() + GameState.emit_currency_changed_for_all() _initialize_run_tracking_from_current_state() _save_state_to_game_state() GameState.save_game() diff --git a/idles/generators/orb.tres b/idles/generators/orb.tres index ee381ee..3f3d1b9 100644 --- a/idles/generators/orb.tres +++ b/idles/generators/orb.tres @@ -5,14 +5,12 @@ [ext_resource type="Resource" uid="uid://ceugcxmassmpk" path="res://idles/buffs/orb_auto_flux.tres" id="2_x505b"] [ext_resource type="Resource" uid="uid://6i3fcygusuqf" path="res://idles/buffs/orb_click_focus.tres" id="3_fsxdm"] [ext_resource type="Resource" uid="uid://brqaojindcxa5" path="res://idles/currencies/magic.tres" id="4_jpwus"] -[ext_resource type="Resource" uid="uid://qyxct5gbrxwa" path="res://idles/goals/magic_total_30.tres" id="6_5v0af"] [resource] script = ExtResource("1_c6y77") id = &"Magic" name = "Magic Orb" purchase_currency = ExtResource("4_jpwus") -unlock_goal = ExtResource("6_5v0af") initial_cost = 200.0 initial_productivity = 20.0 buffs = Array[ExtResource("1_t6lg0")]([ExtResource("2_x505b"), ExtResource("3_fsxdm")])