mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-11 04:43:56 -07:00
[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:
parent
18b23b19a7
commit
b4adb20a5f
69 changed files with 1506 additions and 52 deletions
|
|
@ -79,6 +79,19 @@ void AbstractCounter::delCounter()
|
|||
}
|
||||
}
|
||||
|
||||
void AbstractCounter::setValue(int _value)
|
||||
{
|
||||
value = _value;
|
||||
update();
|
||||
}
|
||||
|
||||
void AbstractCounter::setActive(bool _active)
|
||||
{
|
||||
active = _active;
|
||||
setVisible(_active);
|
||||
update();
|
||||
}
|
||||
|
||||
void AbstractCounter::retranslateUi()
|
||||
{
|
||||
if (aSet) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
/**
|
||||
* @file abstract_counter.h
|
||||
* @ingroup GameGraphicsPlayers
|
||||
* @brief Abstract base for player counters displayed on the game board.
|
||||
*/
|
||||
//! \todo Document this file.
|
||||
|
||||
|
|
@ -61,6 +62,13 @@ public:
|
|||
~AbstractCounter() override;
|
||||
|
||||
void retranslateUi() override;
|
||||
|
||||
/**
|
||||
* @brief Sets the counter value and triggers a visual update.
|
||||
* Virtual to allow subclass display customization (e.g., CommanderTaxCounter tooltip updates).
|
||||
* Overflow protection is handled server-side, not in client counter classes.
|
||||
*/
|
||||
virtual void setValue(int _value);
|
||||
void setShortcutsActive() override;
|
||||
void setShortcutsInactive() override;
|
||||
void delCounter();
|
||||
|
|
@ -93,6 +101,25 @@ public:
|
|||
{
|
||||
return shownInCounterArea;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns whether this counter is active (visible and interactable).
|
||||
* Inactive counters are hidden and their menu actions should be disabled.
|
||||
*/
|
||||
[[nodiscard]] bool isActive() const
|
||||
{
|
||||
return active;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the active state of this counter.
|
||||
* When inactive, the counter is hidden via setVisible(false).
|
||||
* @param _active True to show and enable the counter, false to hide it
|
||||
*/
|
||||
virtual void setActive(bool _active);
|
||||
|
||||
private:
|
||||
bool active = true;
|
||||
};
|
||||
|
||||
class AbstractCounterDialog : public QInputDialog
|
||||
|
|
|
|||
|
|
@ -8,4 +8,6 @@ const QMap<QString, QString> TranslateCounterName::translated = {
|
|||
{"r", QT_TRANSLATE_NOOP("TranslateCounterName", "Red")},
|
||||
{"g", QT_TRANSLATE_NOOP("TranslateCounterName", "Green")},
|
||||
{"x", QT_TRANSLATE_NOOP("TranslateCounterName", "Colorless")},
|
||||
{"storm", QT_TRANSLATE_NOOP("TranslateCounterName", "Other")}};
|
||||
{"storm", QT_TRANSLATE_NOOP("TranslateCounterName", "Other")},
|
||||
{"commander_tax_counter", QT_TRANSLATE_NOOP("TranslateCounterName", "Commander Tax")},
|
||||
{"partner_tax_counter", QT_TRANSLATE_NOOP("TranslateCounterName", "Partner Tax")}};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue