Class CommonInfluence

java.lang.Object
it.polimi.ingsw.eriantys.model.influence.CommonInfluence
All Implemented Interfaces:
InfluenceCalculator
Direct Known Subclasses:
BonusInfluence, ExcludeColorInfluence, NoTowersInfluence

public class CommonInfluence extends Object implements InfluenceCalculator
This concrete implementation for the state design pattern involving InfluenceCalculator defines the influence calculation when it is not affected by any CharacterCard.
  • 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 a Player on a certain island.
      Specified by:
      calculate in interface InfluenceCalculator
      Parameters:
      player - the main target of the calculation
      island - the game location used for the calculation
      ownedProfessors - the Color(s) of the professors which the Player owns
      Returns:
      the influence value for the given Player on the specified island
      Throws:
      InvalidArgumentException - if one or more parameters are illegal
    • evaluateColor

      protected int evaluateColor(StudentContainer island, Color c)
      The method evaluates the quantity of students of a Color on an island.
      Parameters:
      island - the game location used for the calculation
      c - the desired target Color
      Returns:
      the number of students of the given Color on the specified island
    • evaluateTowers

      protected int evaluateTowers(IslandGroup island, Player player)
      The method evaluates the contribution of the towers on an island.
      Parameters:
      island - the game location used for the calculation
      player - the target Player
      Returns:
      the contribution of the towers on the specified island if the passed Player parameter is equal to the controller of the island