[Game] Refactor: move proliferate action code to PlayerActions (#6926)

This commit is contained in:
RickyRister 2026-05-22 01:25:00 -07:00 committed by GitHub
parent 81a2712b92
commit 09d817770e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 39 additions and 38 deletions

View file

@ -304,42 +304,6 @@ CounterState *PlayerLogic::getLifeCounter() const
return nullptr;
}
void PlayerLogic::incrementAllCardCounters()
{
auto cardsToUpdate = getGameScene()->selectedCards();
if (cardsToUpdate.isEmpty()) {
// If no cards selected, update all cards on table
cardsToUpdate = static_cast<QList<CardItem *>>(getTableZone()->getCards());
}
QList<const ::google::protobuf::Message *> commandList;
for (const auto *card : cardsToUpdate) {
const auto &cardCounters = card->getCounters();
QMapIterator<int, int> counterIterator(cardCounters);
while (counterIterator.hasNext()) {
counterIterator.next();
int counterId = counterIterator.key();
int currentValue = counterIterator.value();
if (currentValue >= MAX_COUNTERS_ON_CARD) {
continue;
}
auto cmd = std::make_unique<Command_SetCardCounter>();
cmd->set_zone(card->getZone()->getName().toStdString());
cmd->set_card_id(card->getId());
cmd->set_counter_id(counterId);
cmd->set_counter_value(currentValue + 1);
commandList.append(cmd.release());
}
}
if (!commandList.isEmpty()) {
playerActions->sendGameCommand(playerActions->prepareGameCommand(commandList));
}
}
bool PlayerLogic::clearCardsToDelete()
{
if (cardsToDelete.isEmpty()) {