Coverage Summary for Class: Building11 (it.polimi.ingsw.gc14.Model.Cards.Building.Effects)

Class Class, % Method, % Branch, % Line, %
Building11 100% (1/1) 87.5% (7/8) 100% (2/2) 94.4% (17/18)


 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.Cards.TribeCards.CharacterType;
 import it.polimi.ingsw.gc14.Model.Player;
 
 /**
  * At the end of the game, the player gains Prestige Points based on the number
  * of cards of the indicated character type in their tribe.
  *
  * <p>The gained amount is equal to the number of matching character cards
  * multiplied by the building's prestige multiplier.
  */
 public class Building11 extends BuildingCard {
 
     /**
      * The character type involved in this building effect.
      */
     private final CharacterType characterType;
 
     /**
      * Returns the CharacterType associated with this building card effect.
      *
      * @return the CharacterType associated with this building card effect.
      */
     public CharacterType getIcon() { return characterType; }
 
     /**
      * The prestige multiplier applied per matching character card at end of game.
      */
     private final int prestigeMul;
 
     /**
      * Returns the prestige multiplier associated with this building card effect.
      *
      * @return the prestige multiplier associated with this building card effect.
      */
     public int getPrestigeMul() {return prestigeMul;}
 
     /**
      * Creates a Building11 card with the specified era, price, prestige value,
      * character type icon, and prestige multiplier.
      *
      * @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.
      * @param icon the CharacterType associated with the building card effect.
      * @param prestigeMul the prestige multiplier of the building card effect.
      */
     public Building11(int era, int price,int prestigeValue, CharacterType  icon, int prestigeMul) {
         super(era,price,prestigeValue);
         effectType = EffectType.FINAL;
         effectId = 11;
         this.characterType = icon;
         this.prestigeMul = prestigeMul;
     }
 
     /**
      * Creates a Building11 card with the specified image id, era, price, prestige value,
      * character type icon, and prestige multiplier.
      *
      * @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.
      * @param icon the CharacterType associated with the building card effect.
      * @param prestigeMul the prestige multiplier of the building card effect.
      */
     public Building11(String idIMG,int era, int price,int prestigeValue, CharacterType  icon, int prestigeMul) {
         super(idIMG,era,price,prestigeValue);
         effectType = EffectType.FINAL;
         effectId = 11;
         this.characterType = icon;
         this.prestigeMul = prestigeMul;
     }
 
     /**
      * Creates and returns a copy of this Building11 card.
      *
      * @return a clone of this Building11 card.
      */
     @Override
     public BuildingCard clone() {
         return new Building11(getIdIMG(),getEra(),getPrice(),getPrestigeValue(), getIcon(), getPrestigeMul());
     }
 
     /**
      * Applies the effect of this building card to the specified player.
      * The effect grants prestige points equal to the number of cards of the
      * associated CharacterType owned by the player, multiplied by the prestige multiplier.
      *
      * @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(player.getNType(getIcon()) * this.getPrestigeMul());
     }
 
     @Override
     public String toStringBoard() {
         return super.toStringBoard() + "+" + this.characterType.toString().substring(0, 3) + "×" + this.prestigeMul;
     }
 
     @Override
     public String toStringPlayer() {
         return super.toStringPlayer() + " (\uD83C\uDFC5:" + this.characterType.toString().substring(0, 3) + "×" + this.prestigeMul + ")";
     }
 }