Add: Added Coverage Screenshots And htlmReport.
This commit is contained in:
@@ -0,0 +1,264 @@
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html id="htmlId">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Coverage Report > Building0</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.Building.Effects</a>
|
||||
</div>
|
||||
|
||||
<h1>Coverage Summary for Class: Building0 (it.polimi.ingsw.gc14.Model.Cards.Building.Effects)</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">Building0</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">
|
||||
81.2%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(13/16)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
100%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(30/30)
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<pre>
|
||||
<code class="sourceCode" id="sourceCode"> package it.polimi.ingsw.gc14.Model.Cards.Building.Effects;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.Cards.Building.EffectType;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Building effect that grants 5 food for each new complete set of
|
||||
* 6 different character types obtained after purchasing this building.
|
||||
*
|
||||
* <p>Character sets already completed before the building is purchased
|
||||
* are stored during initialization and do not provide food.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
private boolean purchased;
|
||||
|
||||
/**
|
||||
* Number of complete character sets already counted by this building effect.
|
||||
*/
|
||||
private int numSet;
|
||||
|
||||
/**
|
||||
* Creates a building with the specified image identifier, era, price
|
||||
* and prestige value.
|
||||
*
|
||||
* @param idImage the image identifier of the building.
|
||||
* @param era the game era of the building.
|
||||
* @param price the price in food of the building.
|
||||
* @param prestigeValue the number of Prestige Points granted by this building
|
||||
* at the end of the game.
|
||||
*/
|
||||
public Building0(String idImage,int era,int price,int prestigeValue) {
|
||||
<b class="fc"> super(idImage,era,price,prestigeValue);</b>
|
||||
<b class="fc"> effectType=EffectType.CARD_SET;</b>
|
||||
<b class="fc"> effectId=0;</b>
|
||||
<b class="fc"> purchased = false;</b>
|
||||
<b class="fc"> numSet = 0;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a building with the specified era, price and prestige value.
|
||||
*
|
||||
* @param era the game era of the building.
|
||||
* @param price the price in food of the building.
|
||||
* @param prestigeValue the number of Prestige Points granted by this building
|
||||
* at the end of the game.
|
||||
*/
|
||||
public Building0(int era,int price,int prestigeValue) {
|
||||
<b class="fc"> super(era,price,prestigeValue);</b>
|
||||
<b class="fc"> effectType=EffectType.CARD_SET;</b>
|
||||
<b class="fc"> effectId=0;</b>
|
||||
<b class="fc"> purchased = false;</b>
|
||||
<b class="fc"> numSet = 0;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to purchase the building and initializes its effect if the
|
||||
* purchase succeeds.
|
||||
*
|
||||
* @param player the player who attempts to buy the building.
|
||||
* @return {@code true} if the building is successfully purchased and initialized,
|
||||
* {@code false} otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean buy(Player player)
|
||||
{
|
||||
<b class="fc"> if(!super.buy(player))</b>
|
||||
<b class="fc"> return false;</b>
|
||||
<b class="fc"> initialize(player);</b>
|
||||
<b class="fc"> return true;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the building effect by storing the number of complete
|
||||
* character sets already owned by the player at the moment of purchase.
|
||||
*
|
||||
* <p>The initialization is performed only once.
|
||||
*
|
||||
* @param player the player who owns the building.
|
||||
*/
|
||||
public void initialize(Player player)
|
||||
{
|
||||
<b class="pc"> if(purchased)</b>
|
||||
{
|
||||
return;
|
||||
}
|
||||
<b class="fc"> numSet=player.getNType(CharacterType.INVENTOR);</b>
|
||||
<b class="fc"> for(CharacterType type : CharacterType.values())</b>
|
||||
{
|
||||
<b class="pc"> if(player.getNType(type)<=numSet)</b>
|
||||
<b class="fc"> numSet=player.getNType(type);</b>
|
||||
}
|
||||
<b class="fc"> purchased = true;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new building instance with the same configuration values
|
||||
* as this card.
|
||||
*
|
||||
* <p>The runtime state of the effect, such as initialization status and
|
||||
* counted character sets, is not copied.
|
||||
*
|
||||
* @return a new building card with the same base properties.
|
||||
*/
|
||||
@Override
|
||||
public BuildingCard clone() {
|
||||
<b class="fc"> return new Building0(getIdIMG(),getEra(),getPrice(),getPrestigeValue());</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the building effect to the specified player.
|
||||
*
|
||||
* <p>The method counts the complete character sets currently owned by the player
|
||||
* and grants 5 food for each set completed since the last stored value.
|
||||
*
|
||||
* @param player the player who owns the building.
|
||||
* @throws IllegalArgumentException if the specified player does not own this card.
|
||||
*/
|
||||
@Override
|
||||
public void applyEffect(Player player) throws IllegalArgumentException {
|
||||
<b class="fc"> if(!player.getBuildingCards().contains(this))</b>
|
||||
<b class="fc"> throw new IllegalArgumentException();</b>
|
||||
<b class="fc"> int min_temp=player.getNType(CharacterType.INVENTOR);</b>
|
||||
<b class="fc"> for(CharacterType type : CharacterType.values())</b>
|
||||
{
|
||||
<b class="pc"> if(player.getNType(type)<=min_temp)</b>
|
||||
<b class="fc"> min_temp=player.getNType(type);</b>
|
||||
}
|
||||
<b class="fc"> if(min_temp<=numSet)</b>
|
||||
{
|
||||
return;
|
||||
}
|
||||
<b class="fc"> player.addFood(FOOD_PER_CHARACTER_SET *(min_temp-numSet));</b>
|
||||
<b class="fc"> numSet=min_temp;</b>
|
||||
}
|
||||
|
||||
}
|
||||
</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-14 21:53</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user