mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-28 08:52:19 -07:00
Wire command zone menu, harden counter command handling, and expand tests
- Connect aMoveToCommandZone to cmMoveToCommandZone; the menu item was
added, shown, and shortcut-bound but never wired, so it did nothing
- Extract evaluateModifyCounter() and route cmdIncCounter/cmdSetCounter
through it, replacing isCommandZoneCounterBlocked; reject inc/set on
an inactive tax counter so a hidden counter cannot accumulate value
- Reject reserved tax counter names in cmdCreateCounter to prevent a
client from spoofing a system tax counter via a user-created counter
- Route AbstractCounter::valueChanged through the virtual setValue() so
CommanderTaxCounter clamps and refreshes its tooltip on value changes
- Deduplicate actPlayAndIncreaseTax/actPlayAndIncreasePartnerTax into a
single playAndIncreaseTax(counterId) helper
- Move MINIMUM_STACKING_HEIGHT from CommandZone to the PlayerGraphicsItem
layout code, its only consumer
- Remove unused AbstractCounter forward declaration from player_logic.h
- Add EvaluateModifyCounter tests and PartnerTax cases for
evaluateSetCounterActive
- Pin the FirstUserId floor in new_counter_id_test using ids 3 and 5 so
a naive "highest id + 1" regression fails the test
This commit is contained in:
parent
6fcce28258
commit
209306440e
11 changed files with 172 additions and 47 deletions
|
|
@ -1661,23 +1661,21 @@ void PlayerActions::playSelectedCardsImpl(QList<CardItem *> selectedCards,
|
|||
|
||||
void PlayerActions::actPlayAndIncreaseTax(QList<CardItem *> selectedCards)
|
||||
{
|
||||
playSelectedCardsImpl(selectedCards, false, [this](CardItem * /*card*/, const QString &originalZone) {
|
||||
if (originalZone == ZoneNames::COMMAND) {
|
||||
CounterState *state = player->getCounters().value(CounterIds::CommanderTax, nullptr);
|
||||
if (state && state->isActive()) {
|
||||
sendIncCounter(CounterIds::CommanderTax, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
playAndIncreaseTax(selectedCards, CounterIds::CommanderTax);
|
||||
}
|
||||
|
||||
void PlayerActions::actPlayAndIncreasePartnerTax(QList<CardItem *> selectedCards)
|
||||
{
|
||||
playSelectedCardsImpl(selectedCards, false, [this](CardItem * /*card*/, const QString &originalZone) {
|
||||
playAndIncreaseTax(selectedCards, CounterIds::PartnerTax);
|
||||
}
|
||||
|
||||
void PlayerActions::playAndIncreaseTax(QList<CardItem *> selectedCards, int counterId)
|
||||
{
|
||||
playSelectedCardsImpl(selectedCards, false, [this, counterId](CardItem * /*card*/, const QString &originalZone) {
|
||||
if (originalZone == ZoneNames::COMMAND) {
|
||||
CounterState *state = player->getCounters().value(CounterIds::PartnerTax, nullptr);
|
||||
CounterState *state = player->getCounters().value(counterId, nullptr);
|
||||
if (state && state->isActive()) {
|
||||
sendIncCounter(CounterIds::PartnerTax, 1);
|
||||
sendIncCounter(counterId, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue