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
-
Field Summary
FieldsFields inherited from class it.polimi.ingsw.server.model.game_logic.Archipelago
islandCodes, studentToNumber, towerColor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intgetStudentsInfluence(Set<Color> playerProfessors) This method returns the influence on the archipelago given by the students that are on itprotected intgetTowersInfluence(TowerColor playerTowerColor) This method returns the influence given by the towers of the inputted tower color on the archipelagobooleanisLocked()This method returns true if the archipelago's locks are set to true, false otherwiselightify()This method returns the light version of the archipelago to be sent over the networkvoidlock()This method sets the lock of the archipelago to truebooleanmerge(Archipelago a2) This method merges two archipelagosvoidsetColorThatDoesntCount(Color color) This method sets the color that won't count for the influencevoidsetTowerColor(TowerColor towerColor) Sets the towerColor of this archipelagovoidsetTowersInfluence(boolean doTowersCount) This method sets if the towers will count for the influencevoidunlock()This method sets the lock of the archipelago to falseMethods inherited from class it.polimi.ingsw.server.model.game_logic.Archipelago
addStudent, equals, getInfluence, getIslandCodes, getStudents, getStudentToNumber, getTowerColor, removeStudent
-
Field Details
-
lock
private boolean lock -
doTowersCount
private boolean doTowersCount -
colorThatDoesntCount
-
-
Constructor Details
-
ExpertArchipelago
public ExpertArchipelago(int code)
-
-
Method Details
-
lock
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
Sets the towerColor of this archipelago- Overrides:
setTowerColorin classArchipelago- 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
This method sets the color that won't count for the influence- Parameters:
color- is the color that won't count
-
getTowersInfluence
This method returns the influence given by the towers of the inputted tower color on the archipelago- Overrides:
getTowersInfluencein classArchipelago- Parameters:
playerTowerColor- is the tower color- Returns:
- the influence given by the towers of a certain color on the archipelago
-
getStudentsInfluence
This method returns the influence on the archipelago given by the students that are on it- Overrides:
getStudentsInfluencein classArchipelago- Parameters:
playerProfessors- is a Set representing the professors owned by a certain player- Returns:
- the influence on the archipelago given by the students
-
merge
This method merges two archipelagos- Overrides:
mergein classArchipelago- 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
This method returns the light version of the archipelago to be sent over the network- Overrides:
lightifyin classArchipelago- Returns:
- a LightArchipelago comprising all the relevant information that make up the archipelago
-