Small fix: ShamanicRitual

Hunt: changed the food logic
HuntTest: test adapted to the new version
This commit is contained in:
2026-04-08 19:07:40 +02:00
parent 092b8991cd
commit e94a9602ab
3 changed files with 16 additions and 16 deletions
@@ -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 <Player> playerList){
for (Player player : playerList) {
int tmpFoodToAdd = foodToAdd;
int tmpFoodMultiplier = foodMultiplier;
int tmpPrestigeMultiplier = prestigeMultiplier;
ArrayList <BuildingCard> 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);
}
}
@@ -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
@@ -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());