[Game] Add Command Zone support with commander tax tracking

- Add CommandZone and CommandZoneLogic for commander
  - Add CommanderTaxCounter
  - Add counter active state protocol (show/hide tax counters)
  - Add "Enable Command Zone" option in game creation dialogs
  - Add context menu actions for command zone operations

Took 9 minutes

Took 11 minutes
This commit is contained in:
DawnFire42 2026-05-21 21:30:40 -04:00
parent 18b23b19a7
commit b4adb20a5f
No known key found for this signature in database
GPG key ID: 24BB855EE2911B33
69 changed files with 1506 additions and 52 deletions

View file

@ -18,6 +18,7 @@ set(UTILITY_HEADERS
libcockatrice/utility/string_limits.h
libcockatrice/utility/dice_limits.h
libcockatrice/utility/counter_limits.h
libcockatrice/utility/counter_ids.h
libcockatrice/utility/clamped_arithmetic.h
libcockatrice/utility/zone_names.h
libcockatrice/utility/days_years_between.h

View file

@ -0,0 +1,46 @@
/**
* @file counter_ids.h
* @ingroup GameLogic
* @brief Shared counter IDs and names for system counters (e.g. commander tax).
*/
#ifndef COCKATRICE_COUNTER_IDS_H
#define COCKATRICE_COUNTER_IDS_H
#include <QString>
/**
* Shared counter IDs used by both client and server.
* These must match between server_player.cpp and player_event_handler.cpp.
*
* Reserved counter IDs for system counters:
* IDs 0-7: Standard player counters (life, mana colors, storm)
* IDs 8-9: Commander tax counters
* IDs 10+: Available for user-created counters
*
* The server's newCounterId() starts from the highest existing ID + 1,
* so these reserved IDs won't conflict as long as they're created first
* during setupZones(). See server_player.cpp::setupZones() for the
* authoritative list of reserved IDs.
*
* To find all files referencing these IDs, grep for CounterIds::CommanderTax
* and CounterIds::PartnerTax across the codebase.
*/
namespace CounterIds
{
constexpr int CommanderTax = 8;
constexpr int PartnerTax = 9;
} // namespace CounterIds
namespace CounterNames
{
constexpr const char *CommanderTax = "commander_tax_counter";
constexpr const char *PartnerTax = "partner_tax_counter";
inline bool isTaxCounter(const QString &name)
{
return name == CommanderTax || name == PartnerTax;
}
} // namespace CounterNames
#endif // COCKATRICE_COUNTER_IDS_H

View file

@ -14,6 +14,9 @@ constexpr const char *DECK = "deck";
constexpr const char *SIDEBOARD = "sb";
constexpr const char *STACK = "stack";
// Command zone (Commander format)
constexpr const char *COMMAND = "command";
} // namespace ZoneNames
#endif // ZONE_NAMES_H