JavaDOC added: Hunt, ShamanicRitual

This commit is contained in:
2026-04-02 17:01:08 +02:00
parent cbf9a67300
commit 87216c3575
2 changed files with 75 additions and 11 deletions
@@ -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 <Player> playerList){
for (Player player : playerList) {
int tmpFoodToAdd = foodToAdd;
int tmpPrestigeMultiplier = prestigeMultiplier;
ArrayList <BuildingCard> 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);
}
}
@@ -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 <Player> 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);