[Refactor] Build player counter commands in game/ instead of AbstractCounter

This commit is contained in:
Lukas Brübach 2026-10-06 13:21:21 +02:00 • committed by GitHub
parent fa14179445
commit 0f5b1a032a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 28 additions and 14 deletions

View file

@ -60,6 +60,7 @@
#include <libcockatrice/protocol/pb/command_roll_die.pb.h>
#include <libcockatrice/protocol/pb/command_set_card_attr.pb.h>
#include <libcockatrice/protocol/pb/command_set_card_counter.pb.h>
#include <libcockatrice/protocol/pb/command_set_counter.pb.h>
#include <libcockatrice/protocol/pb/command_shuffle.pb.h>
#include <libcockatrice/protocol/pb/command_undo_draw.pb.h>
#include <libcockatrice/settings/card_override_settings.h>
@ -1450,6 +1451,24 @@ void PlayerActions::actFlowT(QList<CardItem *> selectedCards)
actIncPT(selectedCards, -1, 1);
}
void PlayerActions::actIncrementCounter(int counterId, int delta)
{
Command_IncCounter cmd;
cmd.set_counter_id(counterId);
cmd.set_delta(delta);
sendGameCommand(cmd);
}
void PlayerActions::actSetCounter(int counterId, int value)
{
Command_SetCounter cmd;
cmd.set_counter_id(counterId);
cmd.set_value(value);
sendGameCommand(cmd);
}
void PlayerActions::actReduceLifeByPower(QList<CardItem *> selectedCards)
{
// find life counter

View file

@ -239,6 +239,12 @@ public slots:
void actFlowP(QList<CardItem *> selectedCards);
void actFlowT(QList<CardItem *> selectedCards);
/** @brief Adjusts a player counter by a signed delta. */
void actIncrementCounter(int counterId, int delta);
/** @brief Sets a player counter to an absolute value. */
void actSetCounter(int counterId, int value);
void actReduceLifeByPower(QList<CardItem *> selectedCards);
void actRequestSetAnnotationDialog(QList<CardItem *> selectedCards);