This document provides an overview of the tables affected by various functions within the MoveSystem contract. Each section describes the function, the affected tables, and the values set in those tables.
function move(
bytes32 _matchEntity,
bytes32 _entity,
PositionData[] memory _path
) external;- Position: Updates the positions of the piece entities.
- Key:
matchEntity,entity - Value: The new position of the piece.
- Key:
- EntityAtPosition: Updates the entity's position on the board.
- Key:
matchEntity,x,y - Value: The entity that occupies the new position.
- Key:
- ActionStatus: Updates the action status for the active player.
- Key:
matchEntity,playerEntity - Values:
movesExecuted: Incremented by 1
- Key:
- ActivePlayer: Updates the active player for the match.
- Key:
matchEntity - Value: The next player in the turn order if the move and attack actions are consumed or if the player ends their turn.
- Key:
- Moves a piece on the board along a specified path. This function handles player turn validation, updates the active player status, and ensures that a piece is moved according to the game rules.
- The function checks if it is the player's turn before allowing the move. It updates the active player data and resets player actions if necessary. The function then moves the piece along the provided path and updates the player's actions.
- The active player is updated if the move and attack actions are consumed or if the player ends their turn.
Note: Movement should adhere to square patterns. For example, a move from (1,1) to (2,2) should follow a path such as (1,1) → (2,1) → (2,2). A direct diagonal move (e.g., from (1,1) to (2,2) in a single step) is not allowed.