mirror of
https://github.com/kierankihn/uno-game.git
synced 2025-12-27 02:13:18 +08:00
fix(game): update updateStateByDraw to correctly adjust player's card count
This commit is contained in:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user