diff options
-rw-r--r-- | server/standard.cpp | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/server/standard.cpp b/server/standard.cpp index 8192152..78367b5 100644 --- a/server/standard.cpp +++ b/server/standard.cpp @@ -438,10 +438,62 @@ bool Standard::round_action(Action action) { } break; case Action::Pon: { - + Tile left_tile = game_state.players[current_player].pond.back(); + left_tile.rotated = true; + game_state.players[action.player].open.push_back(left_tile); + + int count = 0; + for(std::vector<int>::iterator it = most_value_action.target.begin(); it != most_value_action.target.end(); ++it) { + Tile target_tile = game_state.players[action.player].hand[(*it) - count]; + game_state.players[action.player].open.push_back(target_tile); + game_state.players[action.player].hand.erase(game_state.players[action.player].hand.begin() + (*it) - count); + + count++; + } + + Action discard; + discard.type = Action::Discard; + discard.player = action.player; + game_state.possible_actions.push_back(discard); + + draw_phase = false;//player must discard extra tile + + //Player steals round + if(current_player == 0) { + current_player = 3; + } else { + current_player = action.player-1; + } + } break; case Action::Kan: { + Tile left_tile = game_state.players[current_player].pond.back(); + left_tile.rotated = true; + game_state.players[action.player].open.push_back(left_tile); + + int count = 0; + for(std::vector<int>::iterator it = most_value_action.target.begin(); it != most_value_action.target.end(); ++it) { + Tile target_tile = game_state.players[action.player].hand[(*it) - count]; + game_state.players[action.player].open.push_back(target_tile); + game_state.players[action.player].hand.erase(game_state.players[action.player].hand.begin() + (*it) - count); + + count++; + } + + Action discard; + discard.type = Action::Discard; + discard.player = action.player; + game_state.possible_actions.push_back(discard); + + draw_phase = false;//player must discard extra tile + + //Player steals round + if(current_player == 0) { + current_player = 3; + } else { + current_player = action.player-1; + } } break; |