From cbf9a673006bef9d17ec3c6d0c246f37b8afee40 Mon Sep 17 00:00:00 2001 From: AleandroPagani Date: Thu, 2 Apr 2026 15:52:01 +0200 Subject: [PATCH 1/2] Test: ShamanicRitual JavaDOC --- .../gc14/Model/Cards/TribeCards/Events/ShamanicRitual.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/ShamanicRitual.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/ShamanicRitual.java index de9aef0..80809ba 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/ShamanicRitual.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/ShamanicRitual.java @@ -19,6 +19,10 @@ public class ShamanicRitual extends EventCard { } + /** + * + * @param playerList + */ @Override public void activateEvent (ArrayList playerList){ Map playerMap = new HashMap<>(); From 87216c35755d6e12d9657d207f5a58e1e2510c65 Mon Sep 17 00:00:00 2001 From: AleandroPagani Date: Thu, 2 Apr 2026 17:01:08 +0200 Subject: [PATCH 2/2] JavaDOC added: Hunt, ShamanicRitual --- .../Model/Cards/TribeCards/Events/Hunt.java | 51 +++++++++++++++---- .../TribeCards/Events/ShamanicRitual.java | 35 ++++++++++++- 2 files changed, 75 insertions(+), 11 deletions(-) diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/Hunt.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/Hunt.java index cc3787e..02adfd0 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/Hunt.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/Hunt.java @@ -1,42 +1,73 @@ package it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events; import it.polimi.ingsw.gc14.Model.Cards.BuildingCard; -import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character; import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType; -import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.Hunter; import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventType; import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventCard; import it.polimi.ingsw.gc14.Model.Player; import java.util.ArrayList; +/** + * When activated, gives Food and Prestige Points to every player. + * + * @see EventCard + */ public class Hunt extends EventCard { + /** Food points to add during the event. */ int foodToAdd; - int prestigeMultiplicator; - public Hunt(int Era, int prestigeMultiplicator) { + + /** Prestige Points multiplicator used during the event. */ + int prestigeMultiplier; + + /** + * Creates a new Hunt event card. + * + * @param Era the era of the card + * @param prestigeMultiplier prestige points multiplicator used during the event + */ + public Hunt(int Era, int prestigeMultiplier) { super(Era, EventType.HUNT); this.foodToAdd = 1; - this.prestigeMultiplicator = prestigeMultiplicator; + this.prestigeMultiplier = prestigeMultiplier; } + /** + * Activates the event card "Hunt". + * Each player takes 1 Food and gains Prestige Points equal to prestigeMultiplier times the number of Hunters in their tribe. + * + * Buildings influence: + * Building 7: you take 1 Food and gain 1 additional Prestige Point for each Hunter + * + * @param playerList contains all the players in the game + */ @Override public void activateEvent (ArrayList playerList){ for (Player player : playerList) { + int tmpFoodToAdd = foodToAdd; + int tmpPrestigeMultiplier = prestigeMultiplier; + ArrayList buildingList = player.buildingCards; int hunterCounter=player.getNType(CharacterType.HUNTER); for (BuildingCard buildingCard : buildingList) { if (buildingCard.getEffectId() == 7) { - foodToAdd++; - prestigeMultiplicator++; + tmpFoodToAdd++; + tmpPrestigeMultiplier++; } } - player.addFood(foodToAdd); - player.addPrestige(prestigeMultiplicator * hunterCounter); + player.addFood(tmpFoodToAdd); + player.addPrestige(tmpPrestigeMultiplier * hunterCounter); } } + + /** + * Creates and returns a copy of this Hunt card. + * + * @return a new Hunt card with the same era and prestige multiplicator + */ @Override public EventCard clone() { - return new Hunt(getEra(), prestigeMultiplicator); + return new Hunt(getEra(), prestigeMultiplier); } } diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/ShamanicRitual.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/ShamanicRitual.java index 80809ba..00550ca 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/ShamanicRitual.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/ShamanicRitual.java @@ -9,9 +9,25 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; +/** + * When activated, rewards the player with the most shaman icons and penalizes the one with the fewest. + * + * @see EventCard + */ public class ShamanicRitual extends EventCard { + /** Prestige points awarded to the player with the most shaman icons. */ int prestigeToAdd; + + /** Prestige points removed from the player with the fewest shaman icons. */ int prestigeToRemove; + + /** + * Creates a new ShamanicRitual event card. + * + * @param Era the era of the card + * @param prestigeToAdd prestige points awarded to the player with the most icons + * @param prestigeToRemove prestige points removed from the player with the fewest icons + */ public ShamanicRitual(int Era, int prestigeToAdd, int prestigeToRemove) { super(Era, EventType.SHAMANIC_RITUAL); this.prestigeToAdd = prestigeToAdd; @@ -20,8 +36,18 @@ public class ShamanicRitual extends EventCard { } /** + * Activates the event card "Shamanic Ritual". + * The player with the most icons gains the Prestige Points indicated. + * The player with the fewest icons loses the Prestige Points indicated. + * In case of a tie, all player gain or lose the Prestige Points indicated. + * If all players have the same amount of icons, they all gains Prestige Points. * - * @param playerList + * Buildings influence: + * Building 2: if you have fewer icons than all other players, you don't lose Prestige Points + * Building 5: during the Shamanic Ritual, you gain 3 icons + * Building 6: if you have more icons than any other player, you gain double of Prestige Points + * + * @param playerList contains all the players in the game */ @Override public void activateEvent (ArrayList playerList){ @@ -60,6 +86,13 @@ public class ShamanicRitual extends EventCard { } } + + + /** + * Creates and returns a copy of this ShamanicRitual card. + * + * @return a new ShamanicRitual card with the same era and prestige values + */ @Override public EventCard clone() { return new ShamanicRitual(getEra(), prestigeToAdd, prestigeToRemove);