fix(game): update updateStateByDraw to correctly adjust player's card count

This commit is contained in:
Kieran Kihn
2025-11-17 13:58:34 +08:00
parent 8ef3962451
commit d074feaaa0

View File

@@ -256,9 +256,14 @@ namespace UNO::GAME {
template<PlayerStateTypeConcept PlayerStateType>
void GameState<PlayerStateType>::updateStateByDraw()
{
if (this->drawCount_ != 0) {
this->drawCount_ = 0;
if (this->drawCount_ == 0) {
this->currentPlayer_->setRemainingCardCount(this->currentPlayer_->getRemainingCardCount() + 1);
}
else {
this->currentPlayer_->setRemainingCardCount((this->currentPlayer_->getRemainingCardCount() + this->drawCount_));
}
this->drawCount_ = 0;
this->nextPlayer();
}
class ClientGameState final : public GameState<ClientPlayerState> {