Package it.polimi.ingsw.model.leadercard
Class LeaderCard
java.lang.Object
it.polimi.ingsw.model.leadercard.LeaderCard
public class LeaderCard
extends java.lang.Object
Represents a leader card
-
Constructor Summary
Constructors Constructor Description LeaderCard(int ID, ResourceType requiredResources, java.util.Map<CardFlag,java.lang.Integer> requiredCardFlags, int victoryPoints, CardBehaviour cardBehaviour)class constructorLeaderCard(ResourceType requiredResources, java.util.Map<CardFlag,java.lang.Integer> requiredCardFlags, int victoryPoints, CardBehaviour cardBehaviour) -
Method Summary
Modifier and Type Method Description voidaddStorageSpace(InterfacePlayerBoard playerBoard)activates the additional storage space ability does nothing if the card is not active or doesn't have this abilityvoidapplyDiscount(java.util.HashMap<ResourceType,java.lang.Integer> mapToDiscount)applies discount to the map passed as a parameter the method modifies the map passed as a parameter in order to apply the discount does nothing if the card is not active or doesn't have this abilityjava.lang.StringgetImage()intgetLeaderId()ResourceTypegetProductionRequirement()java.util.Map<CardFlag,java.lang.Integer>getRequiredCardFlags()ResourceTypegetRequiredResources()ResourceTypegetResToDiscount()ResourceTypegetResToStore()intgetVictoryPoints()get the number of victory pointsResourceTypegetWhite()booleanisActive()returns true if this is an active card in the player's playerboardvoidleaderProduce(ResourceType resourceToAdd, InterfacePlayerBoard playerBoard)activates the production ability does nothing if the card is not active or doesn't have this abilityResourceTyperesourceOnWhite()the ResourceType in which to convert the white marble that comes from a marketvoidsetActive(InterfacePlayerBoard playerBoard)if it's allowed sets the LeaderCard state to activeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
LeaderCard
public LeaderCard(int ID, ResourceType requiredResources, java.util.Map<CardFlag,java.lang.Integer> requiredCardFlags, int victoryPoints, CardBehaviour cardBehaviour)class constructor- Parameters:
requiredResources- resource type required to buy the card. Can benullrequiredCardFlags- DevelopCard's cardFlags required to buy the card. Can benullvictoryPoints- card's pointscardBehaviour- object containing the card's behaviour (abilities)
-
LeaderCard
public LeaderCard(ResourceType requiredResources, java.util.Map<CardFlag,java.lang.Integer> requiredCardFlags, int victoryPoints, CardBehaviour cardBehaviour)
-
-
Method Details
-
setActive
public void setActive(InterfacePlayerBoard playerBoard) throws NotEnoughResourcesException, InvalidLeaderCardExceptionif it's allowed sets the LeaderCard state to active- Parameters:
playerBoard- the player that wants to activate the card- Throws:
NotEnoughResourcesException- if the player doesn't have the resources (CardFlags or ResourceType) to activate the cardInvalidLeaderCardException- if the player doesn't own this card
-
isActive
public boolean isActive()returns true if this is an active card in the player's playerboard- Returns:
- true if this card is active
-
getLeaderId
public int getLeaderId() -
getImage
public java.lang.String getImage() -
getVictoryPoints
public int getVictoryPoints()get the number of victory points- Returns:
- the number of this card's victory points
-
applyDiscount
applies discount to the map passed as a parameter the method modifies the map passed as a parameter in order to apply the discount does nothing if the card is not active or doesn't have this ability -
resourceOnWhite
the ResourceType in which to convert the white marble that comes from a market- Returns:
- the ResourceType in which to convert the white marble or
nullif the card is not active or doesn't have this ability
-
leaderProduce
public void leaderProduce(ResourceType resourceToAdd, InterfacePlayerBoard playerBoard) throws AbuseOfFaithException, NotEnoughResourcesException, NeedAResourceToAddExceptionactivates the production ability does nothing if the card is not active or doesn't have this ability- Parameters:
resourceToAdd- the resource that will be produced (FAITH not allowed)playerBoard- that wants to activate this ability (needed to add and remove resources directly from his storages)- Throws:
AbuseOfFaithException- if you passResourceType.FAITHas the resource you want to addNotEnoughResourcesException- if the player doesn't have the resources to activate the productionNeedAResourceToAddException
-
addStorageSpace
activates the additional storage space ability does nothing if the card is not active or doesn't have this ability- Parameters:
playerBoard- that wants to activate a Storage type LeaderCard- Throws:
MaxLeaderCardLevelsException- if the maximum number of additional storages is surpassed
-
getResToDiscount
-
getProductionRequirement
-
getWhite
-
getResToStore
-
getRequiredResources
-
getRequiredCardFlags
-