feat(battleship): add full placement/battle phases + metadata support + action-based moves
- Added Battleship Fleet definition (carrier, battleship, cruiser, submarine, destroyer) - Implemented action-based MovePayload (`action: "place" | "shoot"`) - Added placement and shot validation (ValidatePlacementMove, ValidateShotMove) - Added ApplyPlacement and ApplyShot with correct ship placement + hit/miss logic - Added pX_placed, pX_ready tracking and phase switching (placement → battle) - Added Metadata field to MatchState (for phase/ready tracking) - Updated MatchInit to initialize placement phase and readiness flags - Updated MatchLoop to enforce turn order only during battle phase - Added debug logging for state broadcasts - Fixed protobuf dependency marking as indirect
This commit is contained in:
@@ -6,7 +6,8 @@ import "localrepo/plugins/structs"
|
||||
// It is intentionally untyped (map[string]interface{}) so each game
|
||||
// can define its own move structure (e.g., row/col, coordinate, action type, etc.)
|
||||
type MovePayload struct {
|
||||
Data map[string]interface{} `json:"data"`
|
||||
Action string `json:"action"` // "place" or "shoot"
|
||||
Data map[string]interface{} `json:"data"`
|
||||
}
|
||||
|
||||
// GameRules defines a generic interface for match logic.
|
||||
|
||||
Reference in New Issue
Block a user