From e94a9602ab5a17fb5ac2a2c065923882bdb9ef32 Mon Sep 17 00:00:00 2001 From: AleandroPagani Date: Wed, 8 Apr 2026 19:07:40 +0200 Subject: [PATCH] Small fix: ShamanicRitual Hunt: changed the food logic HuntTest: test adapted to the new version --- .../Model/Cards/TribeCards/Events/Hunt.java | 18 +++++++++--------- .../TribeCards/Events/ShamanicRitual.java | 2 +- .../Cards/TribeCards/Events/HuntTest.java | 12 ++++++------ 3 files changed, 16 insertions(+), 16 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 02adfd0..5d9c4f1 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 @@ -13,10 +13,10 @@ import java.util.ArrayList; * @see EventCard */ public class Hunt extends EventCard { - /** Food points to add during the event. */ - int foodToAdd; + /** Food points multiplier used during the event. */ + int foodMultiplier; - /** Prestige Points multiplicator used during the event. */ + /** Prestige Points multiplier used during the event. */ int prestigeMultiplier; /** @@ -27,23 +27,23 @@ public class Hunt extends EventCard { */ public Hunt(int Era, int prestigeMultiplier) { super(Era, EventType.HUNT); - this.foodToAdd = 1; + this.foodMultiplier = 1; 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. + * Each player takes 1 Food and gains Prestige Points for each Hunter in their tribe. * * Buildings influence: - * Building 7: you take 1 Food and gain 1 additional Prestige Point for each Hunter + * Building 7: you take 1 Food and 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 tmpFoodMultiplier = foodMultiplier; int tmpPrestigeMultiplier = prestigeMultiplier; ArrayList buildingList = player.buildingCards; @@ -51,12 +51,12 @@ public class Hunt extends EventCard { for (BuildingCard buildingCard : buildingList) { if (buildingCard.getEffectId() == 7) { - tmpFoodToAdd++; + tmpFoodMultiplier++; tmpPrestigeMultiplier++; } } - player.addFood(tmpFoodToAdd); + player.addFood(tmpFoodMultiplier * hunterCounter); player.addPrestige(tmpPrestigeMultiplier * hunterCounter); } } 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 763e863..258dae9 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 @@ -40,7 +40,7 @@ public class ShamanicRitual extends EventCard { * 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. + * If all players have the same amount of icons, they all gain and lose Prestige Points. * * Buildings influence: * Building 2: if you have fewer icons than all other players, you don't lose Prestige Points diff --git a/src/test/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/HuntTest.java b/src/test/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/HuntTest.java index 3869b08..4c416a0 100644 --- a/src/test/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/HuntTest.java +++ b/src/test/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/HuntTest.java @@ -21,7 +21,7 @@ class HuntTest { void testConstructor() { // Gli attributi di Hunt era e EventType vengono testati in EventCardTest. - // Gli attributi foodToAdd e prestigeMultiplier non possono essere testati singolarmente in quanto non hanno metodi getter + // Gli attributi foodMultiplier e prestigeMultiplier non possono essere testati singolarmente in quanto non hanno metodi getter // Ne viene testato il corretto funzionamento indirettamente attraverso applyEffect. // Come conseguenza finale, non può essere testato il costruttore di Hunt @@ -42,7 +42,7 @@ class HuntTest { h1.activateEvent(players); assertEquals(6, p1.getPrestigeValue()); - assertEquals(1, p1.getFoodValue()); + assertEquals(2, p1.getFoodValue()); assertEquals(3, p2.getPrestigeValue()); assertEquals(1, p2.getFoodValue()); } @@ -58,9 +58,9 @@ class HuntTest { h1.activateEvent(players); assertEquals(0, p1.getPrestigeValue()); - assertEquals(1, p1.getFoodValue()); + assertEquals(0, p1.getFoodValue()); assertEquals(0, p2.getPrestigeValue()); - assertEquals(1, p2.getFoodValue()); + assertEquals(0, p2.getFoodValue()); } @Test @@ -86,7 +86,7 @@ class HuntTest { h1.activateEvent(players); assertEquals(6, p1.getPrestigeValue()); - assertEquals(1, p1.getFoodValue()); + assertEquals(2, p1.getFoodValue()); assertEquals(4, p2.getPrestigeValue()); assertEquals(2, p2.getFoodValue()); assertEquals(3, p3.getPrestigeValue()); @@ -102,7 +102,7 @@ class HuntTest { Hunt h1 = new Hunt(era, prestigeMultiplier); Hunt h2 = (Hunt) h1.clone(); - assertEquals(1, h2.foodToAdd); + assertEquals(1, h2.foodMultiplier); assertEquals(3, h2.prestigeMultiplier); assertEquals(1, h2.getEra()); assertEquals(EventType.HUNT, h2.getType());