From 020730bc9c395298224ecb12d83b2bdef5ed0a93 Mon Sep 17 00:00:00 2001 From: dingo Date: Thu, 30 Apr 2026 23:30:25 -0400 Subject: [PATCH] Client fixes --- .../origin-client/scenes/game/game_screen.gd | 47 +++++++++++++++---- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/Client/origin-client/scenes/game/game_screen.gd b/Client/origin-client/scenes/game/game_screen.gd index c1d266e..7b820c8 100644 --- a/Client/origin-client/scenes/game/game_screen.gd +++ b/Client/origin-client/scenes/game/game_screen.gd @@ -1463,6 +1463,32 @@ func _safe_arch(player: Dictionary) -> Dictionary: return arch as Dictionary if arch is Dictionary else {} +func _all_board_units() -> Array: + var units : Array = [] + for player: Dictionary in Game.state.get("players", []): + for unit: Dictionary in player.get("field", []): + if not _is_ruin_unit(unit): + units.append(unit) + var arch : Dictionary = _safe_arch(player) + if not arch.is_empty(): + units.append(arch) + return units + + +func _units_obstructing_movement_type(mov: String) -> Dictionary: + var result : Dictionary = {} + var want_label := "obstruct:%s" % mov.to_lower() + var active_effects = Game.state.get("activeEffects") + if not active_effects is Array: + return result + for effect: Dictionary in active_effects: + if str(effect.get("label", "")).to_lower() == want_label: + var target_ref := str(effect.get("targetRef", "")) + if not target_ref.is_empty(): + result[target_ref] = true + return result + + func _rebuild_ownership(state: Dictionary) -> void: _enemy_unit_ids.clear() _friendly_unit_ids.clear() @@ -3080,6 +3106,7 @@ func _valid_move_tiles(unit: Dictionary) -> Array: var uy : int = pos.get("y", 0) var mp : int = unit.get("currentMp", 0) var mov : String = str(unit.get("movementType", "Walk")).to_lower() + if not bool(unit.get("canMove", false)): return [] if mp <= 0: return [] var bw : int = Game.board_width() @@ -3089,28 +3116,32 @@ func _valid_move_tiles(unit: Dictionary) -> Array: if mov == "walk" or mov == "flight": # Build blocked set from all occupants, excluding this unit. var blocked : Dictionary = {} - for unit_dict : Dictionary in Game.get_field(): - if _is_ruin_unit(unit_dict): - continue + var extra_obstructors := _units_obstructing_movement_type(mov) + var moving_id := str(unit.get("instanceId", "")) + for unit_dict : Dictionary in _all_board_units(): var up : Dictionary = unit_dict.get("position", {}) if up.is_empty(): continue + var iid := str(unit_dict.get("instanceId", "")) + if iid == moving_id: continue var cx : int = up.get("x", 0) var cy : int = up.get("y", 0) if cx == ux and cy == uy: continue # don't block own tile - # Flight is only blocked by other Flight units; Walk is blocked by all. + # Flight is blocked by other Flight units or explicit movement obstructors. if mov == "flight": - if str(unit_dict.get("movementType", "Walk")).to_lower() != "flight": + var blocks_flight := str(unit_dict.get("movementType", "Walk")).to_lower() == "flight" + if not blocks_flight and not extra_obstructors.has(iid): continue blocked[Vector2i(cx, cy)] = true return _bfs_reachable(ux, uy, mp, blocked) - # Jump / Teleport: board-metric range, land on any unoccupied tile. + # Jump / Teleport: land on any unoccupied tile. Teleport also requires LOS. var results : Array = [] + if mov != "jump" and mov != "teleport": + return results for tx in range(bw): for ty in range(bh): if not _tile_bodies.has("%d,%d" % [tx, ty]): continue - var dist : int = _board_distance(tx, ty, ux, uy) - if dist == 0 or dist > mp: continue + if tx == ux and ty == uy: continue if _tile_has_blocking_occupant(Game.get_tile(tx, ty)): continue # Teleport additionally requires LOS to the destination. if mov == "teleport" and not _client_has_los(ux, uy, tx, ty): continue