Coverage Summary for Class: Shaman (it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters)
| Class |
Class, %
|
Method, %
|
Line, %
|
| Shaman |
100%
(1/1)
|
100%
(9/9)
|
100%
(14/14)
|
package it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters;
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character;
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
import it.polimi.ingsw.gc14.Model.Player;
/**
* Represents a Shaman character card.
*
* <p>A Shaman is a specific type of {@link Character} initialized with
* {@link CharacterType#SHAMAN}.
*/
public class Shaman extends Character {
/**
* The number of star {@code Icons} the card possesses.
* During the {@link it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events.ShamanicRitual Shamanic Ritual Event}, having the
* majority of these icons provides Prestige Points;
* having the minority, on the other hand, results in
* losing Prestige Points.
*/
private final int icon;
/**
* Returns the icon value of this Shaman card.
*
* @return the icon value of this Shaman card.
*/
public int getIcon() {
return icon;
}
/**
* Creates a Shaman character card with the specified era and icon value.
*
* @param Era the era of the Shaman card.
* @param icon the icon value of the Shaman card.
*/
public Shaman(int Era, int icon) {
super(Era, CharacterType.SHAMAN);
this.icon = icon;
}
/**
* Creates a Shaman character card with the specified era, icon value,
* and minimum number of players.
*
* @param Era the era of the Shaman card.
* @param icon the icon value of the Shaman card.
* @param nMin the minimum number of players required for the card.
*/
public Shaman(int Era, int icon, int nMin) {
super(Era, CharacterType.SHAMAN,nMin);
this.icon = icon;
}
/**
* Creates a Shaman character card with the specified image id, era and icon value.
*
* @param idIMG the image identifier of the Shaman card.
* @param Era the era of the Shaman card.
* @param icon the icon value of the Shaman card.
*/
public Shaman(String idIMG,int Era, int icon) {
super(idIMG,Era, CharacterType.SHAMAN);
this.icon = icon;
}
/**
* Creates a Shaman character card with the specified image id, era, icon value,
* and minimum number of players.
*
* @param idIMG the image identifier of the Shaman card.
* @param Era the era of the Shaman card.
* @param icon the icon value of the Shaman card.
* @param nMin the minimum number of players required for the card.
*/
public Shaman(String idIMG,int Era, int icon, int nMin) {
super(idIMG,Era, CharacterType.SHAMAN,nMin);
this.icon = icon;
}
@Override
public String toStringPlayer() {
return "\uD83C\uDF1F:" + icon;
}
@Override
public String toStringBoard() {
return "SHAMAN \uD83C\uDF1F:" + icon;
}
/**
* Creates and returns a copy of this Shaman card.
*
* @return a clone of this Shaman card.
*/
@Override
public Character clone() {
return new Shaman(getIdIMG(),getEra(), getIcon(), getNMin());
}
/**
* Inserts this Shaman card into the specified player's Shaman collection
* and applies any building effects triggered by character set completion.
*
* @param player the player who receives the card.
*/
@Override
public void insert(Player player)
{
player.getShamans().add(this);
player.getBuildingCards().stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player));
}
}