Coverage Summary for Class: Building13 (it.polimi.ingsw.gc14.Model.Cards.Building.Effects)
| Class |
Class, %
|
Method, %
|
Branch, %
|
Line, %
|
| Building13 |
100%
(1/1)
|
100%
(4/4)
|
100%
(2/2)
|
100%
(10/10)
|
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;
/**
* At the end of the game, this building grants 25 Prestige Points
* to the player who owns it.
*/
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.
*
* @param era the era of the building card.
* @param price the price of the building card.
* @param prestigeValue the prestige value of the building card.
*/
public Building13(int era, int price,int prestigeValue) {
super(era,price,prestigeValue);
effectType= EffectType.FINAL;
effectId=13;
}
/**
* Creates a Building13 card with the specified image id, era, price, and prestige value.
*
* @param idIMG the image identifier of the building card.
* @param era the era of the building card.
* @param price the price of the building card.
* @param prestigeValue the prestige value of the building card.
*/
public Building13(String idIMG,int era, int price,int prestigeValue) {
super(idIMG,era,price,prestigeValue);
effectType= EffectType.FINAL;
effectId=13;
}
/**
* Creates and returns a copy of this Building13 card.
*
* @return a clone of this Building13 card.
*/
@Override
public BuildingCard clone() {
return new Building13(getIdIMG(),getEra(),getPrice(),getPrestigeValue());
}
/**
* Applies the effect of this building card to the specified player,
* granting 25 Prestige Points.
*
* @param player the player to whom the effect is applied.
* @throws IllegalArgumentException if the player does not own this building card.
*/
public void applyEffect(Player player) throws IllegalArgumentException {
if(!player.getBuildingCards().contains(this))
throw new IllegalArgumentException();
player.addPrestige(PRESTIGE_AWARD);
}
}