fix buff unlock
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -87,8 +87,12 @@ func get_unlock_goal_currency() -> Currency:
|
||||
func is_unlock_goal_met() -> bool:
|
||||
if unlock_goal == null:
|
||||
return false
|
||||
|
||||
return bool(unlock_goal.is_met())
|
||||
|
||||
var goal_id: StringName = unlock_goal.id
|
||||
if goal_id.is_empty():
|
||||
return false
|
||||
|
||||
return GameState.is_goal_completed(goal_id)
|
||||
|
||||
func can_purchase_next_level(current_level: int) -> bool:
|
||||
if max_level < 0:
|
||||
|
||||
Reference in New Issue
Block a user