Class AIPlayer
- java.lang.Object
-
- ch.sahits.game.openpatrician.model.impl.Player
-
- ch.sahits.game.openpatrician.model.impl.AIPlayer
-
-
Field Summary
Fields Modifier and Type Field Description private IAICaptainHireStrategyType
captainHireStrategyType
private IAIConstructionSelectionStrategyType
constructionSelectionType
private IAIEventDecisionStrategyType
eventDecitionStrategyType
private static RandomNameLoader
firstNameLoader
private IProductionConsumptionKnowledge
knowledge
private static RandomNameLoader
lastNameLoader
private static org.slf4j.Logger
LOGGER
private AIPlayerContext
playerContext
private IAIShipRepairStrategyType
shipRepairStrategyType
private IAITakeLoanStrategyType
takeLoanStrategyType
private java.util.Map<INavigableVessel,ITradeMissionData>
tradeMissions
private com.google.common.collect.LinkedHashMultimap<INavigableVessel,ITradeStep>
tradeSteps
private java.util.Map<INavigableVessel,IAITradeStrategyType>
tradeStrategyType
private java.util.Map<INavigableVessel,java.lang.Boolean>
waitingStatus
Waiting status of the trade for a ship.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTradeStep(ITradeStep tradeStep, INavigableVessel vessel)
Add a new trade step at the end of the list.IAIGuildJoinStrategyType
getGuildJoinStrategyType()
Retrieve the strategy to join guilds.IAIHireSailorsStrategyType
getHireSailorStrategyType()
Retreive the strategy type for hiring the sailors.IAIHireTradeManagerStrategyType
getHireTradeManagerStrategyType()
Retrieve the strategy for hiring and dismissing trade managers.ITradeStep
getNextTradeStep(INavigableVessel vessel)
Retrieve the next trade step that should be executed and remove it from the list.private static PersonalData
getPersonalData(ICity homeTown, java.time.LocalDateTime birthDate)
IProductionConsumptionKnowledge
getProductionAndConsumptionKnowledge()
Retrieve the knowledge of production and consumption.private static java.lang.String
getRandomFirstName()
private static java.lang.String
getRandomLastName()
IAIShipUpgradeStrategyType
getShipUpgradeStrategyType()
Retrieve the strategy type for upgrading ships.ITradeMissionData
getTradeMission(INavigableVessel vessel)
Retrieve the trade mission of a given vessel.java.util.List<ITradeStep>
getTradeSteps(INavigableVessel vessel)
Retrieve a copy of the trade steps of the vessel.IAITradeStrategyType
getTradeStrategyType(INavigableVessel vessel)
Retreive the the type of trade strategy.IAIBuyWeaponStrategyType
getWeaponBuyStrategyType()
Retrieve the strategy type for buying weapons.boolean
hasMoreTradeSteps(INavigableVessel vessel)
Check if there are further trade steps.void
injectTradeStep(ITradeStep tradeStep, INavigableVessel vessel)
Inject a trade step at the beinning of the task list for the vesselboolean
isInitialized(INavigableVessel vessel)
Check if the trade strategy for the vessel is initialized.void
setTradeMission(INavigableVessel vessel, ITradeMissionData tradeMission)
Add trade mission data fo a vessel.void
setTradeStrategyType(INavigableVessel vessel, IAITradeStrategyType type)
Set the trade strategy type on the level of a vessel.void
updateTradeWaitingStatus(INavigableVessel vessel, boolean wait)
Update the waiting status upon the execution of a trade step.boolean
waitingForTradeStepToFinish(INavigableVessel vessel)
Check if the next trade step can be executed for the vessel, or if the last trade step requires waiting on an event.-
Methods inherited from class ch.sahits.game.openpatrician.model.impl.Player
addSelectableVessel, addShip, equals, findBuildings, findBuildings, findShips, findTradingOffice, getFleet, getHometown, getLastName, getName, getPersonalData, getSelectableVessels, getSpouseData, hashCode, marry, receiveSum, removeSelectableVessel, removeShip, spouseDies, toString, updateCrimialDrive, updateRank
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ch.sahits.game.openpatrician.model.IAIPlayer
getCaptainHireStrategyType, getConstructionSelectionType, getEventDecitionStrategyType, getPlayerContext, getShipRepairStrategyType, getTakeLoanStrategyType
-
Methods inherited from interface ch.sahits.game.openpatrician.model.ICitizen
getHometown, getLastName, getName, getRank
-
Methods inherited from interface ch.sahits.game.openpatrician.model.city.ICreditor
receiveSum
-
Methods inherited from interface ch.sahits.game.openpatrician.model.IPlayer
addSelectableVessel, addShip, findBuildings, findBuildings, findShips, findTradingOffice, getCareerLevel, getChildren, getCompany, getCriminalDrive, getFleet, getPersonalData, getSegmentedMap, getSelectableVessels, getSpouseData, getUuid, marry, removeSelectableVessel, removeShip, setCareerLevel, setSegmentedMap, spouseDies, updateCrimialDrive, updateRank
-
Methods inherited from interface ch.sahits.game.openpatrician.model.people.IShipOwner
getLastName, getName
-
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
tradeSteps
private com.google.common.collect.LinkedHashMultimap<INavigableVessel,ITradeStep> tradeSteps
-
tradeMissions
private java.util.Map<INavigableVessel,ITradeMissionData> tradeMissions
-
waitingStatus
private java.util.Map<INavigableVessel,java.lang.Boolean> waitingStatus
Waiting status of the trade for a ship. This is relevant for loading a game where certain ships are waiting for a trade step to finish (e.g. traveling or repairing).
-
tradeStrategyType
private java.util.Map<INavigableVessel,IAITradeStrategyType> tradeStrategyType
-
shipRepairStrategyType
private IAIShipRepairStrategyType shipRepairStrategyType
-
constructionSelectionType
private IAIConstructionSelectionStrategyType constructionSelectionType
-
captainHireStrategyType
private IAICaptainHireStrategyType captainHireStrategyType
-
takeLoanStrategyType
private IAITakeLoanStrategyType takeLoanStrategyType
-
eventDecitionStrategyType
private IAIEventDecisionStrategyType eventDecitionStrategyType
-
knowledge
@Autowired private IProductionConsumptionKnowledge knowledge
-
playerContext
private AIPlayerContext playerContext
-
firstNameLoader
private static RandomNameLoader firstNameLoader
-
lastNameLoader
private static RandomNameLoader lastNameLoader
-
-
Method Detail
-
getPersonalData
private static PersonalData getPersonalData(ICity homeTown, java.time.LocalDateTime birthDate)
-
getRandomFirstName
private static java.lang.String getRandomFirstName()
-
getRandomLastName
private static java.lang.String getRandomLastName()
-
getProductionAndConsumptionKnowledge
public IProductionConsumptionKnowledge getProductionAndConsumptionKnowledge()
Description copied from interface:IAIPlayer
Retrieve the knowledge of production and consumption.- Specified by:
getProductionAndConsumptionKnowledge
in interfaceIAIPlayer
- Returns:
- global knowledge of production and consumption.
-
getNextTradeStep
public ITradeStep getNextTradeStep(INavigableVessel vessel)
Description copied from interface:IAIPlayer
Retrieve the next trade step that should be executed and remove it from the list.- Specified by:
getNextTradeStep
in interfaceIAIPlayer
- Parameters:
vessel
- for which the next trade step should be checked.- Returns:
- next trade step for the vessel
-
hasMoreTradeSteps
public boolean hasMoreTradeSteps(INavigableVessel vessel)
Description copied from interface:IAIPlayer
Check if there are further trade steps.- Specified by:
hasMoreTradeSteps
in interfaceIAIPlayer
- Parameters:
vessel
- which should be checked.- Returns:
- true if there are more trade steps defined for vessel
-
addTradeStep
public void addTradeStep(ITradeStep tradeStep, INavigableVessel vessel)
Description copied from interface:IAIPlayer
Add a new trade step at the end of the list.- Specified by:
addTradeStep
in interfaceIAIPlayer
- Parameters:
tradeStep
- to be added.vessel
- for which the step should be added.
-
injectTradeStep
public void injectTradeStep(ITradeStep tradeStep, INavigableVessel vessel)
Description copied from interface:IAIPlayer
Inject a trade step at the beinning of the task list for the vessel- Specified by:
injectTradeStep
in interfaceIAIPlayer
- Parameters:
tradeStep
- to be added.vessel
- for which the step should be added.
-
getTradeMission
public ITradeMissionData getTradeMission(INavigableVessel vessel)
Description copied from interface:IAIPlayer
Retrieve the trade mission of a given vessel.- Specified by:
getTradeMission
in interfaceIAIPlayer
- Parameters:
vessel
- for which to get the mission data- Returns:
- trade mission for a specific vessel
-
setTradeMission
public void setTradeMission(INavigableVessel vessel, ITradeMissionData tradeMission)
Description copied from interface:IAIPlayer
Add trade mission data fo a vessel. If the data is null an existing entry will be removed.- Specified by:
setTradeMission
in interfaceIAIPlayer
- Parameters:
vessel
- for which to set the trade mission datatradeMission
- trade mission meta data
-
waitingForTradeStepToFinish
public boolean waitingForTradeStepToFinish(INavigableVessel vessel)
Description copied from interface:IAIPlayer
Check if the next trade step can be executed for the vessel, or if the last trade step requires waiting on an event.- Specified by:
waitingForTradeStepToFinish
in interfaceIAIPlayer
- Parameters:
vessel
- for which the status should be checked.- Returns:
- true if the next trade step is initiated upon an event.
-
updateTradeWaitingStatus
public void updateTradeWaitingStatus(INavigableVessel vessel, boolean wait)
Description copied from interface:IAIPlayer
Update the waiting status upon the execution of a trade step.- Specified by:
updateTradeWaitingStatus
in interfaceIAIPlayer
- Parameters:
vessel
- for which the status should be updated.wait
- inicate if the next trade step should wait.
-
isInitialized
public boolean isInitialized(INavigableVessel vessel)
Description copied from interface:IAIPlayer
Check if the trade strategy for the vessel is initialized.- Specified by:
isInitialized
in interfaceIAIPlayer
- Parameters:
vessel
- to be checked- Returns:
- true if the trade steps for the vessel are initialized.
-
setTradeStrategyType
public void setTradeStrategyType(INavigableVessel vessel, IAITradeStrategyType type)
Set the trade strategy type on the level of a vessel.- Specified by:
setTradeStrategyType
in interfaceIAIPlayer
- Parameters:
vessel
- for which to set the strategy typetype
- trade strategy type
-
getTradeStrategyType
public IAITradeStrategyType getTradeStrategyType(INavigableVessel vessel)
Description copied from interface:IAIPlayer
Retreive the the type of trade strategy.- Specified by:
getTradeStrategyType
in interfaceIAIPlayer
- Parameters:
vessel
- for which to retrieve the trade strategy type- Returns:
- trade strategy type for the vessel
-
getHireTradeManagerStrategyType
public IAIHireTradeManagerStrategyType getHireTradeManagerStrategyType()
Description copied from interface:IAIPlayer
Retrieve the strategy for hiring and dismissing trade managers.- Specified by:
getHireTradeManagerStrategyType
in interfaceIAIPlayer
- Returns:
- strategy type to hire trade managers
-
getGuildJoinStrategyType
public IAIGuildJoinStrategyType getGuildJoinStrategyType()
Description copied from interface:IAIPlayer
Retrieve the strategy to join guilds.- Specified by:
getGuildJoinStrategyType
in interfaceIAIPlayer
- Returns:
- strategy type to join guilds
-
getWeaponBuyStrategyType
public IAIBuyWeaponStrategyType getWeaponBuyStrategyType()
Description copied from interface:IAIPlayer
Retrieve the strategy type for buying weapons.- Specified by:
getWeaponBuyStrategyType
in interfaceIAIPlayer
- Returns:
- strategy types to decide to buy weapons
-
getHireSailorStrategyType
public IAIHireSailorsStrategyType getHireSailorStrategyType()
Description copied from interface:IAIPlayer
Retreive the strategy type for hiring the sailors.- Specified by:
getHireSailorStrategyType
in interfaceIAIPlayer
- Returns:
- strategy type to hire sailors
-
getShipUpgradeStrategyType
public IAIShipUpgradeStrategyType getShipUpgradeStrategyType()
Description copied from interface:IAIPlayer
Retrieve the strategy type for upgrading ships.- Specified by:
getShipUpgradeStrategyType
in interfaceIAIPlayer
- Returns:
- strategy type for ship upgrading
-
getTradeSteps
public java.util.List<ITradeStep> getTradeSteps(INavigableVessel vessel)
Description copied from interface:IAIPlayer
Retrieve a copy of the trade steps of the vessel.- Specified by:
getTradeSteps
in interfaceIAIPlayer
- Parameters:
vessel
- for which the next trade step should be checked.- Returns:
- all trade steps for that vessel
-
-