The TurnSystem contract enables players in a match to end or skip their turn.
function endTurn(bytes32 _matchEntity) external;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 for that turn.
-
The function verifies whether the sender is the active player for the match. If the sender is not the active player, the function reverts with an error.
-
matchEntity: The unique identifier for the match.
bytes32 matchEntity = 0x000000000000000000000000000000000000000000000000000000000000beef;
world.tacticsWar__endTurn(matchEntity);Note: Only the active player in the match can call this function. If any other player tries to call it, the function will revert with an error.
function surrender(bytes32 _matchEntity) external;Allows the player calling this function to surrender from the specified match.
-
matchEntity: The unique identifier for the match in which the player is surrendering.
bytes32 matchEntity = 0x000000000000000000000000000000000000000000000000000000000000beef;
world.tacticsWar__surrender(matchEntity);Note: If only one player remains after others have surrendered, that player will be declared the winner and the game will end automatically.