Cockatrice/libcockatrice_protocol/libcockatrice/protocol/pb/command_move_card.proto
Vasco Guerreiro Vintém Morais 3a62dfb3dc Fix #6659: Correct logging for bottom-of-library card moves
Cause:
- This issue happens due to logic of moving the card from the top of the
  deck being reused when moving from the bottom of the deck, in a way
  that makes it impossible to check if the card came from the bottom.

Resolution:
- Updated the logging logic in the client for card moves.
- Added a gRPC parameter ('is_from_bottom') for card moves.
- Updates the server logic to reverse the order of the card move if the
'is_from_bottom' parameter is true.
- Added a test to show the expected behaviour of the fix.

NOTE: While the changes in this patch seem big, this is due to changing
the loop in the moveCard function to a helper function, in order to make
the bug fix change. The only change to the loop was to pass a
variable attribution to the moveCard function because it was redundant
to be in the loop.
2026-03-30 10:25:52 +01:00

58 lines
1.8 KiB
Protocol Buffer

syntax = "proto2";
import "game_commands.proto";
// Container describing a single card to move
message CardToMove {
// Id of the card in its current zone
optional sint32 card_id = 1 [default = -1];
// If true, places the card face down, hiding its name.
// If false, forcibly turns the card face up.
// If not set, defers the resulting face down state to the server.
optional bool face_down = 2;
// When moving add this value to the power/toughness field of the card
optional string pt = 3;
// When moving sets the card to be tapped
optional bool tapped = 4;
}
// Container of multiple cards to move
message ListOfCardsToMove {
repeated CardToMove card = 1;
}
// Command to move an amount of cards from one zone to another index/coordinate or another zone
message Command_MoveCard {
extend GameCommand {
optional Command_MoveCard ext = 1027;
}
// The player the zone the cards are in belongs to
optional sint32 start_player_id = 1 [default = -1];
// The zone the cards start in
optional string start_zone = 2;
// List of the cards and their new properties
optional ListOfCardsToMove cards_to_move = 3;
// The player the zone the cards will be moved to belongs to
optional sint32 target_player_id = 4 [default = -1];
// The zone the cards will be moved to
optional string target_zone = 5;
// New x coordinate of the first card in the list
optional sint32 x = 6 [default = -1];
// New y coordinate of the first card in the list
optional sint32 y = 7 [default = -1];
// Inverts the x coordinate to apply from the end of the target zone instead of the start
optional bool is_reversed = 8 [default = false];
// Inverts the order in which cards are moved (if false, from top to bottom)
optional bool is_from_bottom = 9 [default = false];
}