FIx: Fixed Coverage Screenshots And htmlRepot.

This commit is contained in:
GabrieleRadice
2026-06-19 22:57:43 +02:00
parent a4dc8b2540
commit 0129efe400
316 changed files with 4566 additions and 4497 deletions
@@ -0,0 +1,249 @@
<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > CavePaintings</title>
<style type="text/css">
@import "../../css/coverage.css";
@import "../../css/idea.min.css";
</style>
<script type="text/javascript" src="../../js/highlight.min.js"></script>
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
</head>
<body>
<div class="content">
<div class="breadCrumbs">
Current scope: <a href="../../index.html">all classes</a>
<span class="separator">|</span>
<a href="../index.html">it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events</a>
</div>
<h1>Coverage Summary for Class: CavePaintings (it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events)</h1>
<table class="coverageStats">
<tr>
<th class="name">Class</th>
<th class="coverageStat
">
Class, %
</th>
<th class="coverageStat
">
Method, %
</th>
<th class="coverageStat
">
Branch, %
</th>
<th class="coverageStat
">
Line, %
</th>
</tr>
<tr>
<td class="name">CavePaintings</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(1/1)
</span>
</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(6/6)
</span>
</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(8/8)
</span>
</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(22/22)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<pre>
<code class="sourceCode" id="sourceCode">&nbsp;package it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events;
&nbsp;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventType;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventCard;
&nbsp;import it.polimi.ingsw.gc14.Model.Player;
&nbsp;import java.util.ArrayList;
&nbsp;
&nbsp;/**
&nbsp; * Represents a Cave Paintings event card.
&nbsp; *
&nbsp; * &lt;p&gt;This class defines the specific behavior of the Cave Paintings event.
&nbsp; */
&nbsp;public class CavePaintings extends EventCard {
&nbsp;
&nbsp; /**
&nbsp; * The minimum number of Artist cards required to avoid the prestige penalty.
&nbsp; * Also, the bottom number on the card.
&nbsp; */
&nbsp; private final int nLower;
&nbsp;
&nbsp; /**
&nbsp; * The amount of Prestige removed if the player has fewer Artist cards than {@code nLower}.
&nbsp; */
&nbsp; private final int nPrestigeRem;
&nbsp;
&nbsp; /**
&nbsp; * The Prestige multiplier applied if the player has at least {@code nLower} Artist cards.
&nbsp; */
&nbsp; private final int nPrestigeMul;
&nbsp;
&nbsp; /**
&nbsp; * Creates a CavePaintings event card with the specified era and effect parameters.
&nbsp; *
&nbsp; * @param Era the era of the event card.
&nbsp; * @param nLower the minimum number of Artist cards required to avoid the prestige penalty.
&nbsp; * @param nPrestigeRem the amount of Prestige removed if the player has fewer Artist cards than {@code nLower}.
&nbsp; * @param nPrestigeMul the Prestige multiplier applied if the player has at least {@code nLower} Artist cards.
&nbsp; */
&nbsp; public CavePaintings(int Era, int nLower, int nPrestigeRem, int nPrestigeMul) {
<b class="fc">&nbsp; super(Era, EventType.CAVE_PAINTINGS);</b>
<b class="fc">&nbsp; this.nLower = nLower;</b>
<b class="fc">&nbsp; this.nPrestigeRem = nPrestigeRem;</b>
<b class="fc">&nbsp; this.nPrestigeMul = nPrestigeMul;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Creates a CavePaintings event card with the specified image id, era and effect parameters.
&nbsp; *
&nbsp; * @param idIMG the image identifier of the CavePaintings event card.
&nbsp; * @param Era the era of the event card.
&nbsp; * @param nLower the minimum number of Artist cards required to avoid the prestige penalty.
&nbsp; * @param nPrestigeRem the amount of Prestige removed if the player has fewer Artist cards than {@code nLower}.
&nbsp; * @param nPrestigeMul the Prestige multiplier applied if the player has at least {@code nLower} Artist cards.
&nbsp; */
&nbsp; public CavePaintings(String idIMG,int Era, int nLower, int nPrestigeRem, int nPrestigeMul) {
<b class="fc">&nbsp; super(idIMG,Era, EventType.CAVE_PAINTINGS);</b>
<b class="fc">&nbsp; this.nLower = nLower;</b>
<b class="fc">&nbsp; this.nPrestigeRem = nPrestigeRem;</b>
<b class="fc">&nbsp; this.nPrestigeMul = nPrestigeMul;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Activates the CavePaintings event for the specified list of players.
&nbsp; * For each player, the number of Artist cards is computed together with the number
&nbsp; * of owned building cards having effect id equal to 9.
&nbsp; * The player gains Food equal to the number of such buildings multiplied by the number of Artist cards.
&nbsp; * If the player has fewer Artist cards than {@code nLower}, the player loses {@code nPrestigeRem} Prestige.
&nbsp; * Otherwise, the player gains Prestige equal to {@code nPrestigeMul} multiplied by the number of Artist cards.
&nbsp; *
&nbsp; * @param playerList the list of players affected by the event.
&nbsp; */
&nbsp; @Override
&nbsp; public void activateEvent (ArrayList &lt;Player&gt; playerList){
<b class="fc">&nbsp; for (Player player : playerList){</b>
<b class="fc">&nbsp; int nArtists = player.getNType(CharacterType.ARTIST);</b>
<b class="fc">&nbsp; int nBuildings = 0;</b>
<b class="fc">&nbsp; ArrayList&lt;BuildingCard&gt; buildingCards = player.getBuildingCards();</b>
&nbsp;
<b class="fc">&nbsp; for(BuildingCard card : buildingCards){</b>
<b class="fc">&nbsp; if(card.getEffectId() == 9){</b>
<b class="fc">&nbsp; nBuildings++;</b>
&nbsp; }
&nbsp; }
<b class="fc">&nbsp; player.addFood(nBuildings * nArtists);</b>
<b class="fc">&nbsp; if (nArtists &lt; nLower){</b>
<b class="fc">&nbsp; player.removePrestige(nPrestigeRem);</b>
&nbsp; }
&nbsp; else{
<b class="fc">&nbsp; player.addPrestige(nPrestigeMul * nArtists);</b>
&nbsp; }
&nbsp; }
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Creates and returns a copy of this CavePaintings event card.
&nbsp; *
&nbsp; * @return a clone of this CavePaintings event card.
&nbsp; */
&nbsp; @Override
&nbsp; public EventCard clone()
&nbsp; {
<b class="fc">&nbsp; return new CavePaintings(getIdIMG(),getEra(), nLower, nPrestigeRem, nPrestigeMul) ;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Prints a string representation of this {@code TribeCard}. This specific variation is used in the {@code Game}&#39;s
&nbsp; * toString to print a more detailed version.
&nbsp; * &lt;p&gt;NOTE: {@code NUpper} is not a real attribute used in calculations (only {@code nLower} is needed),
&nbsp; * however it&#39;s a parameter on the cards&#39; design.
&nbsp; * &lt;/p&gt;
&nbsp; * &lt;p&gt;Includes:
&nbsp; * &lt;li&gt;{@link #nLower}
&nbsp; * &lt;li&gt;{@code NUpper}
&nbsp; * &lt;li&gt;{@link #nPrestigeRem}
&nbsp; * &lt;li&gt;{@link #nPrestigeMul}
&nbsp; * &lt;/p&gt;
&nbsp; * @return {@code String} - a string representation of this {@code TribeCard}.
&nbsp; * @see it.polimi.ingsw.gc14.Model.Cards.TribeCard TribeCard
&nbsp; * @see it.polimi.ingsw.gc14.Model.Game Game
&nbsp; * @see it.polimi.ingsw.gc14.Model.GamePackage.Board Board
&nbsp; */
&nbsp; @Override
&nbsp; public String toStringPlayer() {
<b class="fc">&nbsp; return &quot;CAVE_PAINTINGS&quot;;</b>
&nbsp; }
&nbsp;
&nbsp; @Override
&nbsp; public String toStringBoard() {
<b class="fc">&nbsp; return &quot;\033[38;5;180mCAVE_PAINTINGS 0-&quot; + (nLower-1) + &quot;:&quot; + nPrestigeRem + &quot; &quot; + nLower + &quot;+:&quot; + nPrestigeMul + &quot;\033[0m&quot;;</b>
&nbsp; }
&nbsp;}
</code>
</pre>
</div>
<script type="text/javascript">
(function() {
var msie = false, msie9 = false;
/*@cc_on
msie = true;
@if (@_jscript_version >= 9)
msie9 = true;
@end
@*/
if (!msie || msie && msie9) {
hljs.highlightAll()
hljs.initLineNumbersOnLoad();
}
})();
</script>
<div class="footer">
<div style="float:right;">generated on 2026-06-19 22:53</div>
</div>
</body>
</html>
@@ -0,0 +1,216 @@
<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > Hunt</title>
<style type="text/css">
@import "../../css/coverage.css";
@import "../../css/idea.min.css";
</style>
<script type="text/javascript" src="../../js/highlight.min.js"></script>
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
</head>
<body>
<div class="content">
<div class="breadCrumbs">
Current scope: <a href="../../index.html">all classes</a>
<span class="separator">|</span>
<a href="../index.html">it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events</a>
</div>
<h1>Coverage Summary for Class: Hunt (it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events)</h1>
<table class="coverageStats">
<tr>
<th class="name">Class</th>
<th class="coverageStat
">
Class, %
</th>
<th class="coverageStat
">
Method, %
</th>
<th class="coverageStat
">
Branch, %
</th>
<th class="coverageStat
">
Line, %
</th>
</tr>
<tr>
<td class="name">Hunt</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(1/1)
</span>
</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(7/7)
</span>
</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(6/6)
</span>
</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(19/19)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<pre>
<code class="sourceCode" id="sourceCode">&nbsp;package it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events;
&nbsp;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventType;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventCard;
&nbsp;import it.polimi.ingsw.gc14.Model.Player;
&nbsp;import java.util.ArrayList;
&nbsp;
&nbsp;/**
&nbsp; * When activated, gives Food and Prestige Points to every player.
&nbsp; *
&nbsp; * @see EventCard
&nbsp; */
&nbsp;public class Hunt extends EventCard {
&nbsp; /** Base food units granted per Hunter. Always 1; increased by Building 7. */
&nbsp; private static final int BASE_FOOD_PER_HUNTER = 1;
&nbsp;
&nbsp; /** Prestige Points multiplier used during the event. */
&nbsp; private final int prestigeMultiplier;
&nbsp;
&nbsp; /**Gets Prestige Points multiplier used during the event.
&nbsp; * @return int {@code PrestigeMultiplier}
&nbsp; */
<b class="fc">&nbsp; int getPrestigeMultiplier() { return prestigeMultiplier; }</b>
&nbsp;
&nbsp; /**
&nbsp; * Creates a new Hunt event card.
&nbsp; *
&nbsp; * @param Era the era of the card
&nbsp; * @param prestigeMultiplier prestige points multiplicator used during the event
&nbsp; */
&nbsp; public Hunt(int Era, int prestigeMultiplier) {
<b class="fc">&nbsp; super(Era, EventType.HUNT);</b>
<b class="fc">&nbsp; this.prestigeMultiplier = prestigeMultiplier;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Creates a new Hunt event card.
&nbsp; *
&nbsp; * @param idIMG the image identifier of the Hunt event card.
&nbsp; * @param Era the era of the card.
&nbsp; * @param prestigeMultiplier the prestige points multiplier used during the event.
&nbsp; */
&nbsp; public Hunt(String idIMG, int Era, int prestigeMultiplier) {
<b class="fc">&nbsp; super(idIMG, Era, EventType.HUNT);</b>
<b class="fc">&nbsp; this.prestigeMultiplier = prestigeMultiplier;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Activates the event card &quot;Hunt&quot;.
&nbsp; * Each player gains Food and Prestige Points for each Hunter in their tribe,
&nbsp; * multiplied by the respective multipliers (base food per hunter is 1).
&nbsp; * Buildings influence:
&nbsp; * Building 7: adds 1 to both the food and prestige multiplier for each copy owned.
&nbsp; *
&nbsp; * @param playerList the list of all players in the game.
&nbsp; */
&nbsp; @Override
&nbsp; public void activateEvent (ArrayList &lt;Player&gt; playerList){
<b class="fc">&nbsp; for (Player player : playerList) {</b>
<b class="fc">&nbsp; int tmpFoodMultiplier = BASE_FOOD_PER_HUNTER;</b>
<b class="fc">&nbsp; int tmpPrestigeMultiplier = prestigeMultiplier;</b>
&nbsp;
<b class="fc">&nbsp; ArrayList &lt;BuildingCard&gt; buildingList = player.getBuildingCards();</b>
<b class="fc">&nbsp; int hunterCounter=player.getNType(CharacterType.HUNTER);</b>
&nbsp;
<b class="fc">&nbsp; for (BuildingCard buildingCard : buildingList) {</b>
<b class="fc">&nbsp; if (buildingCard.getEffectId() == 7) {</b>
<b class="fc">&nbsp; tmpFoodMultiplier++;</b>
<b class="fc">&nbsp; tmpPrestigeMultiplier++;</b>
&nbsp; }
&nbsp; }
&nbsp;
<b class="fc">&nbsp; player.addFood(tmpFoodMultiplier * hunterCounter);</b>
<b class="fc">&nbsp; player.addPrestige(tmpPrestigeMultiplier * hunterCounter);</b>
&nbsp; }
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Creates and returns a copy of this Hunt card.
&nbsp; *
&nbsp; * @return a new Hunt card with the same era and prestige multiplier
&nbsp; */
&nbsp; @Override
&nbsp; public EventCard clone() {
<b class="fc">&nbsp; return new Hunt(getIdIMG(),getEra(), prestigeMultiplier);</b>
&nbsp; }
&nbsp;
&nbsp; @Override
&nbsp; public String toStringPlayer() {
<b class="fc">&nbsp; return &quot;HUNT&quot;;</b>
&nbsp; }
&nbsp;
&nbsp; @Override
&nbsp; public String toStringBoard() {
<b class="fc">&nbsp; return &quot;\033[38;5;180mHUNT 1\uD83C\uDF56+&quot; + prestigeMultiplier + &quot;\uD83C\uDFC5×\uD83C\uDFF9&quot; + &quot;\033[0m&quot;;</b>
&nbsp; }
&nbsp;
&nbsp;}
</code>
</pre>
</div>
<script type="text/javascript">
(function() {
var msie = false, msie9 = false;
/*@cc_on
msie = true;
@if (@_jscript_version >= 9)
msie9 = true;
@end
@*/
if (!msie || msie && msie9) {
hljs.highlightAll()
hljs.initLineNumbersOnLoad();
}
})();
</script>
<div class="footer">
<div style="float:right;">generated on 2026-06-19 22:53</div>
</div>
</body>
</html>
@@ -0,0 +1,268 @@
<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > ShamanicRitual</title>
<style type="text/css">
@import "../../css/coverage.css";
@import "../../css/idea.min.css";
</style>
<script type="text/javascript" src="../../js/highlight.min.js"></script>
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
</head>
<body>
<div class="content">
<div class="breadCrumbs">
Current scope: <a href="../../index.html">all classes</a>
<span class="separator">|</span>
<a href="../index.html">it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events</a>
</div>
<h1>Coverage Summary for Class: ShamanicRitual (it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events)</h1>
<table class="coverageStats">
<tr>
<th class="name">Class</th>
<th class="coverageStat
">
Class, %
</th>
<th class="coverageStat
">
Method, %
</th>
<th class="coverageStat
">
Branch, %
</th>
<th class="coverageStat
">
Line, %
</th>
</tr>
<tr>
<td class="name">ShamanicRitual</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(1/1)
</span>
</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(8/8)
</span>
</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(24/24)
</span>
</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(29/29)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<pre>
<code class="sourceCode" id="sourceCode">&nbsp;package it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events;
&nbsp;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventType;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventCard;
&nbsp;import it.polimi.ingsw.gc14.Model.Player;
&nbsp;import java.util.ArrayList;
&nbsp;import java.util.HashMap;
&nbsp;import java.util.List;
&nbsp;import java.util.Map;
&nbsp;
&nbsp;/**
&nbsp; * When activated, rewards the player with the most shaman icons and penalizes the one with the fewest.
&nbsp; *
&nbsp; * @see EventCard
&nbsp; */
&nbsp;public class ShamanicRitual extends EventCard {
&nbsp; /** Bonus shaman icons granted per Building 5 owned during this event. */
&nbsp; private static final int BUILDING5_BONUS_ICONS = 3;
&nbsp;
&nbsp; /** Prestige points awarded to the player with the most shaman icons. */
&nbsp; private final int prestigeToAdd;
&nbsp;
&nbsp; /**
&nbsp; * Returns the prestige points awarded to the player with the most shaman icons.
&nbsp; *
&nbsp; * @return prestige points to award.
&nbsp; */
<b class="fc">&nbsp; int getPrestigeToAdd() { return prestigeToAdd; }</b>
&nbsp;
&nbsp; /** Prestige points removed from the player with the fewest shaman icons. */
&nbsp; private final int prestigeToRemove;
&nbsp;
&nbsp; /**
&nbsp; * Returns the prestige points removed from the player with the fewest shaman icons.
&nbsp; *
&nbsp; * @return prestige points to remove.
&nbsp; */
<b class="fc">&nbsp; int getPrestigeToRemove() { return prestigeToRemove; }</b>
&nbsp;
&nbsp; /**
&nbsp; * Creates a new ShamanicRitual event card.
&nbsp; *
&nbsp; * @param Era the era of the card
&nbsp; * @param prestigeToAdd prestige points awarded to the player with the most icons
&nbsp; * @param prestigeToRemove prestige points removed from the player with the fewest icons
&nbsp; */
&nbsp; public ShamanicRitual(int Era, int prestigeToAdd, int prestigeToRemove) {
<b class="fc">&nbsp; super(Era, EventType.SHAMANIC_RITUAL);</b>
<b class="fc">&nbsp; this.prestigeToAdd = prestigeToAdd;</b>
<b class="fc">&nbsp; this.prestigeToRemove = prestigeToRemove;</b>
&nbsp;
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Creates a new ShamanicRitual event card.
&nbsp; *
&nbsp; * @param idIMG the image identifier of the ShamanicRitual event card.
&nbsp; * @param Era the era of the card.
&nbsp; * @param prestigeToAdd prestige points awarded to the player with the most icons.
&nbsp; * @param prestigeToRemove prestige points removed from the player with the fewest icons.
&nbsp; */
&nbsp; public ShamanicRitual(String idIMG,int Era, int prestigeToAdd, int prestigeToRemove) {
<b class="fc">&nbsp; super(idIMG,Era, EventType.SHAMANIC_RITUAL);</b>
<b class="fc">&nbsp; this.prestigeToAdd = prestigeToAdd;</b>
<b class="fc">&nbsp; this.prestigeToRemove = prestigeToRemove;</b>
&nbsp;
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Activates the event card &quot;Shamanic Ritual&quot;.
&nbsp; * The player with the most icons gains the Prestige Points indicated.
&nbsp; * The player with the fewest icons loses the Prestige Points indicated.
&nbsp; * In case of a tie, all players gain or lose the Prestige Points indicated.
&nbsp; * If all players have the same amount of icons, they all gain and lose Prestige Points.
&nbsp; * Buildings influence:
&nbsp; * Building 2: if you have the lowest number of icons, you don&#39;t lose Prestige Points
&nbsp; * Building 5: during the Shamanic Ritual, you gain 3 icons
&nbsp; * Building 6: if you have more icons than any other player, you gain double of Prestige Points
&nbsp; *
&nbsp; * @param playerList contains all the players in the game
&nbsp; */
&nbsp; @Override
&nbsp; public void activateEvent (ArrayList &lt;Player&gt; playerList){
<b class="fc">&nbsp; Map&lt;Player, Integer&gt; playerMap = new HashMap&lt;&gt;();</b>
&nbsp; int tmpIcons;
&nbsp; int tmpCount;
&nbsp;
<b class="fc">&nbsp; for (Player player : playerList) {</b>
<b class="fc">&nbsp; tmpIcons = player.getShamans().stream().mapToInt(sh -&gt; sh.getIcon()).sum();</b>
<b class="fc">&nbsp; tmpCount = (int) player.getBuildingCards().stream().filter(b -&gt; b.getEffectId() == 5).count();</b>
<b class="fc">&nbsp; if (tmpCount &gt;= 1) {</b>
<b class="fc">&nbsp; tmpIcons = tmpIcons+(BUILDING5_BONUS_ICONS *tmpCount);</b>
&nbsp; }
<b class="fc">&nbsp; playerMap.put(player, tmpIcons);</b>
&nbsp; }
&nbsp;
<b class="fc">&nbsp; int maxIcon = playerMap.values().stream().mapToInt(Integer::intValue).max().orElse(0);</b>
<b class="fc">&nbsp; int minIcon = playerMap.values().stream().mapToInt(Integer::intValue).min().orElse(0);</b>
&nbsp;
<b class="fc">&nbsp; List&lt;Player&gt; maxIconsPlayer = playerMap.entrySet().stream().filter(e -&gt; e.getValue() == maxIcon).map(Map.Entry::getKey).toList();</b>
<b class="fc">&nbsp; List&lt;Player&gt; minIconsPlayer = playerMap.entrySet().stream().filter(e -&gt; e.getValue() == minIcon).map(Map.Entry::getKey).toList();</b>
&nbsp;
&nbsp;
<b class="fc">&nbsp; for (Player player : maxIconsPlayer) {</b>
<b class="fc">&nbsp; if (player.getBuildingCards().stream().anyMatch(b -&gt; b.getEffectId() == 6) &amp;&amp; maxIconsPlayer.size() == 1) {</b>
<b class="fc">&nbsp; player.addPrestige(prestigeToAdd * 2);</b>
&nbsp; } else {
<b class="fc">&nbsp; player.addPrestige(prestigeToAdd);</b>
&nbsp; }
&nbsp; }
&nbsp;
<b class="fc">&nbsp; for (Player player : minIconsPlayer) {</b>
<b class="fc">&nbsp; if (player.getBuildingCards().stream().noneMatch(b -&gt; b.getEffectId() == 2)) {</b>
<b class="fc">&nbsp; player.removePrestige(prestigeToRemove);</b>
&nbsp; }
&nbsp; }
&nbsp;
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Creates and returns a copy of this ShamanicRitual card.
&nbsp; *
&nbsp; * @return a new ShamanicRitual card with the same era and prestige values
&nbsp; */
&nbsp; @Override
&nbsp; public EventCard clone() {
<b class="fc">&nbsp; return new ShamanicRitual(getIdIMG(),getEra(), prestigeToAdd, prestigeToRemove);</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Prints a string representation of this {@code TribeCard}. This specific variation is used in the {@code Game}&#39;s
&nbsp; * toString to print a more detailed version.
&nbsp; * &lt;p&gt;Includes:
&nbsp; * &lt;li&gt;{@link #prestigeToAdd}
&nbsp; * &lt;li&gt;{@link #prestigeToRemove}
&nbsp; * &lt;/p&gt;
&nbsp; * @return {@code String} - a string representation of this {@code TribeCard}.
&nbsp; * @see it.polimi.ingsw.gc14.Model.Cards.TribeCard TribeCard
&nbsp; * @see it.polimi.ingsw.gc14.Model.Game Game
&nbsp; * @see it.polimi.ingsw.gc14.Model.GamePackage.Board Board
&nbsp; */
&nbsp; @Override
&nbsp; public String toStringPlayer() {
<b class="fc">&nbsp; return &quot;SHAMANIC_RITUAL&quot;;</b>
&nbsp; }
&nbsp;
&nbsp; @Override
&nbsp; public String toStringBoard() {
<b class="fc">&nbsp; return &quot;\033[38;5;180mSHAMANIC_RITUAL \uD83C\uDF1F&gt;:&quot; + prestigeToAdd + &quot; \uD83C\uDF1F&lt;:&quot; + prestigeToRemove + &quot;\033[0m&quot;;</b>
&nbsp; }
&nbsp;
&nbsp;}
</code>
</pre>
</div>
<script type="text/javascript">
(function() {
var msie = false, msie9 = false;
/*@cc_on
msie = true;
@if (@_jscript_version >= 9)
msie9 = true;
@end
@*/
if (!msie || msie && msie9) {
hljs.highlightAll()
hljs.initLineNumbersOnLoad();
}
})();
</script>
<div class="footer">
<div style="float:right;">generated on 2026-06-19 22:53</div>
</div>
</body>
</html>
@@ -0,0 +1,247 @@
<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > Sustenance</title>
<style type="text/css">
@import "../../css/coverage.css";
@import "../../css/idea.min.css";
</style>
<script type="text/javascript" src="../../js/highlight.min.js"></script>
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
</head>
<body>
<div class="content">
<div class="breadCrumbs">
Current scope: <a href="../../index.html">all classes</a>
<span class="separator">|</span>
<a href="../index.html">it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events</a>
</div>
<h1>Coverage Summary for Class: Sustenance (it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events)</h1>
<table class="coverageStats">
<tr>
<th class="name">Class</th>
<th class="coverageStat
">
Class, %
</th>
<th class="coverageStat
">
Method, %
</th>
<th class="coverageStat
">
Branch, %
</th>
<th class="coverageStat
">
Line, %
</th>
</tr>
<tr>
<td class="name">Sustenance</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(1/1)
</span>
</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(7/7)
</span>
</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(10/10)
</span>
</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(23/23)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<pre>
<code class="sourceCode" id="sourceCode">&nbsp;package it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events;
&nbsp;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.Building.Effects.Building1;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventType;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventCard;
&nbsp;import it.polimi.ingsw.gc14.Model.Player;
&nbsp;import java.util.ArrayList;
&nbsp;
&nbsp;/**
&nbsp; * Represents a Sustenance event card.
&nbsp; *
&nbsp; * &lt;p&gt;This class defines the specific behavior of the Sustenance event.
&nbsp; */
&nbsp;public class Sustenance extends EventCard {
&nbsp;
&nbsp; /** Food units covered by each Gatherer during the Sustenance event. */
&nbsp; private static final int FOOD_PER_GATHERER = 3;
&nbsp;
&nbsp; /**
&nbsp; * The prestige penalty multiplier applied for each unpaid Food unit.
&nbsp; */
&nbsp; private final int prestigeDebt;
&nbsp;
&nbsp; /**
&nbsp; * Returns the prestige penalty multiplier associated with this Sustenance event.
&nbsp; *
&nbsp; * @return the prestige penalty multiplier associated with this Sustenance event.
&nbsp; */
&nbsp; public int getPrestigeDebt() {
<b class="fc">&nbsp; return prestigeDebt;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Creates a Sustenance event card with the specified era and prestige debt value.
&nbsp; *
&nbsp; * @param Era the era of the event card.
&nbsp; * @param prestigeDebt the prestige penalty multiplier for unpaid Food units.
&nbsp; */
&nbsp; public Sustenance(int Era, int prestigeDebt) {
<b class="fc">&nbsp; super(Era, EventType.SUSTENANCE);</b>
<b class="fc">&nbsp; this.prestigeDebt = prestigeDebt;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Creates a Sustenance event card with the specified image id, era and prestige debt value.
&nbsp; *
&nbsp; * @param idIMG the image identifier of the Sustenance event card.
&nbsp; * @param Era the era of the event card.
&nbsp; * @param prestigeDebt the prestige penalty multiplier for unpaid Food units.
&nbsp; */
&nbsp; public Sustenance(String idIMG,int Era, int prestigeDebt) {
<b class="fc">&nbsp; super(idIMG,Era, EventType.SUSTENANCE);</b>
<b class="fc">&nbsp; this.prestigeDebt = prestigeDebt;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Activates the Sustenance event for the specified list of players.
&nbsp; * For each player, the required Food is computed from the total number of characters,
&nbsp; * reduced by the contribution of Gatherers and by any applicable character discounts
&nbsp; * granted by owned building cards with effect id equal to 1.
&nbsp; * If the resulting Food debt is positive, the player must pay it with available Food.
&nbsp; * If the player does not have enough Food, all remaining Food is removed and the player
&nbsp; * loses Prestige equal to the unpaid Food debt multiplied by {@code prestigeDebt}.
&nbsp; * &lt;b&gt;This event is intended to be executed last among event effects.&lt;/b&gt;
&nbsp; *
&nbsp; * @param playerList the list of players affected by the event.
&nbsp; */
&nbsp; @Override
&nbsp; public void activateEvent (ArrayList &lt;Player&gt; playerList) {
<b class="fc">&nbsp; for(Player player : playerList){</b>
<b class="fc">&nbsp; int nChar = player.getTotCharacters();</b>
<b class="fc">&nbsp; int nGatherers = player.getNType(CharacterType.GATHERER);</b>
&nbsp;
<b class="fc">&nbsp; int nCharDiscount = 0;</b>
<b class="fc">&nbsp; for(BuildingCard b : player.getBuildingCards()){</b>
<b class="fc">&nbsp; if(b.getEffectId() == 1){</b>
<b class="fc">&nbsp; CharacterType c = ((Building1)b).getIcon();</b>
<b class="fc">&nbsp; nCharDiscount += player.getNType(c);</b>
&nbsp; }
&nbsp; }
&nbsp;
&nbsp;
<b class="fc">&nbsp; int foodDebt = nChar - (FOOD_PER_GATHERER * nGatherers + nCharDiscount);</b>
&nbsp;
<b class="fc">&nbsp; if(foodDebt &lt;= 0){</b>
&nbsp; continue;
&nbsp; }
<b class="fc">&nbsp; if(player.getFoodValue() &gt;= foodDebt){</b>
<b class="fc">&nbsp; player.removeFood(foodDebt);</b>
&nbsp; }
&nbsp; else{
<b class="fc">&nbsp; foodDebt -= player.getFoodValue();</b>
<b class="fc">&nbsp; player.removeFood(player.getFoodValue());</b>
<b class="fc">&nbsp; player.removePrestige(foodDebt * prestigeDebt);</b>
&nbsp; }
&nbsp; }
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Creates and returns a copy of this Sustenance event card.
&nbsp; *
&nbsp; * @return a clone of this Sustenance event card.
&nbsp; */
&nbsp; @Override
&nbsp; public EventCard clone() {
<b class="fc">&nbsp; return new Sustenance(getIdIMG(),getEra(), prestigeDebt);</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Prints a string representation of this {@code TribeCard}. This specific variation is used in the {@code Game}&#39;s
&nbsp; * toString to print a more detailed version.
&nbsp; * &lt;p&gt;Includes:
&nbsp; * &lt;li&gt;{@link #prestigeDebt}
&nbsp; * &lt;/p&gt;
&nbsp; * @return {@code String} - a string representation of this {@code TribeCard}.
&nbsp; * @see it.polimi.ingsw.gc14.Model.Cards.TribeCard TribeCard
&nbsp; * @see it.polimi.ingsw.gc14.Model.Game Game
&nbsp; * @see it.polimi.ingsw.gc14.Model.GamePackage.Board Board
&nbsp; */
&nbsp; @Override
&nbsp; public String toStringPlayer() {
<b class="fc">&nbsp; return &quot;SUSTENANCE&quot;;</b>
&nbsp; }
&nbsp;
&nbsp; @Override
&nbsp; public String toStringBoard() {
<b class="fc">&nbsp; return &quot;\033[38;5;180mSUSTENANCE -1\uD83C\uDF56/-&quot; + prestigeDebt + &quot;\uD83C\uDFC5\033[0m&quot;;</b>
&nbsp; }
&nbsp;}
</code>
</pre>
</div>
<script type="text/javascript">
(function() {
var msie = false, msie9 = false;
/*@cc_on
msie = true;
@if (@_jscript_version >= 9)
msie9 = true;
@end
@*/
if (!msie || msie && msie9) {
hljs.highlightAll()
hljs.initLineNumbersOnLoad();
}
})();
</script>
<div class="footer">
<div style="float:right;">generated on 2026-06-19 22:53</div>
</div>
</body>
</html>