fix buff unlock

This commit is contained in:
2026-03-31 01:45:58 +02:00
parent f1e08c848e
commit eaa8f18a4a
6 changed files with 292 additions and 31 deletions

View File

@@ -320,7 +320,7 @@ func reset_runtime_state_for_prestige() -> void:
_remaining_click_cooldown_seconds = 0.0
_ensure_registered()
_evaluate_generator_unlock_goal(false)
_evaluate_buff_unlock_goals()
#_evaluate_buff_unlock_goals()
visible = is_available_to_player()
func get_manual_click_multiplier() -> float:
@@ -574,16 +574,12 @@ func _register_buffs() -> void:
_try_unlock_buff_from_goal(buff)
func _evaluate_buff_unlock_goals() -> void:
for buff in get_buffs():
GameState._try_unlock_buff_from_goal(buff)
func _try_unlock_buff_from_goal(buff: GeneratorBuffData) -> void:
GameState._try_unlock_buff_from_goal(buff)
func _on_currency_changed(_changed_currency_id: StringName, _new_amount: BigNumber) -> void:
GameState.evaluate_all_goals()
_evaluate_generator_unlock_goal(false)
_evaluate_buff_unlock_goals()
func try_unlock_from_goal() -> bool:
return _evaluate_generator_unlock_goal(true)
@@ -597,12 +593,14 @@ func _evaluate_generator_unlock_goal(allow_manual_unlock: bool) -> bool:
return false
if not data.unlocks_automatically_from_goal() and not allow_manual_unlock:
return false
if not data.is_unlock_goal_met():
var goal_id: StringName = data.get_unlock_goal_id()
if goal_id.is_empty() or not GameState.is_goal_completed(goal_id):
return false
GameState.set_generator_unlocked(_generator_id, true)
GameState.set_generator_available(_generator_id, true)
goal_achieved.emit(_generator_id, data.get_unlock_goal_id())
goal_achieved.emit(_generator_id, goal_id)
return true
## Default unlocked state loaded from generator data.