feat: update
This commit is contained in:
@@ -526,6 +526,8 @@ func find_best_goal_slot_for_item(item: int) -> int:
|
||||
# Goal slots are row 2-3, col 1-3 (indices: 11,12,13, 16,17,18) matching User request
|
||||
# Rows 1 (6,7,8) are now storage slots
|
||||
var reserved_goal_slots = [11, 12, 13, 16, 17, 18]
|
||||
if LobbyManager.game_mode == "Candy Survival":
|
||||
reserved_goal_slots = []
|
||||
|
||||
for i in range(player.playerboard.size()):
|
||||
if player.playerboard[i] == -1:
|
||||
@@ -733,10 +735,12 @@ func _check_goal_completion():
|
||||
if not player.race_manager:
|
||||
return
|
||||
|
||||
# Note: We still trigger blueprint completion (giving Candies to the player stack)
|
||||
var is_match = false
|
||||
var is_off_color = false
|
||||
var primary_color = -1
|
||||
|
||||
var original_is_match = false
|
||||
|
||||
if LobbyManager.game_mode == "Candy Survival":
|
||||
# Custom Candy Survival blueprint check (can be off-color)
|
||||
var main = player.get_tree().get_root().get_node_or_null("Main")
|
||||
@@ -766,22 +770,27 @@ func _check_goal_completion():
|
||||
primary_color = c
|
||||
|
||||
is_off_color = (max_count < 9)
|
||||
if is_off_color and gm and gm.has_method("can_finish_with_off_color"):
|
||||
if not gm.can_finish_with_off_color(player.name.to_int(), primary_color):
|
||||
is_match = false # Reject if primary color is still available on grid
|
||||
|
||||
if is_match:
|
||||
break
|
||||
if is_match:
|
||||
original_is_match = true
|
||||
break
|
||||
|
||||
if is_match and gm and gm.has_method("on_blueprint_completed"):
|
||||
# In Candy Survival, the visual goal check does not trigger completion.
|
||||
# We only give candies into the stack. Goals are cleared & scored
|
||||
# when delivered to the Mekton.
|
||||
gm.on_blueprint_completed(player.name.to_int(), primary_color, is_off_color)
|
||||
is_match = false # Force false so we don't trigger the regular free-mode goal completion
|
||||
else:
|
||||
is_match = player.race_manager.check_pattern_match()
|
||||
|
||||
if is_match:
|
||||
print("[PlayerboardManager] Goal completed for player %s!" % player.name)
|
||||
if is_match or (original_is_match and LobbyManager.game_mode == "Candy Survival"):
|
||||
if not (LobbyManager.game_mode == "Candy Survival"):
|
||||
print("[PlayerboardManager] Goal completed for player %s!" % player.name)
|
||||
else:
|
||||
print("[PlayerboardManager] Blueprint completed for player %s! Generating candy." % player.name)
|
||||
|
||||
var powerup_manager = player.get_node_or_null("PowerUpManager")
|
||||
if powerup_manager:
|
||||
@@ -791,12 +800,13 @@ func _check_goal_completion():
|
||||
if player.is_multiplayer_authority() and player.has_method("trigger_screen_shake"):
|
||||
player.trigger_screen_shake("goal")
|
||||
|
||||
# Notify GoalsCycleManager for scoring
|
||||
var main = player.get_tree().get_root().get_node_or_null("Main")
|
||||
if main:
|
||||
var goals_cycle_manager = main.get_node_or_null("GoalsCycleManager")
|
||||
if goals_cycle_manager:
|
||||
goals_cycle_manager.on_goal_completed(player, goals_cycle_manager.get_time_remaining())
|
||||
# Notify GoalsCycleManager for scoring (only if not Candy Survival)
|
||||
if not (LobbyManager.game_mode == "Candy Survival"):
|
||||
var main = player.get_tree().get_root().get_node_or_null("Main")
|
||||
if main:
|
||||
var goals_cycle_manager = main.get_node_or_null("GoalsCycleManager")
|
||||
if goals_cycle_manager:
|
||||
goals_cycle_manager.on_goal_completed(player, goals_cycle_manager.get_time_remaining())
|
||||
else:
|
||||
# Fallback if manager not initialized yet
|
||||
NotificationManager.send_message(player, NotificationManager.MESSAGES.GOAL_COMPLETED, NotificationManager.MessageType.GOAL)
|
||||
|
||||
Reference in New Issue
Block a user