Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 1.57 KB

File metadata and controls

44 lines (31 loc) · 1.57 KB

TurnSystem Affected Tables

This document provides an overview of the tables affected by various functions within the TurnSystem contract. Each section describes the function, the affected tables, and the values set in those tables.

endTurn

function endTurn(bytes32 _matchEntity) public;

Affected Tables:

  • ActivePlayer: Updates the active player for the match.
    • Key: matchEntity
    • Value: The next player in the turn order.
  • ActionStatus: Resets the action status for all players in the match.
    • Key: matchEntity, playerEntity
    • Values:
      • selectedPiece: Set to bytes32(0)
      • movesExecuted: Set to 0
      • battlesExecuted: Set to 0

Scenario:

  • Ends the turn for the current player in a match. This function ensures that only the active player can end their turn and records the player's actions. It advances to the next active player

endTurn

function surrender(bytes32 _matchEntity) external;

Affected Tables:

  • MatchPlayerSurrenders: Records the surrender status for the player.
    • Key: matchEntity, playerEntity
    • Value: true
  • MatchWinner: Updates the match winner if applicable.
    • Key: matchEntity
    • Value: The playerEntity who is the last remaining player, if applicable.

Scenario:

  • Allows the player calling this function to surrender from the specified match. It checks if the player has already surrendered or if they are the last remaining player, and then records the surrender.