Files
2026-06-19 22:57:43 +02:00

236 lines
6.8 KiB
HTML

<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > Hunter</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.Characters</a>
</div>
<h1>Coverage Summary for Class: Hunter (it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters)</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">Hunter</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">
(9/9)
</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">
(16/16)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<pre>
<code class="sourceCode" id="sourceCode">&nbsp;package it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters;
&nbsp;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
&nbsp;import it.polimi.ingsw.gc14.Model.Player;
&nbsp;
&nbsp;/**
&nbsp; * Represents a Hunter character card.
&nbsp; *
&nbsp; * &lt;p&gt;A Hunter is a specific type of {@link Character} initialized with
&nbsp; * {@link CharacterType#HUNTER}.
&nbsp; */
&nbsp;public class Hunter extends Character {
&nbsp;
&nbsp; /**
&nbsp; * Describes whether the {@code Hunter Icon} is present or not. Whenever an
&nbsp; * {@code Hunter} with an {@code Hunter Icon} is added to the tribe, 1 {@code Food token} is awarded for each Hunter in the tribe
&nbsp; * (with or without an icon).
&nbsp; */
&nbsp; private final boolean icon;
&nbsp;
&nbsp; /**
&nbsp; * Returns whether this Hunter card has the icon.
&nbsp; *
&nbsp; * @return {@code true} if this Hunter card has the icon, {@code false} otherwise.
&nbsp; */
&nbsp; public boolean getIcon() {
<b class="fc">&nbsp; return icon;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Creates a Hunter character card with the specified era and icon value.
&nbsp; *
&nbsp; * @param Era the era of the Hunter card.
&nbsp; * @param icon the icon value of the Hunter card.
&nbsp; */
&nbsp; public Hunter(int Era, boolean icon) {
<b class="fc">&nbsp; super(Era, CharacterType.HUNTER);</b>
<b class="fc">&nbsp; this.icon = icon;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Creates a Hunter character card with the specified era, icon value,
&nbsp; * and minimum number of players.
&nbsp; *
&nbsp; * @param Era the era of the Hunter card.
&nbsp; * @param icon the icon value of the Hunter card.
&nbsp; * @param nMin the minimum number of players required for the card.
&nbsp; */
&nbsp; public Hunter(int Era, boolean icon, int nMin) {
<b class="fc">&nbsp; super(Era, CharacterType.HUNTER,nMin);</b>
<b class="fc">&nbsp; this.icon = icon;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Creates a Hunter character card with the specified image id, era and icon value.
&nbsp; *
&nbsp; * @param idIMG the image identifier of the Hunter card.
&nbsp; * @param Era the era of the Hunter card.
&nbsp; * @param icon the icon value of the Hunter card.
&nbsp; */
&nbsp; public Hunter(String idIMG,int Era, boolean icon) {
<b class="fc">&nbsp; super(idIMG,Era, CharacterType.HUNTER);</b>
<b class="fc">&nbsp; this.icon = icon;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Creates a Hunter character card with the specified image id, era, icon value,
&nbsp; * and minimum number of players.
&nbsp; *
&nbsp; * @param idIMG the image identifier of the Hunter card.
&nbsp; * @param Era the era of the Hunter card.
&nbsp; * @param icon the icon value of the Hunter card.
&nbsp; * @param nMin the minimum number of players required for the card.
&nbsp; */
&nbsp; public Hunter(String idIMG,int Era, boolean icon, int nMin) {
<b class="fc">&nbsp; super(idIMG,Era, CharacterType.HUNTER,nMin);</b>
<b class="fc">&nbsp; this.icon = icon;</b>
&nbsp; }
&nbsp;
&nbsp; @Override
&nbsp; public String toStringPlayer() {
<b class="fc">&nbsp; return this.icon ? &quot;\uD83C\uDF56&quot; : &quot;&quot;;</b>
&nbsp; }
&nbsp;
&nbsp; @Override
&nbsp; public String toStringBoard() {
<b class="fc">&nbsp; return &quot;HUNTER&quot; + (this.icon ? &quot; \uD83C\uDF56&quot; : &quot;&quot;);</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Creates and returns a copy of this Hunter card.
&nbsp; *
&nbsp; * @return a clone of this Hunter card.
&nbsp; */
&nbsp; @Override
&nbsp; public Character clone() {
<b class="fc">&nbsp; return new Hunter(getIdIMG(),getEra(), getIcon(), getNMin());</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Inserts this Hunter card into the specified player&#39;s Hunter collection.
&nbsp; *
&nbsp; * &lt;p&gt;If this card has the Hunter icon, the player gains 1 food for each
&nbsp; * Hunter currently in their tribe. The method also applies any building
&nbsp; * effects triggered by character set completion.
&nbsp; *
&nbsp; * @param player the player who receives the card.
&nbsp; */
&nbsp; @Override
&nbsp; public void insert(Player player) {
<b class="fc">&nbsp; player.getHunters().add(this);</b>
<b class="fc">&nbsp; if(this.getIcon()){</b>
<b class="fc">&nbsp; player.addFood(player.getHunters().size());</b>
&nbsp; }
<b class="fc">&nbsp; player.getBuildingCards().stream().filter(x-&gt;x.getEffectId()==0).forEach(x-&gt;x.applyEffect(player));</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>