Refactor: removed dead code and standarized to camelCase
This commit is contained in:
@@ -321,12 +321,12 @@ public class Game implements Serializable {
|
||||
/**
|
||||
* Returns the player with the specified username, if present.
|
||||
*
|
||||
* @param Username the username of the player to search for.
|
||||
* @param username the username of the player to search for.
|
||||
* @return the player with the specified username, or {@code null} if no such player exists.
|
||||
* @throws IndexOutOfBoundsException if an index access error occurs.
|
||||
*/
|
||||
public Player getPlayerByUsername(String Username) throws IndexOutOfBoundsException {
|
||||
return playersList.stream().filter(x->x.getUserName().equals(Username)).findFirst().orElse(null);
|
||||
public Player getPlayerByUsername(String username) throws IndexOutOfBoundsException {
|
||||
return playersList.stream().filter(x->x.getUserName().equals(username)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -493,7 +493,7 @@ public class Game implements Serializable {
|
||||
if(currentState.getNUpper() <1 && currentState.getGameStage()==GameStages.RES_ACTIONS)
|
||||
return false;
|
||||
TribeCard tribeCard = board.upperListTribe.get(cardIndex);
|
||||
if(tribeCard.IsEventCard())
|
||||
if(tribeCard.isEventCard())
|
||||
return false;
|
||||
|
||||
Character tempCard = (Character) tribeCard;
|
||||
@@ -578,7 +578,7 @@ public class Game implements Serializable {
|
||||
if(currentState.getNLower() <1)
|
||||
return false;
|
||||
TribeCard tribeCard = board.lowerListTribe.get(cardIndex);
|
||||
if(tribeCard.IsEventCard())
|
||||
if(tribeCard.isEventCard())
|
||||
return false;
|
||||
|
||||
Character tempCard = (Character) tribeCard;
|
||||
@@ -868,7 +868,7 @@ public class Game implements Serializable {
|
||||
*/
|
||||
private boolean hasDrawableUp()
|
||||
{
|
||||
return getUpperListTribeCards().stream().anyMatch(x -> !x.IsEventCard());
|
||||
return getUpperListTribeCards().stream().anyMatch(x -> !x.isEventCard());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -879,7 +879,7 @@ public class Game implements Serializable {
|
||||
*/
|
||||
private boolean hasDrawableDown()
|
||||
{
|
||||
return getLowerListTribeCards().stream().anyMatch(x -> !x.IsEventCard());
|
||||
return getLowerListTribeCards().stream().anyMatch(x -> !x.isEventCard());
|
||||
}
|
||||
/**
|
||||
* Resolves all pending event cards if the current game stage is {@code RESOLVING_EVENT}.
|
||||
@@ -915,13 +915,6 @@ public class Game implements Serializable {
|
||||
private void nextRound() {
|
||||
|
||||
EventResolution();
|
||||
if(currentState.getRound()==10)
|
||||
{
|
||||
currentState.GameStageUpdate(GameStages.ENDING);
|
||||
endGame();
|
||||
return;
|
||||
}
|
||||
|
||||
if(currentState.getEra()!= board.nextRound()) {
|
||||
currentState.EraUpdate();
|
||||
}
|
||||
@@ -936,7 +929,7 @@ public class Game implements Serializable {
|
||||
*/
|
||||
private void endGame() {
|
||||
Queue<EventCard> events;
|
||||
events=Stream.concat(board.lowerListTribe.stream().filter(TribeCard::IsEventCard),board.upperListTribe.stream().filter(TribeCard::IsEventCard)).map(x->((EventCard)x)).collect(Collectors.toCollection(LinkedList::new));
|
||||
events=Stream.concat(board.lowerListTribe.stream().filter(TribeCard::isEventCard),board.upperListTribe.stream().filter(TribeCard::isEventCard)).map(x->((EventCard)x)).collect(Collectors.toCollection(LinkedList::new));
|
||||
ArrayList<EventCard>sustenance=events.stream().filter(x->x.getType().equals(EventType.SUSTENANCE)).collect(Collectors.toCollection(ArrayList::new));
|
||||
events.removeAll(sustenance);
|
||||
events.forEach(event->event.activateEvent(playersList));
|
||||
|
||||
Reference in New Issue
Block a user