Filter channel tile highlights to matching affinity only
Spirits may only be channeled onto tiles whose resolvedAffinity matches the card's affinity. Previously all unoccupied in-range tiles were highlighted regardless of affinity. Also: - Cache Game.get_tile() result to avoid double lookup per cell - Add sparse-board guard (_tile_bodies existence check) - Remove stray debug print statements Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -2162,16 +2162,18 @@ func _valid_play_tiles(card: Dictionary) -> Array:
|
||||
# Read as Variant first, then substitute the default explicitly.
|
||||
var raw_min = arch.get("minChannelRange")
|
||||
var raw_max = arch.get("maxChannelRange")
|
||||
var min_r : int = 1 if raw_min == null else int(raw_min)
|
||||
var max_r : int = 1 if raw_max == null else int(raw_max)
|
||||
var min_r : int = 1 if raw_min == null else int(raw_min)
|
||||
var max_r : int = 1 if raw_max == null else int(raw_max)
|
||||
var card_affinity : String = card.get("affinity", "")
|
||||
for tx in range(bw):
|
||||
for ty in range(bh):
|
||||
if not _tile_bodies.has("%d,%d" % [tx, ty]): continue
|
||||
var dist : int = abs(tx - ax) + abs(ty - ay)
|
||||
if dist < min_r or dist > max_r: continue
|
||||
if Game.get_tile(tx, ty).get("occupantId"): continue
|
||||
print("Adding tiles")
|
||||
var tile : Dictionary = Game.get_tile(tx, ty)
|
||||
if tile.get("occupantId"): continue
|
||||
if card_affinity != "" and tile.get("resolvedAffinity", "Void") != card_affinity: continue
|
||||
results.append(Vector2i(tx, ty))
|
||||
print("results: ", results)
|
||||
|
||||
"Terramorpha":
|
||||
for tx in range(bw):
|
||||
|
||||
Reference in New Issue
Block a user