Class ExpertArchipelago

java.lang.Object
it.polimi.ingsw.server.model.game_logic.Archipelago
it.polimi.ingsw.server.model.game_logic.ExpertArchipelago
All Implemented Interfaces:
ArchipelagoCommonInterface

public class ExpertArchipelago extends Archipelago
  • Field Details

    • lock

      private boolean lock
    • doTowersCount

      private boolean doTowersCount
    • colorThatDoesntCount

      private Color colorThatDoesntCount
  • Constructor Details

    • ExpertArchipelago

      public ExpertArchipelago(int code)
  • Method Details

    • lock

      public void lock() throws ArchipelagoAlreadyLockedException
      This method sets the lock of the archipelago to true
      Throws:
      ArchipelagoAlreadyLockedException - if the method is called while the lock is already set to true
    • unlock

      public void unlock()
      This method sets the lock of the archipelago to false
    • isLocked

      public boolean isLocked()
      This method returns true if the archipelago's locks are set to true, false otherwise
      Returns:
      the state of the lock of the archipelago
    • setTowerColor

      public void setTowerColor(TowerColor towerColor)
      Sets the towerColor of this archipelago
      Overrides:
      setTowerColor in class Archipelago
      Parameters:
      towerColor - towercolor
      Throws:
      IllegalArgumentException - if(towerColor == null)
    • setTowersInfluence

      public void setTowersInfluence(boolean doTowersCount)
      This method sets if the towers will count for the influence
      Parameters:
      doTowersCount - true if the towers have to count, false otherwise
    • setColorThatDoesntCount

      public void setColorThatDoesntCount(Color color)
      This method sets the color that won't count for the influence
      Parameters:
      color - is the color that won't count
    • getTowersInfluence

      protected int getTowersInfluence(TowerColor playerTowerColor)
      This method returns the influence given by the towers of the inputted tower color on the archipelago
      Overrides:
      getTowersInfluence in class Archipelago
      Parameters:
      playerTowerColor - is the tower color
      Returns:
      the influence given by the towers of a certain color on the archipelago
    • getStudentsInfluence

      protected int getStudentsInfluence(Set<Color> playerProfessors)
      This method returns the influence on the archipelago given by the students that are on it
      Overrides:
      getStudentsInfluence in class Archipelago
      Parameters:
      playerProfessors - is a Set representing the professors owned by a certain player
      Returns:
      the influence on the archipelago given by the students
    • merge

      public boolean merge(Archipelago a2)
      This method merges two archipelagos
      Overrides:
      merge in class Archipelago
      Parameters:
      a2 - second archipelago to be merged. If one of the two archipelagos is locked, the lock will affect the merged archipelago
      Returns:
      an Archipelago that has first islandCodes + second islandCodes and the sum of the students of the two archipelagos
    • lightify

      public LightArchipelago lightify()
      This method returns the light version of the archipelago to be sent over the network
      Overrides:
      lightify in class Archipelago
      Returns:
      a LightArchipelago comprising all the relevant information that make up the archipelago