Fix: only one skipAction(Del:SkipLower/SkipUpper)
This commit is contained in:
@@ -145,16 +145,16 @@ public class ClientController {
|
||||
|
||||
|
||||
/**
|
||||
* Requests to skip drawing from the upper list.
|
||||
* This action is available only when the upper list is empty or the player cannot draw any card.
|
||||
* Requests to skip turn .
|
||||
* This action is available only when the player cannot draw any tribe card.
|
||||
* @param playerUsername the name of the player performing the action
|
||||
*/
|
||||
public void skipUpper(String playerUsername) {
|
||||
public void skipTurn(String playerUsername) {
|
||||
if(!Objects.equals(playerUsername, localController.getModel().getCurrentState().getCurrentPlayer().getUserName()))
|
||||
view.showError("It's not your turn!");
|
||||
else {
|
||||
try {
|
||||
client.skipUpper(playerUsername);
|
||||
client.skipTurn(playerUsername);
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -162,22 +162,6 @@ public class ClientController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Requests to skip drawing from the lower list.
|
||||
* This action is available only when the lower list is empty or the player cannot draw any card.
|
||||
* @param playerUsername the name of the player performing the action
|
||||
*/
|
||||
public void skipLower(String playerUsername) {
|
||||
if(!Objects.equals(playerUsername, localController.getModel().getCurrentState().getCurrentPlayer().getUserName()))
|
||||
view.showError("It's not your turn!");
|
||||
else {
|
||||
try {
|
||||
client.skipLower(playerUsername);
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -119,32 +119,19 @@ public class GameController {
|
||||
return model.DrawLowerBuildingCardByIndex(model.getPlayerByUsername(playerUsername), pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Skips the upper card drawing action for the specified player.
|
||||
*
|
||||
* @param playerUsername the username of the player who wants to skip the upper drawing action.
|
||||
* @return {@code true} if the skip action is valid and successfully performed;
|
||||
* {@code false} if the player does not exist or the action is not valid.
|
||||
*/
|
||||
public boolean SkipUpperDrawing(String playerUsername) {
|
||||
Player player= model.getPlayerByUsername(playerUsername);
|
||||
if(player==null)
|
||||
return false;
|
||||
return model.SkipUpperDrawing(model.getPlayerByUsername(playerUsername));
|
||||
}
|
||||
|
||||
/**
|
||||
* Skips the lower card drawing action for the specified player.
|
||||
* Skips the card drawing action for the specified player.
|
||||
*
|
||||
* @param playerUsername the username of the player who wants to skip the lower drawing action.
|
||||
* @param playerUsername the username of the player who wants to skip the turn action.
|
||||
* @return {@code true} if the skip action is valid and successfully performed;
|
||||
* {@code false} if the player does not exist or the action is not valid.
|
||||
*/
|
||||
public boolean SkipLowerDrawing(String playerUsername) {
|
||||
public boolean SkipNoDrawable(String playerUsername) {
|
||||
Player player= model.getPlayerByUsername(playerUsername);
|
||||
if(player==null)
|
||||
return false;
|
||||
return model.SkipLowerDrawing(model.getPlayerByUsername(playerUsername));
|
||||
return model.SkipNoDrawable(model.getPlayerByUsername(playerUsername));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user