This commit is contained in:
francis 2026-03-06 20:12:38 +01:00
commit 3ea7bfd5dc
122 changed files with 568704 additions and 0 deletions

55
Scripts/Rules/rook.gd Executable file
View file

@ -0,0 +1,55 @@
extends Rule
static func ready(piece: Piece):
pass
static func select(piece: Piece, game: Game):
var pos = piece.to_coord()
var board_size = game.get_node("Board").board_size
piece.possible_movements = []
# alle felder nach links:
for x in range(pos.x+1, board_size.x, 1):
var move = Vector2i(x - pos.x, 0)
var other_piece = game.get_piece_at(move+pos)
if other_piece:
if other_piece.is_in_group("Enemy"):
piece.possible_movements.append(move)
break
piece.possible_movements.append(move)
for x in range(pos.x - 1, -1, -1):
var move = Vector2i(x - pos.x, 0)
var other_piece = game.get_piece_at(move+pos)
if other_piece:
if other_piece.is_in_group("Enemy"):
piece.possible_movements.append(move)
break
piece.possible_movements.append(move)
for y in range(pos.y+1, board_size.y, 1):
var move = Vector2i(0,y - pos.y)
var other_piece = game.get_piece_at(move+pos)
if other_piece:
if other_piece.is_in_group("Enemy"):
piece.possible_movements.append(move)
break
piece.possible_movements.append(move)
for y in range(pos.y - 1, -1, -1):
var move = Vector2i(0,y - pos.y)
var other_piece = game.get_piece_at(move+pos)
if other_piece:
if other_piece.is_in_group("Enemy"):
piece.possible_movements.append(move)
break
piece.possible_movements.append(move)
for move in piece.possible_movements:
pass
pass
static func before_move(piece: Piece):
pass