Class CaptainState
- java.lang.Object
-
- ch.sahits.game.openpatrician.model.people.impl.CaptainState
-
-
Constructor Summary
Constructors Constructor Description CaptainState()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassignToShip(IShip ship)Assign a captain to a ship.intgetAge()Current age of the captainjava.util.Optional<IShip>getAssignedShip()Get the ship the captain is assigned to.intgetFightSkillLevel()Retrieve the level in sea fights between [0,5]java.lang.StringgetName()Retrieve the name of the captainintgetNavigationSkillLevel()Retrieve the level in navigation between [0,5]intgetSalary()Retrieve the salary per day.intgetTradingSkillLevel()Retrieve the level in trading between [0,5]voidsetSalary(int salary)Set the new salaryvoidupdatedSailedDistance(int distance)Add the sailed distance to the totalvoidupdateFightWon()Increase the number of won fights.voidupdateProfit(int profit)Add the profit the total profit.booleanupgradeToNextFightingLevel()If possible upgrade the captain fight skill to the next level.booleanupgradeToNextNavigationLevel()If possible upgrade the captain to the next level on navigation skill.booleanupgradeToNextTradeLevel()Increase the experiance level by one.
-
-
-
Method Detail
-
getAge
public int getAge()
Description copied from interface:ICaptainCurrent age of the captain
-
getName
public java.lang.String getName()
Description copied from interface:ICaptainRetrieve the name of the captain
-
getSalary
public int getSalary()
Description copied from interface:ICaptainRetrieve the salary per day.
-
getTradingSkillLevel
public int getTradingSkillLevel()
Description copied from interface:ICaptainRetrieve the level in trading between [0,5]- Specified by:
getTradingSkillLevelin interfaceICaptain- Returns:
- trading skill of the captain.
-
getNavigationSkillLevel
public int getNavigationSkillLevel()
Description copied from interface:ICaptainRetrieve the level in navigation between [0,5]- Specified by:
getNavigationSkillLevelin interfaceICaptain- Returns:
- navigation skill of the captain
-
getFightSkillLevel
public int getFightSkillLevel()
Description copied from interface:ICaptainRetrieve the level in sea fights between [0,5]- Specified by:
getFightSkillLevelin interfaceICaptain- Returns:
- fighting skill of the captain.
-
setSalary
public void setSalary(int salary)
Set the new salary- Parameters:
salary- salary of the captain.
-
assignToShip
public void assignToShip(IShip ship)
Description copied from interface:ICaptainAssign a captain to a ship.- Specified by:
assignToShipin interfaceICaptain- Parameters:
ship- to which the captain is assigned.
-
getAssignedShip
public java.util.Optional<IShip> getAssignedShip()
Get the ship the captain is assigned to.- Specified by:
getAssignedShipin interfaceICaptain- Returns:
- absent if the captain is not assigned to any ship.
-
upgradeToNextTradeLevel
public boolean upgradeToNextTradeLevel()
Description copied from interface:ICaptainIncrease the experiance level by one. The highest level i 5.- Specified by:
upgradeToNextTradeLevelin interfaceICaptain- Returns:
- true if upgrade happened.
-
updateProfit
public void updateProfit(int profit)
Description copied from interface:ICaptainAdd the profit the total profit.- Specified by:
updateProfitin interfaceICaptain- Parameters:
profit- additional profit
-
updatedSailedDistance
public void updatedSailedDistance(int distance)
Description copied from interface:ICaptainAdd the sailed distance to the total- Specified by:
updatedSailedDistancein interfaceICaptain- Parameters:
distance- additional distance
-
upgradeToNextNavigationLevel
public boolean upgradeToNextNavigationLevel()
Description copied from interface:ICaptainIf possible upgrade the captain to the next level on navigation skill.- Specified by:
upgradeToNextNavigationLevelin interfaceICaptain- Returns:
- true if upgrade happened
-
updateFightWon
public void updateFightWon()
Description copied from interface:ICaptainIncrease the number of won fights.- Specified by:
updateFightWonin interfaceICaptain
-
upgradeToNextFightingLevel
public boolean upgradeToNextFightingLevel()
Description copied from interface:ICaptainIf possible upgrade the captain fight skill to the next level.- Specified by:
upgradeToNextFightingLevelin interfaceICaptain- Returns:
- true if an upgrade happened
-
-