diff --git a/src/main/java/it/polimi/ingsw/gc14/Controller/ClientController.java b/src/main/java/it/polimi/ingsw/gc14/Controller/ClientController.java index dd1ce2a..97cb658 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Controller/ClientController.java +++ b/src/main/java/it/polimi/ingsw/gc14/Controller/ClientController.java @@ -1,42 +1,39 @@ package it.polimi.ingsw.gc14.Controller; -import it.polimi.ingsw.gc14.Model.*; -import it.polimi.ingsw.gc14.Model.GamePackage.Board; -import it.polimi.ingsw.gc14.Model.GamePackage.CurrentState; +import it.polimi.ingsw.gc14.Model.MiniModel; import it.polimi.ingsw.gc14.Network.IClient; -import it.polimi.ingsw.gc14.Network.NetworkEvents.*; import it.polimi.ingsw.gc14.View.IView; -import java.rmi.RemoteException; -import java.util.Map; import java.util.Objects; /** - * Controller class that holds all the components of the client, such as view, network client and Game Controller. - * It provides methods to set the client components and to execute requested actions. + * Controller responsible for coordinating the client-side components, + * including the view, the network client and the local mini model. + * + *

It receives user actions from the view, performs basic client-side + * checks and forwards valid requests to the network client. */ public class ClientController { - /** Game Controller of the client */ + /** Local mini model representing the client-side game state. */ public MiniModel miniModel; - /** View of the client */ + /** View of the client. */ public IView view; - /** Network client (either TCP or RMI) */ + /** Network client, either TCP or RMI. */ private IClient client; - /** - * The username of the client associated with this event. - */ + /** Username associated with this client. */ public String myUsername; - - /** - * Constructs the ClientController. - * Initializes all attributes. - * @param view the client view (either TUI or GUI) + * Constructs a client controller with the specified view. + * + *

The network client is initially unset and an empty local mini model + * is created. + * + * @param view the client view, either TUI or GUI. */ public ClientController(IView view) { this.view = view; @@ -44,19 +41,19 @@ public class ClientController { this.miniModel = new MiniModel(); } - /** * Sets the network client. - * @param client the client to set (either TCP or RMI) + * + * @param client the client to set, either TCP or RMI. */ public void setClient(IClient client) { this.client = client; } - /** - * Sets the model in the GameController and updates the view. - * @param model the model to set + * Sets the local mini model and updates the view accordingly. + * + * @param model the mini model to set. */ public void setModel(MiniModel model) { this.miniModel = model; @@ -64,131 +61,139 @@ public class ClientController { } /** - * Sets the username of the client associated with this event. + * Sets the username associated with this client. * * @param username the username to set. */ - public void setMyUsername (String username) { - this.myUsername=username; + public void setMyUsername(String username) { + this.myUsername = username; } - /** * Displays an error message in the view. - * @param message the error message to display + * + * @param message the error message to display. */ public void onError(String message) { view.showError(message); } - /** * Requests to draw a tribe card from the upper list. - * Creates a NetworkEvent and sends it through the network client. - * @param playerUsername the name of the player performing the action - * @param pos the index of the card to draw + * + *

If the specified player is not the current player, an error message + * is shown. Otherwise, the request is forwarded to the network client. + * + * @param playerUsername the username of the player performing the action. + * @param pos the index of the card to draw. */ public void drawUpperTribeCard(String playerUsername, int pos) { - - if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName())) - { + if (!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName())) { view.showError("It's not your turn!"); - } - else - { + } else { client.drawUpperTribeCard(playerUsername, pos); } } - /** * Requests to draw a tribe card from the lower list. - * Creates a NetworkEvent and sends it through the network client. - * @param playerUsername the name of the player performing the action - * @param pos the index of the card to draw + * + *

If the specified player is not the current player, an error message + * is shown. Otherwise, the request is forwarded to the network client. + * + * @param playerUsername the username of the player performing the action. + * @param pos the index of the card to draw. */ - public void drawLowerTribeCard(String playerUsername,int pos) { - if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName())) + public void drawLowerTribeCard(String playerUsername, int pos) { + if (!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName())) { view.showError("It's not your turn!"); - else + } else { client.drawLowerTribeCard(playerUsername, pos); + } } - /** * Requests to draw a building card from the upper list. - * Creates a NetworkEvent and sends it through the network client. - * @param playerUsername the name of the player performing the action - * @param pos the index of the card to draw + * + *

If the specified player is not the current player, an error message + * is shown. Otherwise, the request is forwarded to the network client. + * + * @param playerUsername the username of the player performing the action. + * @param pos the index of the card to draw. */ - public void drawUpperBuildingCard(String playerUsername,int pos) { - if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName())) + public void drawUpperBuildingCard(String playerUsername, int pos) { + if (!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName())) { view.showError("It's not your turn!"); - else { - client.drawUpperBuildingCard(playerUsername,pos); + } else { + client.drawUpperBuildingCard(playerUsername, pos); } - } - /** * Requests to draw a building card from the lower list. - * Creates a NetworkEvent and sends it through the network client. - * @param playerUsername the name of the player performing the action - * @param pos the index of the card to draw + * + *

If the specified player is not the current player, an error message + * is shown. Otherwise, the request is forwarded to the network client. + * + * @param playerUsername the username of the player performing the action. + * @param pos the index of the card to draw. */ - public void drawLowerBuildingCard(String playerUsername,int pos) { - if(!Objects.equals(playerUsername,miniModel.currentState.getCurrentPlayer().getUserName())) + public void drawLowerBuildingCard(String playerUsername, int pos) { + if (!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName())) { view.showError("It's not your turn!"); - else { - client.drawLowerBuildingCard(playerUsername,pos); + } else { + client.drawLowerBuildingCard(playerUsername, pos); } } - /** - * 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 + * Requests to skip the current turn. + * + *

If the specified player is not the current player, an error message + * is shown. Otherwise, the request is forwarded to the network client. + * + * @param playerUsername the username of the player performing the action. */ public void skipTurn(String playerUsername) { - if(!Objects.equals(playerUsername,miniModel.currentState.getCurrentPlayer().getUserName())) + if (!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName())) { view.showError("It's not your turn!"); - else { + } else { client.skipTurn(playerUsername); } } - /** - * Used to perform the slot choice action for the specified player at the specified position. - * @param playerUsername the name of the player performing the action - * @param pos the index of the selected slot + * Requests the selection of a slot by the specified player. + * + *

If the specified player is not the current player, an error message + * is shown. Otherwise, the request is forwarded to the network client. + * + * @param playerUsername the username of the player performing the action. + * @param pos the index of the selected slot. */ - public void slotChoice(String playerUsername,int pos) { - if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName())) + public void slotChoice(String playerUsername, int pos) { + if (!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName())) { view.showError("It's not your turn!"); - else { - client.slotChoice(playerUsername,pos); + } else { + client.slotChoice(playerUsername, pos); } } /** * Handles the selection of a totem by the specified player. * - *

If the player is not the current one, an error message is shown. - * Otherwise, the selected totem is retrieved from the available totems - * and the choice is forwarded to the client. + *

If the specified player is not the current player, an error message + * is shown. Otherwise, the selected totem is retrieved from the available + * totems list and the choice is forwarded to the network client. * * @param playerUsername the username of the player making the choice. - * @param pos the position of the selected totem in the available totems list. + * @param pos the index of the selected totem in the available totems list. */ - public void totemChoice(String playerUsername,int pos) { - if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName())) + public void totemChoice(String playerUsername, int pos) { + if (!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName())) { view.showError("It's not your turn!"); - else { + } else { client.totemChoice(playerUsername, String.valueOf(miniModel.availableTotems.get(pos))); } } - -} +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Controller/GameController.java b/src/main/java/it/polimi/ingsw/gc14/Controller/GameController.java index 382b2f6..25f42de 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Controller/GameController.java +++ b/src/main/java/it/polimi/ingsw/gc14/Controller/GameController.java @@ -5,9 +5,10 @@ import it.polimi.ingsw.gc14.Model.Player; import it.polimi.ingsw.gc14.Model.Totems; /** - * Controller class that manages interactions between the client-side logic - * and the {@link Game} model. - * It provides methods to add players and to perform game actions by delegating them to the model. + * Controller responsible for managing interactions with the {@link Game} model. + * + *

It provides methods to update the game state by delegating player-related + * actions and game actions to the underlying model. */ public class GameController { @@ -36,7 +37,8 @@ public class GameController { * * @param username the username of the player who disconnected. * @return {@code true} if the disconnection is handled successfully, - * {@code false} if no player with the specified username exists. + * {@code false} if no player with the specified username exists + * or if the operation fails. */ public boolean DisconnectedPlayer(String username) { @@ -51,7 +53,8 @@ public class GameController { * * @param username the username of the player who reconnected. * @return {@code true} if the reconnection is handled successfully, - * {@code false} if no player with the specified username exists. + * {@code false} if no player with the specified username exists + * or if the operation fails. */ public boolean ReconnectPlayer(String username) { @@ -83,19 +86,21 @@ public class GameController { * Attempts to add a new player with the specified username to the game model. * * @param username the username of the player to add. - * @return {@code true} if the player is successfully added, {@code false} otherwise. + * @return {@code true} if the player is successfully added, + * {@code false} otherwise. */ public boolean addPlayer(String username) { return model.addPlayer(new Player(username)); } /** - * Attempts to draw an upper tribe card for the specified player from the specified position. + * Attempts to draw an upper 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 upper tribe card to draw. - * @return {@code true} if the action succeeds, {@code false} if the player does not exist - * or if the draw operation fails. + * @return {@code true} if the action succeeds, + * {@code false} if the player does not exist or if the draw operation fails. */ public boolean drawUpperTribeCard(String playerUsername,int pos) { Player player= model.getPlayerByUsername(playerUsername); @@ -105,12 +110,13 @@ public class GameController { } /** - * Attempts to draw a lower tribe card for the specified player from the specified position. + * Attempts to draw a lower 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 lower tribe card to draw. - * @return {@code true} if the action succeeds, {@code false} if the player does not exist - * or if the draw operation fails. + * @return {@code true} if the action succeeds, + * {@code false} if the player does not exist or if the draw operation fails. */ public boolean drawLowerTribeCard(String playerUsername,int pos) { Player player= model.getPlayerByUsername(playerUsername); @@ -120,12 +126,13 @@ public class GameController { } /** - * Attempts to draw an upper building card for the specified player from the specified position. + * Attempts to draw an upper 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 upper building card to draw. - * @return {@code true} if the action succeeds, {@code false} if the player does not exist - * or if the draw operation fails. + * @return {@code true} if the action succeeds, + * {@code false} if the player does not exist or if the draw operation fails. */ public boolean drawUpperBuildingCard(String playerUsername,int pos) { Player player= model.getPlayerByUsername(playerUsername); @@ -135,12 +142,13 @@ public class GameController { } /** - * Attempts to draw a lower building card for the specified player from the specified position. + * Attempts to draw a lower 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 lower building card to draw. - * @return {@code true} if the action succeeds, {@code false} if the player does not exist - * or if the draw operation fails. + * @return {@code true} if the action succeeds, + * {@code false} if the player does not exist or if the draw operation fails. */ public boolean drawLowerBuildingCard(String playerUsername,int pos) { Player player= model.getPlayerByUsername(playerUsername); @@ -153,9 +161,9 @@ public class GameController { /** * Skips the card drawing action for the specified player. * - * @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. + * @param playerUsername the username of the player performing the action. + * @return {@code true} if the skip action is valid and successfully performed, + * {@code false} if the player does not exist or if the action is not valid. */ public boolean SkipTurn(String playerUsername) { Player player= model.getPlayerByUsername(playerUsername); @@ -167,12 +175,13 @@ public class GameController { /** - * 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. * * @param playerUsername the username of the player performing the action. * @param pos the position of the chosen slot. - * @return {@code true} if the action succeeds, {@code false} if the player does not exist - * or if the slot choice operation fails. + * @return {@code true} if the action succeeds, + * {@code false} if the player does not exist or if the slot choice operation fails. */ public boolean slotChoice(String playerUsername,int pos) { Player player= model.getPlayerByUsername(playerUsername); @@ -185,9 +194,10 @@ public class GameController { * Applies the totem choice made by the player associated with the specified username. * * @param playerUsername the username of the player making the choice. - * @param totem the name of the selected totem. + * @param totem the name of the selected totem. * @return {@code true} if the choice is handled successfully, - * {@code false} if no player with the specified username exists. + * {@code false} if no player with the specified username exists + * or if the choice operation fails. */ public boolean TotemChoice(String playerUsername,String totem) { Player player= model.getPlayerByUsername(playerUsername); @@ -195,4 +205,4 @@ public class GameController { return false; return model.TotemChoice(player, Totems.valueOf(totem)); } -} +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building0.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building0.java index 6d122eb..4c9bfb4 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building0.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building0.java @@ -8,28 +8,34 @@ import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType; /** - * From the moment you buy this building, every time you complete a set of 6 different characters, you gain 5 food. - * Note: sets of characters already present before purchasing the building do not count. + * Building effect that grants 5 food for each new complete set of + * 6 different character types obtained after purchasing this building. + * + *

Character sets already completed before the building is purchased + * are stored during initialization and do not provide food. */ public class Building0 extends BuildingCard { /** - * The purchased attribute is used to indicate whether the card has already been initialized. + * Indicates whether the building effect has already been initialized + * after purchase. */ boolean purchased ; /** - * The numSet attribute indicates how many complete sets the player has. + * Number of complete character sets already counted by this building effect. */ private int numSet; /** - * Constructor of the building. + * Creates a building with the specified image identifier, era, price + * and prestige value. * * @param idImage the image identifier of the building. * @param era the game era of the building. * @param price the price in food of the building. - * @param prestigeValue the number of Prestige Points gained from this building at the end of the game. + * @param prestigeValue the number of Prestige Points granted by this building + * at the end of the game. */ public Building0(String idImage,int era,int price,int prestigeValue) { super(idImage,era,price,prestigeValue); @@ -40,10 +46,12 @@ public class Building0 extends BuildingCard { } /** - * Constructor of the building - * @param era The game era of the building. - * @param price The price (in food) of the building. - * @param prestigeValue The number of Prestige Points gained from this building at the end of the game. + * Creates a building with the specified era, price and prestige value. + * + * @param era the game era of the building. + * @param price the price in food of the building. + * @param prestigeValue the number of Prestige Points granted by this building + * at the end of the game. */ public Building0(int era,int price,int prestigeValue) { super(era,price,prestigeValue); @@ -54,9 +62,12 @@ public class Building0 extends BuildingCard { } /** - * Method used to purchase the building. It also handles its initialization. - * @param player The player who buys the building. - * @return The outcome of the operation. + * Attempts to purchase the building and initializes its effect if the + * purchase succeeds. + * + * @param player the player who attempts to buy the building. + * @return {@code true} if the building is successfully purchased and initialized, + * {@code false} otherwise. */ @Override public boolean buy(Player player) @@ -68,9 +79,12 @@ public class Building0 extends BuildingCard { } /** - * Initializes the building by counting the number of complete sets at the moment of purchase. - * The building can only be initialized once. - * @param player The player who owns the building, whose cards are counted to determine the number of sets. + * Initializes the building effect by storing the number of complete + * character sets already owned by the player at the moment of purchase. + * + *

The initialization is performed only once. + * + * @param player the player who owns the building. */ public void initialize(Player player) { @@ -88,8 +102,13 @@ public class Building0 extends BuildingCard { } /** - * Method to clone the building: it creates an exact copy. - * @return The new copy of the building + * Creates a new building instance with the same configuration values + * as this card. + * + *

The runtime state of the effect, such as initialization status and + * counted character sets, is not copied. + * + * @return a new building card with the same base properties. */ @Override public BuildingCard clone() { @@ -97,10 +116,13 @@ public class Building0 extends BuildingCard { } /** - * Calculates the current number of card sets and subtracts the previous value (i.e., the number of newly obtained sets). - * The player gains an amount of food equal to 5 times this result. - * @param player The player who owns the building. - * @throws IllegalArgumentException thrown if the specified player does not own this card. + * Applies the building effect to the specified player. + * + *

The method counts the complete character sets currently owned by the player + * and grants 5 food for each set completed since the last stored value. + * + * @param player the player who owns the building. + * @throws IllegalArgumentException if the specified player does not own this card. */ @Override public void applyEffect(Player player) throws IllegalArgumentException { @@ -120,4 +142,4 @@ public class Building0 extends BuildingCard { numSet=min_temp; }; -} +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building1.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building1.java index 3d182d7..f3d84df 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building1.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building1.java @@ -5,27 +5,31 @@ import it.polimi.ingsw.gc14.Model.Cards.BuildingCard; import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType; /** - * During the Sustenance Event, you have a discount of 1 food token on the total you - * would have to pay, for each of the indicated characters in your tribe. + * Building effect that grants a discount of 1 food during the Sustenance Event + * for each character of the indicated type present in the player's tribe. */ public class Building1 extends BuildingCard { /** - * The icon attribute indicates the character type involved in the building effect. + * Character type involved in the building effect. */ private CharacterType icon ; /** - * @return The character type associated with this building effect. + * Returns the character type associated with this building effect. + * + * @return the character type associated with this building effect. */ public CharacterType getIcon() {return icon;} /** - * Constructor of the building. - * @param era The game era of the building. - * @param price The price (in food) of the building. - * @param prestigeValue The number of Prestige Points gained from this building at the end of the game. - * @param icon The character type used by the building effect. + * Creates a building with the specified era, price, prestige value + * and character type involved in its effect. + * + * @param era the game era of the building. + * @param price the price in food of the building. + * @param prestigeValue the number of Prestige Points gained from this building at the end of the game. + * @param icon the character type used by the building effect. */ public Building1(int era, int price,int prestigeValue, CharacterType icon) { super(era,price,prestigeValue); @@ -35,7 +39,8 @@ public class Building1 extends BuildingCard { } /** - * Constructor of the building. + * Creates a building with the specified image identifier, era, price, + * prestige value and character type involved in its effect. * * @param idIMG the image identifier of the building. * @param era the game era of the building. @@ -51,8 +56,10 @@ public class Building1 extends BuildingCard { } /** - * Method to clone the building: it creates an exact copy. - * @return The new copy of the building. + * Creates a new building instance with the same configuration values + * as this card. + * + * @return a new building card with the same base properties and icon. */ @Override public BuildingCard clone() { @@ -60,17 +67,13 @@ public class Building1 extends BuildingCard { } /** - * Prints a string representation of this {@code Building1}. This specific variation is used in the {@code Game}'s - * toString to print a more detailed version. - *

includes: - *

  • {@link #icon Icon} - *

    - * @return {@code String} - a string representation of this {@code Building1}. - * @see it.polimi.ingsw.gc14.Model.Game Game - * @see it.polimi.ingsw.gc14.Model.GamePackage.Board Board + * Returns a string representation of this building, including the character + * type associated with its effect. + * + * @return a string representation of this building. */ @Override public String toString() { return super.toString() + " Icon: " + this.icon.toString().charAt(0); } -} +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building10.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building10.java index 21cf0f7..399c839 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building10.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building10.java @@ -8,9 +8,10 @@ import it.polimi.ingsw.gc14.Model.Player; import java.util.HashMap; /** - * Represents the building card number 10. + * At the end of the game, the player gains 6 Prestige Points + * for each complete set of character types in their tribe. * - *

    This class defines the specific behavior and effects of building card 10. + *

    A complete set contains one character card of each {@link CharacterType}. */ public class Building10 extends BuildingCard { @@ -53,8 +54,9 @@ public class Building10 extends BuildingCard { /** * Applies the effect of this building card to the specified player. - * The effect grants 6 prestige points for each complete set of character cards. - * owned by the player, where a complete set contains one card of each. + * + *

    The effect grants 6 Prestige Points for each complete set of character + * cards owned by the player, where a complete set contains one card of each * {@link CharacterType}. * * @param player the player to whom the effect is applied. diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building11.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building11.java index 25ff457..9871d87 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building11.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building11.java @@ -6,9 +6,11 @@ import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType; import it.polimi.ingsw.gc14.Model.Player; /** - * Represents the building card number 11. + * At the end of the game, the player gains Prestige Points based on the number + * of cards of the indicated character type in their tribe. * - *

    This class defines the specific behavior and effects of building card 11. + *

    The gained amount is equal to the number of matching character cards + * multiplied by the building's prestige multiplier. */ public class Building11 extends BuildingCard { @@ -85,8 +87,8 @@ public class Building11 extends BuildingCard { * The effect grants prestige points equal to the number of cards of the * associated CharacterType owned by the player, multiplied by the prestige multiplier. * - * @param player the player to whom the effect is applied- - * @throws IllegalArgumentException if the player does not own this building card- + * @param player the player to whom the effect is applied. + * @throws IllegalArgumentException if the player does not own this building card. */ @Override public void applyEffect(Player player) throws IllegalArgumentException { @@ -96,15 +98,10 @@ public class Building11 extends BuildingCard { } /** - * Prints a string representation of this {@code Building1}. This specific variation is used in the {@code Game}'s - * toString to print a more detailed version. - *

    includes: - *

  • {@link #icon Icon} - *
  • {@link #PrestigeMul Prestige Multiplier} - *

    - * @return {@code String} - a string representation of this {@code Building1}. - * @see it.polimi.ingsw.gc14.Model.Game Game - * @see it.polimi.ingsw.gc14.Model.GamePackage.Board Board + * Returns a string representation of this {@code Building11}, including the + * character type associated with its effect and its prestige multiplier. + * + * @return a string representation of this {@code Building11}. */ @Override public String toString() { diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building13.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building13.java index d2fdaf0..55bc7b6 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building13.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building13.java @@ -5,9 +5,8 @@ import it.polimi.ingsw.gc14.Model.Cards.BuildingCard; import it.polimi.ingsw.gc14.Model.Player; /** - * Represents the building card number 13. - * - *

    This class defines the specific behavior and effects of building card 13. + * At the end of the game, this building grants 25 Prestige Points + * to the player who owns it. */ public class Building13 extends BuildingCard{ @@ -49,7 +48,8 @@ public class Building13 extends BuildingCard{ } /** - * Applies the effect of this building card to the specified player. + * Applies the effect of this building card to the specified player, + * granting 25 Prestige Points. * * @param player the player to whom the effect is applied. * @throws IllegalArgumentException if the player does not own this building card. diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building4.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building4.java index adca5f9..f25bd89 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building4.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building4.java @@ -8,23 +8,28 @@ import it.polimi.ingsw.gc14.Model.Player; import java.util.HashMap; /** - * From the moment you purchase this building, every time you obtain a pair of identical inventors, you gain 3 food. - * This effect doesn't apply to already owned pairs at the time of purchase. + * Building effect that grants 3 food for each new pair of identical inventors + * obtained after purchasing this building. + * + *

    Pairs of identical inventors already owned at the moment of purchase + * are stored during initialization and do not provide food. */ public class Building4 extends BuildingCard { /** - * The purchased attribute is used to indicate whether the card has already been initialized. + * Indicates whether the building effect has already been initialized + * after purchase. */ boolean purchased ; /** - * The numPair attribute indicates how many pairs of inventors the player has. + * Number of inventor pairs already counted by this building effect. */ int numPair; /** - * Constructor of the building + * Creates a building with the specified era, price and prestige value. + * * @param era The game era of the building. * @param price The price (in food) of the building. * @param prestigeValue The number of Prestige Points gained from this building at the end of the game. @@ -36,7 +41,8 @@ public class Building4 extends BuildingCard { } /** - * Constructor of the building. + * Creates a building with the specified image identifier, era, price + * and prestige value. * * @param idIMG the image identifier of the building. * @param era the game era of the building. @@ -50,9 +56,12 @@ public class Building4 extends BuildingCard { } /** - * Initializes the building by counting the number of pairs of inventors at the moment of purchase. - * The building can only be initialized once. - * @param player the player who owns the building, whose inventors are counted to determine the number of pairs. + * Initializes the building effect by storing the number of pairs of identical + * inventors already owned by the player at the moment of purchase. + * + *

    The initialization is performed only once. + * + * @param player the player who owns the building. */ public void initialize(Player player) { @@ -79,9 +88,12 @@ public class Building4 extends BuildingCard { } /** - * Method used to purchase the building. It also handles its initialization. + * Attempts to purchase the building and initializes its effect if the + * purchase succeeds. + * * @param player The player who buys the building. - * @return The outcome of the operation. + * @return {@code true} if the building is successfully purchased and initialized, + * {@code false} otherwise. */ @Override public boolean buy(Player player) @@ -93,8 +105,13 @@ public class Building4 extends BuildingCard { } /** - * Method to clone the building: it creates an exact copy. - * @return The new copy of the building. + * Creates a new building instance with the same configuration values + * as this card. + * + *

    The runtime state of the effect, such as initialization status and + * counted inventor pairs, is not copied. + * + * @return a new building card with the same base properties. */ @Override public BuildingCard clone() { @@ -102,8 +119,11 @@ public class Building4 extends BuildingCard { } /** - * Calculates the current number of pairs and subtracts the previous value (i.e., the number of newly obtained pairs). - * The player gains an amount of food equal to 3 times this result. + * Applies the building effect to the specified player. + * + *

    The method counts the current number of pairs of identical inventors + * and grants 3 food for each pair obtained since the last stored value. + * * @param player The player who owns the building. * @throws IllegalArgumentException Thrown if the specified player does not own this card. */ @@ -132,4 +152,4 @@ public class Building4 extends BuildingCard { player.addFood(3*(temp-numPair)); numPair = temp; }; -} +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building8.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building8.java index be87fa5..924fea5 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building8.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building8.java @@ -47,7 +47,11 @@ public class Building8 extends BuildingCard { } /** - * For each builder in the player's hand, the player gains double the Prestige Point indicated on the builder card. + * Applies the building effect by granting additional Prestige Points equal to + * the Prestige Value of each Builder card owned by the player. + * + *

    This effectively doubles the contribution of Builder cards to the final score. + * * @param player The player who owns the building. * @throws IllegalArgumentException Thrown if the specified player does not own this building. */ @@ -60,4 +64,4 @@ public class Building8 extends BuildingCard { } } -} +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/BuildingCard.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/BuildingCard.java index 0d97326..aa2f201 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/BuildingCard.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/BuildingCard.java @@ -16,7 +16,7 @@ import java.io.Serializable; */ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEffect, Serializable { - /** + /** * The price of this building card. */ private int price; @@ -102,8 +102,10 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf } /** - * Creates a building card with the specified era, price, and prestige value. + * Creates a building card with the specified image identifier, era, price, + * and prestige value. * + * @param idIMG the image identifier of the building card. * @param era the era of the building card. * @param price the price of the building card. * @param prestigeValue the prestige value of the building card. @@ -160,7 +162,7 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf this.effectType=EffectType.ON_EVENT; break; case 12: - this.effectType=EffectType.ON_ROUND_END; + this.effectType=EffectType.ON_ROUND_END; break; default: throw new IllegalArgumentException(); @@ -227,10 +229,12 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf /** * Attempts to buy this building card for the specified player. - * The purchase succeeds only if the card has not already been bought - * and the player can pay its price in Food. - * If the purchase succeeds, the card is added to the player's building cards - * and marked as bought. + * + *

    The effective cost is reduced by the total reduction value provided + * by the player's Builder cards, without dropping below zero. The purchase + * succeeds only if the card has not already been bought and the player can + * pay the resulting amount of Food. If successful, the card is added to + * the player's building cards and marked as bought. * * @param player the player attempting to buy the building card. * @return {@code true} if the building card is successfully bought, @@ -253,9 +257,12 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf } /** - * Applies the effect of this building card to the specified player. + * Default implementation of the building effect. * - * @param player the player to whom the effect is applied. + *

    This method does not perform any operation and can be overridden + * by specific building cards that define an active effect. + * + * @param player the player to whom the effect may be applied. */ @Override public void applyEffect(Player player){}; @@ -269,4 +276,4 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf public String toString() { return "⎕:" + " ID:" + String.valueOf(getEffectId())+ " $:"+String.valueOf(getPrice())+" PV:"+String.valueOf(getPrestigeValue()); } -} +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Character.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Character.java index baed2bb..28877b3 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Character.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Character.java @@ -5,7 +5,8 @@ import it.polimi.ingsw.gc14.Model.Player; /** * Abstract base class for all character cards. - * A Character is a {@link TribeCard} that is not an event card and is associated. + * + *

    A Character is a {@link TribeCard} that is not an event card and is associated * with a specific {@link CharacterType}. */ public abstract class Character extends TribeCard implements Cloneable { @@ -77,8 +78,6 @@ public abstract class Character extends TribeCard implements Cloneable { /** * Returns the string representation of this character card. - * The returned string includes the string representation of the superclass - * and the string representation of the character type. * * @return the string representation of this character card. */ @@ -89,8 +88,8 @@ public abstract class Character extends TribeCard implements Cloneable { /** - * Prints a string representation of this {@code Character}. This specific variation is used in the {@code Game}'s - * toString to print a more detailed version. + * Returns a string representation of this {@code Character}. This specific variation is used in the {@code Game}'s + * toString to provide a more detailed version. *

    Includes: *

  • {@link it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType Type} *

    @@ -118,4 +117,4 @@ public abstract class Character extends TribeCard implements Cloneable { * @param player the player who receives the character card. */ public abstract void insert(Player player); -} +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Artist.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Artist.java index caf600b..07c8845 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Artist.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Artist.java @@ -74,7 +74,8 @@ public class Artist extends Character { } /** - * Inserts this Artist card into the specified player's Artist collection. + * Inserts this Artist card into the specified player's Artist collection + * and applies any building effects triggered by character set completion. * * @param player the player who receives the card. */ @@ -84,5 +85,4 @@ public class Artist extends Character { player.buildingCards.stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player)); } -} - +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Builder.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Builder.java index 76a0704..ab3f9ea 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Builder.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Builder.java @@ -143,13 +143,10 @@ public class Builder extends Character { } /** - * Prints a string representation of this {@code TribeCard}. This specific variation is used in the {@code Game}'s - * toString to print a more detailed version. - *

    Includes: - *

  • {@link #reductionValue Reduction Value} - *
  • {@link #prestigeValue Prestige Value} - *

    - * @return {@code String} - a string representation of this {@code TribeCard}. + * Returns a detailed string representation of this {@code Builder} card, + * including its reduction value and prestige value. + * + * @return a detailed string representation of this {@code Builder} card. * @see it.polimi.ingsw.gc14.Model.Cards.TribeCard TribeCard * @see it.polimi.ingsw.gc14.Model.Game Game * @see it.polimi.ingsw.gc14.Model.GamePackage.Board Board @@ -172,7 +169,8 @@ public class Builder extends Character { } /** - * Inserts this Builder card into the specified player's Builder collection. + * Inserts this Builder card into the specified player's Builder collection + * and applies any building effects triggered by character set completion. * * @param player the player who receives the card. */ diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Gatherer.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Gatherer.java index 4f5d3d3..f05049a 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Gatherer.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Gatherer.java @@ -15,7 +15,7 @@ public class Gatherer extends Character { /** * Creates a Gatherer character card with the specified era. * - * @param Era Gatherers era. + * @param Era the era of the Gatherer card. */ public Gatherer(int Era) { super(Era, CharacterType.GATHERER); @@ -32,7 +32,7 @@ public class Gatherer extends Character { } /** - * Creates a Gatherer character card with the specified era. + * Creates a Gatherer character card with the specified image id and era. * * @param idIMG the image identifier of the Gatherer card. * @param Era the era of the Gatherer card. @@ -74,7 +74,8 @@ public class Gatherer extends Character { } /** - * Inserts this Gatherer card into the specified player's Gatherer collection. + * Inserts this Gatherer card into the specified player's Gatherer collection + * and applies any building effects triggered by character set completion. * * @param player the player who receives the card. */ @@ -82,4 +83,4 @@ public class Gatherer extends Character { player.gatherers.add(this); player.buildingCards.stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player)); } -} +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Hunter.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Hunter.java index 314c9f2..80e6b31 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Hunter.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Hunter.java @@ -93,11 +93,14 @@ public class Hunter extends Character { } /** - * Prints a string representation of this {@code TribeCard}. This specific variation is used in the {@code Game}'s - * toString to print a more detailed version. + * Returns a detailed string representation of this {@code TribeCard}. + * This specific variation is used in the {@code Game}'s + * toString to provide a more detailed version. + * *

    Potentially includes: *

  • {@link #icon Icon} *

    + * * @return {@code String} - a string representation of this {@code TribeCard}. * @see it.polimi.ingsw.gc14.Model.Cards.TribeCard TribeCard * @see it.polimi.ingsw.gc14.Model.Game Game @@ -125,6 +128,10 @@ public class Hunter extends Character { /** * Inserts this Hunter card into the specified player's Hunter collection. * + *

    If this card has the Hunter icon, the player gains 1 food for each + * Hunter currently in their tribe. The method also applies any building + * effects triggered by character set completion. + * * @param player the player who receives the card. */ @Override @@ -136,4 +143,4 @@ public class Hunter extends Character { player.buildingCards.stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player)); } -} +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Inventor.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Inventor.java index 5beb31f..dc4d504 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Inventor.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Inventor.java @@ -97,11 +97,14 @@ public class Inventor extends Character { } /** - * Prints a string representation of this {@code TribeCard}. This specific variation is used in the {@code Game}'s - * toString to print a more detailed version. + * Returns a detailed string representation of this {@code TribeCard}. + * This specific variation is used in the {@code Game}'s toString + * to provide a more detailed version. + * *

    Includes: *

  • {@link #icon Icons's ID} *

    + * * @return {@code String} - a string representation of this {@code TribeCard}. * @see it.polimi.ingsw.gc14.Model.Cards.TribeCard TribeCard * @see it.polimi.ingsw.gc14.Model.Game Game @@ -125,6 +128,9 @@ public class Inventor extends Character { /** * Inserts this Inventor card into the specified player's Inventor collection. * + *

    The method also applies the building effects related to inventor pairs + * and any building effects triggered by character set completion. + * * @param player the player who receives the card. */ @Override @@ -133,4 +139,4 @@ public class Inventor extends Character { player.buildingCards.stream().filter(b -> b.getEffectId() == 4).forEach(b4 -> b4.applyEffect(player)); player.buildingCards.stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player)); } -} +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Shaman.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Shaman.java index de53e39..133f7db 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Shaman.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Shaman.java @@ -26,7 +26,7 @@ public class Shaman extends Character { * @return the icon value of this Shaman card. */ public int getIcon() { - return icon; + return icon; } /** @@ -90,8 +90,8 @@ public class Shaman extends Character { } /** - * Prints a string representation of this {@code TribeCard}. This specific variation is used in the {@code Game}'s - * toString to print a more detailed version. + * Returns a string representation of this {@code TribeCard}. This specific variation is used in the {@code Game}'s + * toString to provide a more detailed version. *

    Includes: *

  • {@link #icon Number of stars} *

    @@ -116,7 +116,8 @@ public class Shaman extends Character { } /** - * Inserts this Shaman card into the specified player's Shaman collection. + * Inserts this Shaman card into the specified player's Shaman collection + * and applies any building effects triggered by character set completion. * * @param player the player who receives the card. */ @@ -126,4 +127,4 @@ public class Shaman extends Character { player.shamans.add(this); player.buildingCards.stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player)); } -} +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/EventCard.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/EventCard.java index b92e1c0..07bd61e 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/EventCard.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/EventCard.java @@ -8,7 +8,7 @@ import java.lang.reflect.Array; /** * Abstract base class for all event cards. - * An EventCard is a {@link TribeCard} marked as an event card and associated. + * An EventCard is a {@link TribeCard} marked as an event card and associated * with a specific {@link EventType}. */ public abstract class EventCard extends TribeCard { @@ -100,6 +100,4 @@ public abstract class EventCard extends TribeCard { public abstract void activateEvent (ArrayList playerList); // End Functions -} - - +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/DecksCreator.java b/src/main/java/it/polimi/ingsw/gc14/Model/DecksCreator.java index 93006f1..ffe490e 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/DecksCreator.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/DecksCreator.java @@ -202,7 +202,7 @@ public class DecksCreator { /** * Internal data class representing the raw definition of a tribe card as loaded from a JSON file. - * Contains the card type, era, whether it is armed, whether it is an event card, + * Contains the card identifier, type, era, whether it is armed, whether it is an event card, * and a list of additional parameters. */ private static class TribeCardDefinition { @@ -216,7 +216,7 @@ public class DecksCreator { /** * Internal data class representing the raw definition of a building card as loaded from a JSON file. - * Contains the effect ID, era, price, prestige value, and a list of additional parameters. + * Contains the card identifier, effect ID, era, price, prestige value, and a list of additional parameters. */ private static class BuildingCardDefinition { String id; diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/GamePackage/Board.java b/src/main/java/it/polimi/ingsw/gc14/Model/GamePackage/Board.java index 6e3023c..9dfe9e8 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/GamePackage/Board.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/GamePackage/Board.java @@ -25,7 +25,10 @@ public class Board implements Serializable { /** tribeDeck is the deck from where you draw tribe cards as characters and events. */ private Queue tribeDeck; - /** The upper row of tribe cards. There must be (num. of players + 4) character cards + Event cards */ + /** + * The upper row of tribe cards. It contains a total of + * {@code nTotem + 4} tribe cards, which may include both character and event cards. + */ public List upperListTribe; /** @@ -38,7 +41,7 @@ public class Board implements Serializable { /** Contains all the building cards of the upper list. When a new era starts, all its building cards are placed here */ public List upperListBuilding; - /** Contains all the building cards of the upper list. When a new era starts, the old era's buildings are moved from the upper to the lower list */ + /** Contains all the building cards of the lower list. When a new era starts, the old era's buildings are moved from the upper to the lower list */ public List lowerListBuilding; @@ -275,4 +278,4 @@ public class Board implements Serializable { upperListBuilding.addAll(buildingCardsAllEras.get(2)); } } -} +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/OrderLogicCard.java b/src/main/java/it/polimi/ingsw/gc14/Model/OrderLogicCard.java index 6246856..6751815 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/OrderLogicCard.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/OrderLogicCard.java @@ -60,8 +60,12 @@ public abstract class OrderLogicCard implements Serializable { } + /** - * Adds the player to the end of the queue, without effects. + * Moves the specified player to the end of the queue without applying effects. + * + *

    Any previous occurrence of the player is removed from both the queue + * and the order list before the player is added again. * * @param player the player to be pushed into the queue. */ @@ -75,6 +79,9 @@ public abstract class OrderLogicCard implements Serializable { /** * Removes and returns the first player in the queue. * + *

    The first order entry that has not yet been marked as played + * is marked as played before removing the player from the queue. + * * @return the first player in the queue, or {@code null} if the queue is empty. */ public Player pull(){ @@ -121,10 +128,12 @@ public abstract class OrderLogicCard implements Serializable { } /** - * TODO rifare javadoc - * Returns the {@code Player}'s position based on it's {@code Username}. - * @param username The desired {@code Player}'s username. - * @return {@code int} - the {@code Player}'s position. + * Returns the position of the player associated with the specified username + * within the current order list. + * + * @param username the username of the player whose position is requested. + * @return the player's position, or {@code -1} if no player with the specified + * username is present in the order list. * @see Player */ public int getPosition(String username) @@ -139,4 +148,4 @@ public abstract class OrderLogicCard implements Serializable { } -} +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order2.java b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order2.java index 2a0868b..4a73da0 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order2.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order2.java @@ -32,7 +32,7 @@ public class Order2 extends OrderLogicCard { /** * Applies the effect associated with the specified position index for the given player. *

    If {@code index == 0}, the player gains 1 Food and the building effect is applied. - *

    If {@code index == 1}, the player tries to remove 1 Food; if the player pay it, + *

    If {@code index == 1}, the player tries to remove 1 Food; if the player cannot pay it, * the player loses 2 Prestige. * * @param player the player to whom the effect is applied. @@ -88,4 +88,4 @@ public class Order2 extends OrderLogicCard { table.addRow(stringList); return "TURN ORDER\n" + table.build() + "\n"; } -} +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order3.java b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order3.java index 95b3713..3629b3b 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order3.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order3.java @@ -33,7 +33,7 @@ public class Order3 extends OrderLogicCard { * Applies the effect associated with the specified position index for the given player. *

    If {@code index == 0}, the player gains 2 Food and the building effect is applied. *

    If {@code index == 1}, no effect is applied. - *

    If {@code index == 2}, the player tries to remove 1 Food; if the player pay it, + *

    If {@code index == 2}, the player tries to remove 1 Food; if the player cannot pay it, * the player loses 2 Prestige. * * @param player the player to whom the effect is applied. diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order4.java b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order4.java index 2617845..4b4db23 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order4.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order4.java @@ -34,7 +34,7 @@ public class Order4 extends OrderLogicCard { *

    If {@code index == 0}, the player gains 2 Food and the building effect is applied. *

    If {@code index == 1}, the player gains 1 Food and the building effect is applied. *

    If {@code index == 2}, no effect is applied. - *

    If {@code index == 3}, the player tries to remove 1 Food; if the player pay it, + *

    If {@code index == 3}, the player tries to remove 1 Food; if the player cannot pay it, * the player loses 2 Prestige. * * @param player the player to whom the effect is applied. diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order5.java b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order5.java index 5b3b843..64e31da 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order5.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order5.java @@ -35,7 +35,7 @@ public class Order5 extends OrderLogicCard { *

    If {@code index == 1}, the player gains 1 Food and the building effect is applied. *

    If {@code index == 2}, no effect is applied. *

    If {@code index == 3}, no effect is applied. - *

    If {@code index == 4}, the player tries to remove 1 Food; if the player pay it, + *

    If {@code index == 4}, the player tries to remove 1 Food; if the player cannot pay it, * the player loses 2 Prestige. * * @param player the player to whom the effect is applied. @@ -101,4 +101,4 @@ public class Order5 extends OrderLogicCard { table.addRow(stringList); return "TURN ORDER\n" + table.build() + "\n"; } -} +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Player.java b/src/main/java/it/polimi/ingsw/gc14/Model/Player.java index 204e60e..7aff52b 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Player.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Player.java @@ -149,15 +149,16 @@ public class Player implements Serializable { /** * Removes {@code Value} amount of {@code Food} from the Player. - * Note: {@link #FoodValue} cannot be negative, so the method will - * return {@code False} if {@code Value} is greater than the - * amount of {@code Food} the Player possesses, {@code False} otherwise. + * Note: {@link #FoodValue} cannot be negative, so the method returns + * {@code false} if {@code Value} is greater than the amount of {@code Food} + * the Player possesses, and {@code true} otherwise. + * * @param Value The amount of {@code Food} to be removed. * Should be positive for expected results * (otherwise the method will add the absolute * value of {@code Value}). - * @return {@code Boolean} - {@code True} if {@code Value} is greater than - * the amount of {@code Food} the Player possesses, {@code False} otherwise. + * @return {@code Boolean} - {@code true} if the Food is successfully removed, + * {@code false} otherwise. * @see #FoodValue */ public Boolean removeFood(int Value){ @@ -200,10 +201,11 @@ public class Player implements Serializable { /** * Constructor for the class {@code Player}. Each Player is uniquely identified by the {@link #UserName}. + * * @param UserName Unique String identifier for a Player. - * @throws IllegalArgumentException When {@code UserName} is {@code null} or exceeds {@link #MAX_VALUE} + * @throws IllegalArgumentException when {@code UserName} is empty or exceeds {@link #MAX_VALUE}, * with message: - *

    {@code UserName is empty or exceeds maximum permitted length.}
    +     *                                  
    {@code UserName is empty or exceeds maximum permitted length.}
    * * @see #UserName * @see #MAX_VALUE @@ -336,4 +338,4 @@ public class Player implements Serializable { return table.build(); } // endregion functions -} +} \ No newline at end of file