Class CommonInfluence
java.lang.Object
it.polimi.ingsw.eriantys.model.influence.CommonInfluence
- All Implemented Interfaces:
InfluenceCalculator
- Direct Known Subclasses:
BonusInfluence
,ExcludeColorInfluence
,NoTowersInfluence
This concrete implementation for the state design pattern involving
InfluenceCalculator
defines the influence calculation when it is not affected by any CharacterCard
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
calculate
(Player player, IslandGroup island, Set<Color> ownedProfessors) The method evaluates the influence of aPlayer
on a certain island.protected int
evaluateColor
(StudentContainer island, Color c) The method evaluates the quantity of students of aColor
on an island.protected int
evaluateTowers
(IslandGroup island, Player player) The method evaluates the contribution of the towers on an island.
-
Constructor Details
-
CommonInfluence
public CommonInfluence()
-
-
Method Details
-
calculate
public int calculate(Player player, IslandGroup island, Set<Color> ownedProfessors) throws InvalidArgumentException Description copied from interface:InfluenceCalculator
The method evaluates the influence of aPlayer
on a certain island.- Specified by:
calculate
in interfaceInfluenceCalculator
- Parameters:
player
- the main target of the calculationisland
- the game location used for the calculationownedProfessors
- theColor
(s) of the professors which thePlayer
owns- Returns:
- the influence value for the given
Player
on the specified island - Throws:
InvalidArgumentException
- if one or more parameters are illegal
-
evaluateColor
The method evaluates the quantity of students of aColor
on an island. -
evaluateTowers
The method evaluates the contribution of the towers on an island.
-