Removed: PickOptionalTribeCard and PickOptionalBuildingCard in Game and GameController

This commit is contained in:
rubenpirreram
2026-05-17 16:32:42 +02:00
parent d9ef7983f8
commit 4b4614d17e
8 changed files with 90 additions and 205 deletions
@@ -142,54 +142,14 @@ public class GameController {
* @return {@code true} if the skip action is valid and successfully performed; * @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. * {@code false} if the player does not exist or the action is not valid.
*/ */
public boolean SkipNoDrawable(String playerUsername) { public boolean SkipTurn(String playerUsername) {
Player player= model.getPlayerByUsername(playerUsername); Player player= model.getPlayerByUsername(playerUsername);
if(player==null) if(player==null)
return false; return false;
return model.SkipNoDrawable(model.getPlayerByUsername(playerUsername)); return model.SkipTurn(model.getPlayerByUsername(playerUsername));
} }
/**
* Attempts to pick an optional tribe card for the specified player from the specified position.
*
* @param playerUsername the username of the player performing the action.
* @param pos the position of the optional tribe card to pick.
* @return {@code true} if the action succeeds, {@code false} if the player does not exist
* or if the pick operation fails.
*/
public boolean pickOptionalTribeCard(String playerUsername,int pos) {
Player player= model.getPlayerByUsername(playerUsername);
if(player==null)
return false;
return model.PickOptionalTribeCardByIndex(model.getPlayerByUsername(playerUsername), pos);
}
/**
* Attempts to pick an optional building card for the specified player from the specified position.
*
* @param playerUsername the username of the player performing the action.
* @param pos the position of the optional building card to pick.
* @return {@code true} if the action succeeds, {@code false} if the player does not exist
* or if the pick operation fails.
*/
public boolean pickOptionalBuildingCard(String playerUsername,int pos) {
Player player= model.getPlayerByUsername(playerUsername);
if(player==null)
return false;
return model.PickOptionalBuildingCard(model.getPlayerByUsername(playerUsername), pos);
}
/**
* Refuse to pick an optional building card for the specified player.
* @param playerUsername the username of the player performing the action.
* @return {@code true} if the action succeeds, {@code false} if the player does not exist
* or if the pick operation fails.
*/
public boolean noOptionalCard(String playerUsername) {
Player player= model.getPlayerByUsername(playerUsername);
if(player==null)
return false;
return model.NoOptionalCard(model.getPlayerByUsername(playerUsername));
}
/** /**
* Attempts to perform the slot choice action for the specified player at the specified position. * Attempts to perform the slot choice action for the specified player at the specified position.
@@ -411,11 +411,12 @@ public class Game implements Serializable {
* @param player the player performing the draw. * @param player the player performing the draw.
* @param cardIndex the index of the upper tribe card to draw. * @param cardIndex the index of the upper tribe card to draw.
* @return {@code true} if the draw succeeds, {@code false} otherwise. * @return {@code true} if the draw succeeds, {@code false} otherwise.
* TODO
*/ */
public boolean DrawUpperTribeCardByIndex(Player player,int cardIndex) { public boolean DrawUpperTribeCardByIndex(Player player,int cardIndex) {
if( cardIndex<0 || cardIndex >=board.upperListTribe.size()) if( cardIndex<0 || cardIndex >=board.upperListTribe.size())
return false; return false;
if(currentState.getGameStage()!= GameStages.RES_ACTIONS) if(currentState.getGameStage()!= GameStages.RES_ACTIONS && currentState.getGameStage()!=GameStages.OPT_CARD_E)
{ {
return false; return false;
} }
@@ -423,7 +424,7 @@ public class Game implements Serializable {
{ {
return false; return false;
} }
if(currentState.getNUpper() <1) if(currentState.getNUpper() <1 && currentState.getGameStage()==GameStages.RES_ACTIONS)
return false; return false;
TribeCard tribeCard = board.upperListTribe.get(cardIndex); TribeCard tribeCard = board.upperListTribe.get(cardIndex);
if(tribeCard.IsEventCard()) if(tribeCard.IsEventCard())
@@ -432,9 +433,17 @@ public class Game implements Serializable {
Character tempCard = (Character) tribeCard; Character tempCard = (Character) tribeCard;
tempCard.insert(player); tempCard.insert(player);
board.removeUpperTribeCard(tempCard); board.removeUpperTribeCard(tempCard);
if(currentState.getGameStage()==GameStages.RES_ACTIONS)
{
currentState.UpperDrawn(); currentState.UpperDrawn();
if((currentState.getNLower() ==0 ||( !hasDrawableDown() && getLowerListBuilding().isEmpty())) && ((currentState.getNUpper() ==0)||(!hasDrawableUp() && getUpperListBuilding().isEmpty()))) if((currentState.getNLower() ==0 ||( !hasDrawableDown() && getLowerListBuilding().isEmpty())) && ((currentState.getNUpper() ==0)||(!hasDrawableUp() && getUpperListBuilding().isEmpty())))
nextPlayerSetup(); nextPlayerSetup();
}
else
{
nextPlayerSetup();
}
return true; return true;
} }
@@ -447,8 +456,8 @@ public class Game implements Serializable {
* @param player the player skipping the turn . * @param player the player skipping the turn .
* @return {@code true} if the skip succeeds, {@code false} otherwise. * @return {@code true} if the skip succeeds, {@code false} otherwise.
*/ */
public boolean SkipNoDrawable(Player player) { public boolean SkipTurn(Player player) {
if(currentState.getGameStage()!= GameStages.RES_ACTIONS) if(currentState.getGameStage()!= GameStages.RES_ACTIONS && !currentState.getGameStage().equals(GameStages.OPT_CARD_E))
{ {
return false; return false;
} }
@@ -456,6 +465,8 @@ public class Game implements Serializable {
{ {
return false; return false;
} }
if(currentState.getGameStage()==GameStages.RES_ACTIONS)
{
if(hasDrawableDown() && currentState.getNLower()>0 ) if(hasDrawableDown() && currentState.getNLower()>0 )
return false; return false;
if(hasDrawableUp() && currentState.getNUpper()>0) if(hasDrawableUp() && currentState.getNUpper()>0)
@@ -465,6 +476,10 @@ public class Game implements Serializable {
while(currentState.getNUpper()>0) while(currentState.getNUpper()>0)
currentState.UpperDrawn(); currentState.UpperDrawn();
nextPlayerSetup(); nextPlayerSetup();
}
else {
nextPlayerSetup();
}
return true; return true;
} }
@@ -525,7 +540,7 @@ public class Game implements Serializable {
public boolean DrawUpperBuildingCardByIndex(Player player,int cardIndex) { public boolean DrawUpperBuildingCardByIndex(Player player,int cardIndex) {
if( cardIndex<0 || cardIndex >=board.upperListBuilding.size()) if( cardIndex<0 || cardIndex >=board.upperListBuilding.size())
return false; return false;
if(currentState.getGameStage()!= GameStages.RES_ACTIONS) if(currentState.getGameStage()!= GameStages.RES_ACTIONS && currentState.getGameStage()!=GameStages.OPT_CARD_E)
{ {
return false; return false;
} }
@@ -534,18 +549,23 @@ public class Game implements Serializable {
return false; return false;
} }
BuildingCard buildingCard = board.upperListBuilding.get(cardIndex); BuildingCard buildingCard = board.upperListBuilding.get(cardIndex);
if(currentState.getNUpper() <1) if(currentState.getNUpper() <1 && currentState.getGameStage()==GameStages.RES_ACTIONS)
return false; return false;
if(buildingCard.buy(player)) if(!buildingCard.buy(player))
{
return false;
}
board.removeUpperBuildingCard(buildingCard);
if(currentState.getGameStage().equals(GameStages.RES_ACTIONS))
{ {
currentState.UpperDrawn(); currentState.UpperDrawn();
board.removeUpperBuildingCard(buildingCard);
}
else
return false;
if((currentState.getNLower() ==0 ||( !hasDrawableDown() && getLowerListBuilding().isEmpty())) && ((currentState.getNUpper() ==0)||(!hasDrawableUp() && getUpperListBuilding().isEmpty()))) if((currentState.getNLower() ==0 ||( !hasDrawableDown() && getLowerListBuilding().isEmpty())) && ((currentState.getNUpper() ==0)||(!hasDrawableUp() && getUpperListBuilding().isEmpty())))
nextPlayerSetup(); nextPlayerSetup();
}
else
{
nextPlayerSetup();
}
return true; return true;
} }
@@ -594,98 +614,6 @@ public class Game implements Serializable {
//region Optional Card Methods //region Optional Card Methods
/**
* Attempts to pick the upper optional tribe card at the specified index for the specified player.
* The operation succeeds only if the current game stage is {@code OPTIONAL_CARD_EFFECT},
* the specified player is the current player, the index is valid,
* and the selected tribe card is not an event card.
* If successful, the card is inserted into the player's collection,
* removed from the board, the player is removed from the optional card queue,
* and the next player setup is triggered.
*
* @param player the player performing the optional tribe card pick.
* @param cardIndex the index of the upper optional tribe card to pick.
* @return {@code true} if the operation succeeds, {@code false} otherwise.
*/
public boolean PickOptionalTribeCardByIndex(Player player,int cardIndex) {
if(currentState.getGameStage() != GameStages.OPT_CARD_E){
return false;
}
if(!player.equals(currentState.getCurrentPlayer())){
return false;
}
if( cardIndex<0 || cardIndex >=board.upperListTribe.size())
return false;
TribeCard tribeCard = board.upperListTribe.get(cardIndex);
if(tribeCard.IsEventCard())
return false;
Character tempCard = (Character) tribeCard;
tempCard.insert(player);
board.removeUpperTribeCard(tempCard);
OptionalCardQueue.removeIf(x->x.equals(player));
nextPlayerSetup();
return true;
}
/**
* Attempts to pick the upper optional building card at the specified index for the specified player.
* The operation succeeds only if the current game stage is {@code OPTIONAL_CARD_EFFECT},
* the specified player is the current player, the index is valid,
* and the selected building card can be bought by the player.
* If successful, the card is removed from the board, the next player setup is triggered,
* and the player is removed from the optional card queue.
*
* @param player the player performing the optional building card pick.
* @param cardIndex the index of the upper optional building card to pick.
* @return {@code true} if the operation succeeds, {@code false} otherwise.
*/
public boolean PickOptionalBuildingCard(Player player, int cardIndex) {
if(currentState.getGameStage() != GameStages.OPT_CARD_E){
return false;
}
if(!player.equals(currentState.getCurrentPlayer())){
return false;
}
if( cardIndex<0 || cardIndex >=board.upperListBuilding.size())
return false;
BuildingCard buildingCard = board.upperListBuilding.get(cardIndex);
if(buildingCard.buy(player)) {
board.removeUpperBuildingCard(buildingCard);
}
else {
return false;
}
OptionalCardQueue.removeIf(x->x.equals(player));
nextPlayerSetup();
return true;
}
/**
* Skips the optional card choice for the specified player.
* The operation succeeds only if the current game stage is {@code OPTIONAL_CARD_EFFECT}
* and the specified player is the current player.
* If successful, the player is removed from the optional card queue
* and the next player setup is triggered.
*
* @param player the player skipping the optional card choice.
* @return {@code true} if the operation succeeds, {@code false} otherwise.
*/
public boolean NoOptionalCard(Player player) {
if(currentState.getGameStage() != GameStages.OPT_CARD_E){
return false;
}
if(!player.equals(currentState.getCurrentPlayer())){
return false;
}
OptionalCardQueue.removeIf(x->x.equals(player));
nextPlayerSetup();
return true;
}
//endregion //endregion
//endregion //endregion
@@ -4,7 +4,6 @@ import it.polimi.ingsw.gc14.Controller.GameController;
import it.polimi.ingsw.gc14.Model.MiniModel; import it.polimi.ingsw.gc14.Model.MiniModel;
import it.polimi.ingsw.gc14.Network.EventType; import it.polimi.ingsw.gc14.Network.EventType;
import it.polimi.ingsw.gc14.Network.NetworkEvent; import it.polimi.ingsw.gc14.Network.NetworkEvent;
import it.polimi.ingsw.gc14.View.IView;
import java.io.Serializable; import java.io.Serializable;
@@ -28,7 +27,7 @@ public class NoOptionalCard extends NetworkEvent implements Serializable{
*/ */
@Override @Override
public boolean apply(GameController gameController){ public boolean apply(GameController gameController){
return gameController.noOptionalCard(username); return gameController.SkipTurn(username);
} }
//TODO //TODO
@Override @Override
@@ -4,7 +4,6 @@ import it.polimi.ingsw.gc14.Controller.GameController;
import it.polimi.ingsw.gc14.Model.MiniModel; import it.polimi.ingsw.gc14.Model.MiniModel;
import it.polimi.ingsw.gc14.Network.EventType; import it.polimi.ingsw.gc14.Network.EventType;
import it.polimi.ingsw.gc14.Network.NetworkEvent; import it.polimi.ingsw.gc14.Network.NetworkEvent;
import it.polimi.ingsw.gc14.View.IView;
import java.io.Serializable; import java.io.Serializable;
@@ -33,7 +32,7 @@ public class PickOptionalBuildingCard extends NetworkEvent implements Serializa
*/ */
@Override @Override
public boolean apply(GameController gameController){ public boolean apply(GameController gameController){
return gameController.pickOptionalBuildingCard(username, pos); return gameController.drawUpperBuildingCard(username, pos);
} }
//TODO //TODO
@Override @Override
@@ -4,7 +4,6 @@ import it.polimi.ingsw.gc14.Controller.GameController;
import it.polimi.ingsw.gc14.Model.MiniModel; import it.polimi.ingsw.gc14.Model.MiniModel;
import it.polimi.ingsw.gc14.Network.EventType; import it.polimi.ingsw.gc14.Network.EventType;
import it.polimi.ingsw.gc14.Network.NetworkEvent; import it.polimi.ingsw.gc14.Network.NetworkEvent;
import it.polimi.ingsw.gc14.View.IView;
import java.io.Serializable; import java.io.Serializable;
@@ -33,7 +32,7 @@ public class PickOptionalTribeCard extends NetworkEvent implements Serializable
*/ */
@Override @Override
public boolean apply(GameController gameController){ public boolean apply(GameController gameController){
return gameController.pickOptionalTribeCard(username, pos); return gameController.drawUpperTribeCard(username, pos);
} }
//TODO //TODO
@@ -27,7 +27,7 @@ public class SkipNoDrawable extends NetworkEvent implements Serializable{
*/ */
@Override @Override
public boolean apply(GameController gameController){ public boolean apply(GameController gameController){
return gameController.SkipNoDrawable(username); return gameController.SkipTurn(username);
} }
//TODO //TODO
@@ -149,7 +149,7 @@ class GameControllerTest {
if (game.getCurrentState().getNUpper() == 0 if (game.getCurrentState().getNUpper() == 0
|| game.getUpperListTribeCards().stream().allMatch(TribeCard::IsEventCard)) { || game.getUpperListTribeCards().stream().allMatch(TribeCard::IsEventCard)) {
assertTrue(controller.SkipNoDrawable(username)); assertTrue(controller.SkipTurn(username));
return; return;
} }
} }
@@ -172,7 +172,7 @@ class GameControllerTest {
if (game.getCurrentState().getNLower() == 0 if (game.getCurrentState().getNLower() == 0
|| game.getLowerListTribeCards().stream().allMatch(TribeCard::IsEventCard)) { || game.getLowerListTribeCards().stream().allMatch(TribeCard::IsEventCard)) {
assertTrue(controller.SkipNoDrawable(username)); assertTrue(controller.SkipTurn(username));
return; return;
} }
} }
@@ -289,10 +289,10 @@ class GameControllerTest {
assertFalse(controller.drawLowerTribeCard("ghost", 0)); assertFalse(controller.drawLowerTribeCard("ghost", 0));
assertFalse(controller.drawUpperBuildingCard("ghost", 0)); assertFalse(controller.drawUpperBuildingCard("ghost", 0));
assertFalse(controller.drawLowerBuildingCard("ghost", 0)); assertFalse(controller.drawLowerBuildingCard("ghost", 0));
assertFalse(controller.SkipNoDrawable("ghost")); assertFalse(controller.SkipTurn("ghost"));
assertFalse(controller.pickOptionalTribeCard("ghost", 0)); assertFalse(controller.drawUpperTribeCard("ghost", 0));
assertFalse(controller.pickOptionalBuildingCard("ghost", 0)); assertFalse(controller.drawUpperBuildingCard("ghost", 0));
assertFalse(controller.noOptionalCard("ghost")); assertFalse(controller.SkipTurn("ghost"));
assertFalse(controller.TotemChoice("ghost", Totems.values()[0].name())); assertFalse(controller.TotemChoice("ghost", Totems.values()[0].name()));
assertFalse(controller.DisconnectedPlayer("ghost")); assertFalse(controller.DisconnectedPlayer("ghost"));
assertFalse(controller.ReconnectPlayer("ghost")); assertFalse(controller.ReconnectPlayer("ghost"));
@@ -505,8 +505,8 @@ class GameControllerTest {
String cur = game.getCurrentState().getCurrentPlayer().getUserName(); String cur = game.getCurrentState().getCurrentPlayer().getUserName();
assertFalse(controller.pickOptionalTribeCard(cur, 0)); assertFalse(controller.drawUpperTribeCard(cur, 0));
assertFalse(controller.pickOptionalBuildingCard(cur, 0)); assertFalse(controller.drawUpperBuildingCard(cur, 0));
} }
@Test @Test
@@ -530,7 +530,7 @@ class GameControllerTest {
int charactersBefore = optionalPlayer.getTotCharacters(); int charactersBefore = optionalPlayer.getTotCharacters();
assertTrue(controller.pickOptionalTribeCard(optionalPlayer.getUserName(), index)); assertTrue(controller.drawUpperTribeCard(optionalPlayer.getUserName(), index));
assertEquals(charactersBefore + 1, optionalPlayer.getTotCharacters()); assertEquals(charactersBefore + 1, optionalPlayer.getTotCharacters());
} }
@@ -558,7 +558,7 @@ class GameControllerTest {
int foodBefore = optionalPlayer.getFoodValue(); int foodBefore = optionalPlayer.getFoodValue();
int buildingsBefore = optionalPlayer.buildingCards.size(); int buildingsBefore = optionalPlayer.buildingCards.size();
assertTrue(controller.pickOptionalBuildingCard(optionalPlayer.getUserName(), 0)); assertTrue(controller.drawUpperBuildingCard(optionalPlayer.getUserName(), 0));
assertTrue(optionalPlayer.getFoodValue() <= foodBefore); assertTrue(optionalPlayer.getFoodValue() <= foodBefore);
assertEquals(buildingsBefore + 1, optionalPlayer.buildingCards.size()); assertEquals(buildingsBefore + 1, optionalPlayer.buildingCards.size());
@@ -625,7 +625,7 @@ class GameControllerTest {
assertTrue(optionalPlayer.buildingCards.stream() assertTrue(optionalPlayer.buildingCards.stream()
.anyMatch(building -> building.getEffectId() == 12)); .anyMatch(building -> building.getEffectId() == 12));
assertTrue(controller.noOptionalCard(optionalPlayer.getUserName())); assertTrue(controller.SkipTurn(optionalPlayer.getUserName()));
} }
@Test @Test
@@ -666,11 +666,11 @@ class GameControllerTest {
String username = optionalPlayer.getUserName(); String username = optionalPlayer.getUserName();
assertFalse(controller.pickOptionalTribeCard(username, -1)); assertFalse(controller.drawUpperTribeCard(username, -1));
assertFalse(controller.pickOptionalTribeCard(username, 999)); assertFalse(controller.drawUpperTribeCard(username, 999));
assertFalse(controller.pickOptionalBuildingCard(username, -1)); assertFalse(controller.drawUpperBuildingCard(username, -1));
assertFalse(controller.pickOptionalBuildingCard(username, 999)); assertFalse(controller.drawUpperBuildingCard(username, 999));
} }
@Test @Test
@@ -693,9 +693,9 @@ class GameControllerTest {
assertNotNull(wrongPlayer); assertNotNull(wrongPlayer);
assertFalse(controller.pickOptionalTribeCard(wrongPlayer.getUserName(), 0)); assertFalse(controller.drawUpperTribeCard(wrongPlayer.getUserName(), 0));
assertFalse(controller.pickOptionalBuildingCard(wrongPlayer.getUserName(), 0)); assertFalse(controller.drawUpperBuildingCard(wrongPlayer.getUserName(), 0));
assertFalse(controller.noOptionalCard(wrongPlayer.getUserName())); assertFalse(controller.SkipTurn(wrongPlayer.getUserName()));
} }
@Test @Test
@@ -714,7 +714,7 @@ class GameControllerTest {
assertFalse(game.getLowerListTribeCards().isEmpty()); assertFalse(game.getLowerListTribeCards().isEmpty());
assertTrue(firstNonEventIndexOrMinusOne(game.getLowerListTribeCards()) != -1); assertTrue(firstNonEventIndexOrMinusOne(game.getLowerListTribeCards()) != -1);
assertFalse(controller.SkipNoDrawable(current.getUserName())); assertFalse(controller.SkipTurn(current.getUserName()));
} }
@Test @Test
@@ -733,7 +733,7 @@ class GameControllerTest {
assertFalse(game.getUpperListTribeCards().isEmpty()); assertFalse(game.getUpperListTribeCards().isEmpty());
assertTrue(firstNonEventIndexOrMinusOne(game.getUpperListTribeCards()) != -1); assertTrue(firstNonEventIndexOrMinusOne(game.getUpperListTribeCards()) != -1);
assertFalse(controller.SkipNoDrawable(current.getUserName())); assertFalse(controller.SkipTurn(current.getUserName()));
} }
@@ -119,7 +119,7 @@ class GameTest {
if(game.getCurrentState().getNUpper() == 0 || game.getUpperListTribeCards().stream().allMatch(TribeCard::IsEventCard)) if(game.getCurrentState().getNUpper() == 0 || game.getUpperListTribeCards().stream().allMatch(TribeCard::IsEventCard))
{ {
assertTrue(game.SkipNoDrawable(current)); assertTrue(game.SkipTurn(current));
return; return;
} }
@@ -140,7 +140,7 @@ class GameTest {
if(game.getCurrentState().getNLower() == 0 || game.getLowerListTribeCards().stream().allMatch(TribeCard::IsEventCard)) if(game.getCurrentState().getNLower() == 0 || game.getLowerListTribeCards().stream().allMatch(TribeCard::IsEventCard))
{ {
assertTrue(game.SkipNoDrawable(current)); assertTrue(game.SkipTurn(current));
return; return;
} }
} }
@@ -177,7 +177,7 @@ class GameTest {
Player current = game.getCurrentState().getCurrentPlayer(); Player current = game.getCurrentState().getCurrentPlayer();
assertNotNull(current); assertNotNull(current);
assertTrue(game.NoOptionalCard(current)); assertTrue(game.SkipTurn(current));
} }
} }
@@ -578,7 +578,7 @@ class GameTest {
int charactersBefore = current.getTotCharacters(); int charactersBefore = current.getTotCharacters();
assertTrue(game.PickOptionalTribeCardByIndex(current, index)); assertTrue(game.DrawUpperTribeCardByIndex(current, index));
assertEquals(charactersBefore + 1, current.getTotCharacters()); assertEquals(charactersBefore + 1, current.getTotCharacters());
} }
@@ -616,7 +616,7 @@ class GameTest {
int upperBuildingsBefore = game.getUpperListBuilding().size(); int upperBuildingsBefore = game.getUpperListBuilding().size();
int foodBefore = current.getFoodValue(); int foodBefore = current.getFoodValue();
assertTrue(game.PickOptionalBuildingCard(current, 0)); assertTrue(game.DrawUpperBuildingCardByIndex(current, 0));
assertEquals(buildingsBefore + 1, current.buildingCards.size()); assertEquals(buildingsBefore + 1, current.buildingCards.size());
assertEquals(upperBuildingsBefore - 1, game.getUpperListBuilding().size()); assertEquals(upperBuildingsBefore - 1, game.getUpperListBuilding().size());
@@ -651,7 +651,7 @@ class GameTest {
Player current = game.getCurrentState().getCurrentPlayer(); Player current = game.getCurrentState().getCurrentPlayer();
assertNotNull(current); assertNotNull(current);
assertTrue(game.NoOptionalCard(current)); assertTrue(game.SkipTurn(current));
assertEquals(GameStages.OPT_CARD_E, game.getCurrentState().getGameStage()); assertEquals(GameStages.OPT_CARD_E, game.getCurrentState().getGameStage());
assertNotEquals(current, game.getCurrentState().getCurrentPlayer()); assertNotEquals(current, game.getCurrentState().getCurrentPlayer());
@@ -785,9 +785,9 @@ class GameTest {
Player current = game.getCurrentState().getCurrentPlayer(); Player current = game.getCurrentState().getCurrentPlayer();
assertNotNull(current); assertNotNull(current);
assertFalse(game.PickOptionalTribeCardByIndex(current, 0)); assertFalse(game.DrawUpperTribeCardByIndex(current, 0));
assertFalse(game.PickOptionalBuildingCard(current, 0)); assertFalse(game.DrawUpperBuildingCardByIndex(current, 0));
assertFalse(game.NoOptionalCard(current)); assertFalse(game.SkipTurn(current));
} }
@Test @Test
@@ -806,15 +806,15 @@ class GameTest {
Player wrongPlayer = current.equals(players.get(0)) ? players.get(1) : players.get(0); Player wrongPlayer = current.equals(players.get(0)) ? players.get(1) : players.get(0);
assertFalse(game.PickOptionalTribeCardByIndex(wrongPlayer, 0)); assertFalse(game.DrawUpperTribeCardByIndex(wrongPlayer, 0));
assertFalse(game.PickOptionalBuildingCard(wrongPlayer, 0)); assertFalse(game.DrawUpperBuildingCardByIndex(wrongPlayer, 0));
assertFalse(game.NoOptionalCard(wrongPlayer)); assertFalse(game.SkipTurn(wrongPlayer));
assertFalse(game.PickOptionalTribeCardByIndex(current, -1)); assertFalse(game.DrawUpperTribeCardByIndex(current, -1));
assertFalse(game.PickOptionalTribeCardByIndex(current, 999)); assertFalse(game.DrawUpperTribeCardByIndex(current, 999));
assertFalse(game.PickOptionalBuildingCard(current, -1)); assertFalse(game.DrawUpperBuildingCardByIndex(current, -1));
assertFalse(game.PickOptionalBuildingCard(current, 999)); assertFalse(game.DrawUpperBuildingCardByIndex(current, 999));
} }
@@ -949,7 +949,7 @@ class GameTest {
Player current = game.getCurrentState().getCurrentPlayer(); Player current = game.getCurrentState().getCurrentPlayer();
assertNotNull(current); assertNotNull(current);
assertTrue(game.NoOptionalCard(current)); assertTrue(game.SkipTurn(current));
assertEquals(GameStages.SLOT_CHOICE, game.getCurrentState().getGameStage()); assertEquals(GameStages.SLOT_CHOICE, game.getCurrentState().getGameStage());
assertEquals(roundBefore + 1, game.getCurrentState().getRound()); assertEquals(roundBefore + 1, game.getCurrentState().getRound());
@@ -1009,7 +1009,7 @@ class GameTest {
"There must be at least one upper building card to test that the player cannot buy it." "There must be at least one upper building card to test that the player cannot buy it."
); );
assertFalse(game.PickOptionalBuildingCard(current, 0)); assertFalse(game.DrawUpperBuildingCardByIndex(current, 0));
} }
@Test @Test
@@ -1228,7 +1228,7 @@ class GameTest {
.findFirst() .findFirst()
.orElseThrow(); .orElseThrow();
assertFalse(game.SkipNoDrawable(wrongPlayer)); assertFalse(game.SkipTurn(wrongPlayer));
} }
@Test @Test
@@ -1255,7 +1255,7 @@ class GameTest {
"The test requires at least one drawable tribe card." "The test requires at least one drawable tribe card."
); );
assertFalse(game.SkipNoDrawable(current)); assertFalse(game.SkipTurn(current));
} }
@Test @Test
@@ -1282,7 +1282,7 @@ class GameTest {
int charactersBefore = current.getTotCharacters(); int charactersBefore = current.getTotCharacters();
int upperSizeBefore = game.getUpperListTribeCards().size(); int upperSizeBefore = game.getUpperListTribeCards().size();
assertFalse(game.PickOptionalTribeCardByIndex(current, eventIndex)); assertFalse(game.DrawUpperTribeCardByIndex(current, eventIndex));
assertEquals(GameStages.OPT_CARD_E, game.getCurrentState().getGameStage()); assertEquals(GameStages.OPT_CARD_E, game.getCurrentState().getGameStage());
assertEquals(current, game.getCurrentState().getCurrentPlayer()); assertEquals(current, game.getCurrentState().getCurrentPlayer());
@@ -1352,7 +1352,7 @@ class GameTest {
assertEquals(GameStages.SLOT_CHOICE, game.getCurrentState().getGameStage()); assertEquals(GameStages.SLOT_CHOICE, game.getCurrentState().getGameStage());
assertFalse(game.SkipNoDrawable(current)); assertFalse(game.SkipTurn(current));
} }
@Test @Test