From 1af39bc558142433159da0900c87b01aea4eb3e7 Mon Sep 17 00:00:00 2001 From: GabrieleRadice <265572328+GabrieleRadice@users.noreply.github.com> Date: Wed, 29 Apr 2026 18:20:19 +0200 Subject: [PATCH 01/23] Add: Added Javadoc For "toStringBoard" Method In CavePaintings.java. --- .../Model/Cards/TribeCards/Events/CavePaintings.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/CavePaintings.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/CavePaintings.java index 5a70bfb..c0477fe 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/CavePaintings.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/CavePaintings.java @@ -86,6 +86,17 @@ public class CavePaintings extends EventCard { return new CavePaintings(getEra(), NLower, NPrestigeRem, NPrestigeMul) ; } + + /** + * 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: {@code NLower}, {@code NUpper}, {@code NPrestigeRem} and {@code NPrestigeMul}. + * @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 + * @see #NLower + * @see #NPrestigeRem + * @see #NPrestigeMul + */ @Override public String toStringBoard() { return super.toString()+" 0-"+(NLower-1)+":"+NPrestigeRem+" "+NLower+"+:"+NPrestigeMul; From 6d99b3e4e93ab48bbb1b9aeef026ca865bb785c4 Mon Sep 17 00:00:00 2001 From: GabrieleRadice <265572328+GabrieleRadice@users.noreply.github.com> Date: Thu, 30 Apr 2026 16:41:14 +0200 Subject: [PATCH 02/23] Add: Added Javadoc For "toString" Method In Player.java. Fix: "addSeparator" Method In AsciiTable.java Now Correctly Positons Separators. --- .../it/polimi/ingsw/gc14/Model/Player.java | 34 ++++++++++++++----- .../ingsw/gc14/View/TUI/AsciiTable.java | 2 +- 2 files changed, 26 insertions(+), 10 deletions(-) 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 fd0a3ba..82151f8 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Player.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Player.java @@ -8,7 +8,6 @@ import it.polimi.ingsw.gc14.View.TUI.AsciiTable; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; -import java.util.List; import static it.polimi.ingsw.gc14.View.TUI.BorderStyle.*; @@ -228,17 +227,34 @@ public class Player implements Serializable { // endregion constructors // region Functions + /** + * Prints the {@code Player}'s attributes for the {@code Board}'s representation. + * Uses the {@code UNICODE} border style. + *
Includes: + *
NOTE: {@code NUpper} is not a real attribute used in calculations (only {@code NLower} is needed), + * however it's a parameter on the cards' design. + *
+ *includes: + *
Includes: + *
includes: + *
includes: + *
includes: + *
Includes: + *
Potentially includes: + *
Includes: + *
Includes: + *
NOTE: {@code NUpper} is not a real attribute used in calculations (only {@code NLower} is needed), * however it's a parameter on the cards' design. *
- *includes: + *
Includes: *
includes: + *
Includes: *
includes: + *
Includes: *
Includes: + *
Includes: + *
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 cannot remove it, + *
If {@code index == 1}, the player tries to remove 1 Food; if the player 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/Order3.java b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order3.java index fb4c71a..14bc2db 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 @@ -27,7 +27,8 @@ 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}, if the player can remove 1 Food, the player loses 2 Prestige. + *
If {@code index == 2}, the player tries to remove 1 Food; if the player pay it, + * the player loses 2 Prestige. * * @param player the player to whom the effect is applied. * @param index the position index of the effect to apply. @@ -47,7 +48,7 @@ public class Order3 extends OrderLogicCard { return; } if(index==2){ - if(player.removeFood(1)){ + if(!player.removeFood(1)){ player.removePrestige(2); } } 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 966f15a..1fc229c 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 @@ -28,7 +28,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 removal succeeds, + *
If {@code index == 3}, the player tries to remove 1 Food; if the player pay it, * the player loses 2 Prestige. * * @param player the player to whom the effect is applied. @@ -55,7 +55,7 @@ public class Order4 extends OrderLogicCard { return; } if(index==3){ - if(player.removeFood(1)){ + if(!player.removeFood(1)){ player.removePrestige(2); } } 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 468c626..d184bcc 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 @@ -29,7 +29,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 removal succeeds, + *
If {@code index == 4}, the player tries to remove 1 Food; if the player pay it, * the player loses 2 Prestige. * * @param player the player to whom the effect is applied. @@ -56,7 +56,7 @@ public class Order5 extends OrderLogicCard { return; } if(index==4){ - if(player.removeFood(1)){ + if(!player.removeFood(1)){ player.removePrestige(2); } } diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/OrderPlayer.java b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/OrderPlayer.java index 360bebc..56ac136 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/OrderPlayer.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/OrderPlayer.java @@ -3,9 +3,10 @@ package it.polimi.ingsw.gc14.Model.Orders; import it.polimi.ingsw.gc14.Model.Player; /** - * Abstract base class for all order logic cards. - * An OrderLogicCard manages a queue of players and defines the effects - * applied when players are pushed back into the queue. + * Abstract base class for all order {@code logic cards}. + * An {@code OrderLogicCard} manages a queue of {@code players} and defines the effects + * applied when they are pushed back into the queue. + * @see it.polimi.ingsw.gc14.Model.Player Player */ public class OrderPlayer{ public Player player; From 4360cf023de6f1149e0709e12639a9f9f0da28c7 Mon Sep 17 00:00:00 2001 From: GabrieleRadice <265572328+GabrieleRadice@users.noreply.github.com> Date: Thu, 30 Apr 2026 18:10:37 +0200 Subject: [PATCH 16/23] Add: Added Javadoc For "toString" Method In Game.java. --- src/main/java/it/polimi/ingsw/gc14/Model/Game.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Game.java b/src/main/java/it/polimi/ingsw/gc14/Model/Game.java index 893ea24..054b2f6 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Game.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Game.java @@ -703,6 +703,16 @@ public class Game implements Serializable { return true; } + /** + * Prints a string representation of the {@code Game}. Used in the TUI implementation to draw: + *
includes: + *