Files
Progetto-ingegneria-del-sof…/deliverables/Coverage/htmReport/ns-9/sources/source-2.html
T
2026-06-19 22:57:43 +02:00

217 lines
6.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!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>