Add: complete javadoc on model and network

This commit is contained in:
2026-06-09 21:30:51 +02:00
parent cbf6cb3c5b
commit c099847cbd
21 changed files with 135 additions and 29 deletions
@@ -16,6 +16,9 @@ import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
*/
public class Building0 extends BuildingCard {
/** Food units granted per newly completed character set. */
private static final int FOOD_PER_CHARACTER_SET = 5;
/**
* Indicates whether the building effect has already been initialized
* after purchase.
@@ -138,7 +141,7 @@ public class Building0 extends BuildingCard {
{
return;
}
player.addFood(5*(min_temp-numSet));
player.addFood(FOOD_PER_CHARACTER_SET *(min_temp-numSet));
numSet=min_temp;
};
@@ -15,6 +15,9 @@ import java.util.HashMap;
*/
public class Building10 extends BuildingCard {
/** Prestige points granted per complete character set at end of game. */
private static final int PRESTIGE_PER_CHARACTER_SET = 6;
/**
* Creates a Building10 card with the specified era, price, and prestige value.
*
@@ -75,7 +78,7 @@ public class Building10 extends BuildingCard {
numSet=player.getNType(type);
}
player.addPrestige(6 * numSet);
player.addPrestige(PRESTIGE_PER_CHARACTER_SET * numSet);
}
}
@@ -10,6 +10,9 @@ import it.polimi.ingsw.gc14.Model.Player;
*/
public class Building13 extends BuildingCard{
/** Prestige points granted at end of game by this building. */
private static final int PRESTIGE_AWARD = 25;
/**
* Creates a Building13 card with the specified era, price, and prestige value.
*
@@ -58,7 +61,7 @@ public class Building13 extends BuildingCard{
public void applyEffect(Player player) throws IllegalArgumentException {
if(!player.getBuildingCards().contains(this))
throw new IllegalArgumentException();
player.addPrestige(25);
player.addPrestige(PRESTIGE_AWARD);
}
}
@@ -16,6 +16,9 @@ import java.util.HashMap;
*/
public class Building4 extends BuildingCard {
/** Food units granted per newly completed inventor pair. */
private static final int FOOD_PER_INVENTOR_PAIR = 3;
/**
* Indicates whether the building effect has already been initialized
* after purchase.
@@ -149,7 +152,7 @@ public class Building4 extends BuildingCard {
{
return;
}
player.addFood(3*(temp-numPair));
player.addFood(FOOD_PER_INVENTOR_PAIR *(temp-numPair));
numPair = temp;
};
}
@@ -174,6 +174,7 @@ public class Builder extends Character {
*
* @param player the player who receives the card.
*/
@Override
public void insert(Player player) {
player.getBuilders().add(this);
player.getBuildingCards().stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player));
@@ -15,6 +15,9 @@ import java.util.stream.Collectors;
* @see EventCard
*/
public class ShamanicRitual extends EventCard {
/** Bonus shaman icons granted per Building 5 owned during this event. */
private static final int BUILDING5_BONUS_ICONS = 3;
/** Prestige points awarded to the player with the most shaman icons. */
int prestigeToAdd;
@@ -73,7 +76,7 @@ public class ShamanicRitual extends EventCard {
tmpIcons = player.getShamans().stream().mapToInt(sh -> sh.getIcon()).sum();
tmpCount = (int) player.getBuildingCards().stream().filter(b -> b.getEffectId() == 5).count();
if (tmpCount >= 1) {
tmpIcons = tmpIcons+(3*tmpCount);
tmpIcons = tmpIcons+(BUILDING5_BONUS_ICONS *tmpCount);
}
playerMap.put(player, tmpIcons);
}
@@ -15,6 +15,9 @@ import java.util.ArrayList;
*/
public class Sustenance extends EventCard {
/** Food units covered by each Gatherer during the Sustenance event. */
private static final int FOOD_PER_GATHERER = 3;
/**
* The prestige penalty multiplier applied for each unpaid Food unit.
*/
@@ -80,7 +83,7 @@ public class Sustenance extends EventCard {
}
int FoodDebt = NChar - (3 * NGatherers + NCharDiscount);
int FoodDebt = NChar - (FOOD_PER_GATHERER * NGatherers + NCharDiscount);
if(FoodDebt <= 0){
continue;