Class AIPlayerEngine
- java.lang.Object
-
- ch.sahits.game.openpatrician.engine.AbstractEngine
-
- ch.sahits.game.openpatrician.engine.AIPlayerEngine
-
- All Implemented Interfaces:
IAIEventHandler
public class AIPlayerEngine extends AbstractEngine implements IAIEventHandler
This implements the engine for an AI Player- Author:
- Andi Hotz, (c) Sahits GmbH, 2014 Created on Jan 23, 2014
-
-
Constructor Summary
Constructors Constructor Description AIPlayerEngine()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanexecuteCurrentTrade(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel)Check weather the current vessel is engaged in executing trade steps.java.util.List<AbstractEngine>getChildren()Any engine may hold various child engines.voidhandelLoadedNewGame(ch.sahits.game.openpatrician.event.GameStateChange event)Initialize the visible ships.voidhandleBlockadeStart(ch.sahits.game.openpatrician.event.data.ai.BlockadeShipRequestEvent event)voidhandleBuildingAuctionFinished(ch.sahits.game.openpatrician.event.data.BuildingAuctionFinished event)voidhandleBuildingNotAuction(ch.sahits.game.openpatrician.event.data.BuildingNotAuctioned event)voidhandleConvoyDissolve(ch.sahits.game.openpatrician.clientserverinterface.model.event.ConvoyDisolveEvent event)voidhandleDonationRequest(ch.sahits.game.openpatrician.model.IAIPlayer player, ch.sahits.game.openpatrician.clientserverinterface.model.event.DonationRequestState state)Handle a donation request.voidhandleGameLoad(ch.sahits.game.openpatrician.event.GameStateChange gameStateChange)Listen to the start of the game loading to continue with the handling of ship arrival events.voidhandleMarriageEvent(ch.sahits.game.openpatrician.model.IAIPlayer player, ch.sahits.game.openpatrician.clientserverinterface.model.event.MarriageBrokerAnnouncementState state)Handle the offer of a marriage broker.voidhandleMarriageWareDelivery(ch.sahits.game.openpatrician.model.IAIPlayer player, ch.sahits.game.openpatrician.clientserverinterface.model.event.MarriageFeastRequestState state)Handle the request to deliver marriage wares.voidhandleShipArrivesInCity(ch.sahits.game.openpatrician.event.data.ShipEntersPortEvent event)voidhandleShipAuctionFinished(ch.sahits.game.openpatrician.event.data.ShipAuctionFinished event)voidhandleShipConstructionFinished(ch.sahits.game.openpatrician.model.ship.IShip ship, ch.sahits.game.openpatrician.model.IAIPlayer player)Method to handle the finishing of a ship construction.voidhandleShipFittedForOrleg(ch.sahits.game.openpatrician.clientserverinterface.model.event.OrlegShipOutfittedEvent event)When a ship has finally been fitted for orlead duties, create the convoy.voidhandleShipNotAuction(ch.sahits.game.openpatrician.event.data.ShipNotAuctioned event)voidhandleSpecialMissionFinished(ch.sahits.game.openpatrician.event.data.ai.SpecialMissionFinishedEvent event)Handle the reinitialisation after finishing a special mission.voidhandleTradeStrategyStart(ch.sahits.game.openpatrician.event.data.GraphInitialisationComplete event)voidhandleWeeklyTasks(ch.sahits.game.event.data.PeriodicalTimeWeekEndUpdate event)voidinitializeNewShip(ch.sahits.game.openpatrician.model.ship.IShip ship, ch.sahits.game.openpatrician.model.IAIPlayer player)Method to handle the initializing of a trade strategy for a new ship.
-
-
-
Method Detail
-
getChildren
public java.util.List<AbstractEngine> getChildren()
Description copied from class:AbstractEngineAny engine may hold various child engines. This is the way to retrieve them. If there are no child engines, return an empty list. Subclasses have to implement this in the proper way.- Specified by:
getChildrenin classAbstractEngine- Returns:
- list of child engines.
-
handleBlockadeStart
public void handleBlockadeStart(ch.sahits.game.openpatrician.event.data.ai.BlockadeShipRequestEvent event)
-
handleShipArrivesInCity
public void handleShipArrivesInCity(ch.sahits.game.openpatrician.event.data.ShipEntersPortEvent event)
-
handleGameLoad
public void handleGameLoad(ch.sahits.game.openpatrician.event.GameStateChange gameStateChange)
Listen to the start of the game loading to continue with the handling of ship arrival events.- Parameters:
gameStateChange- event for game state change
-
handleTradeStrategyStart
public void handleTradeStrategyStart(ch.sahits.game.openpatrician.event.data.GraphInitialisationComplete event)
-
executeCurrentTrade
public boolean executeCurrentTrade(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel)
Check weather the current vessel is engaged in executing trade steps.- Parameters:
vessel- for which to check if it is active- Returns:
- true if the vessel is active for trading
-
handleWeeklyTasks
public void handleWeeklyTasks(ch.sahits.game.event.data.PeriodicalTimeWeekEndUpdate event)
-
handleSpecialMissionFinished
public void handleSpecialMissionFinished(ch.sahits.game.openpatrician.event.data.ai.SpecialMissionFinishedEvent event)
Handle the reinitialisation after finishing a special mission.- Parameters:
event- special mission is finished
-
handleShipAuctionFinished
public void handleShipAuctionFinished(ch.sahits.game.openpatrician.event.data.ShipAuctionFinished event)
-
handleShipNotAuction
public void handleShipNotAuction(ch.sahits.game.openpatrician.event.data.ShipNotAuctioned event)
-
handleBuildingAuctionFinished
public void handleBuildingAuctionFinished(ch.sahits.game.openpatrician.event.data.BuildingAuctionFinished event)
-
handleBuildingNotAuction
public void handleBuildingNotAuction(ch.sahits.game.openpatrician.event.data.BuildingNotAuctioned event)
-
handleMarriageEvent
public void handleMarriageEvent(ch.sahits.game.openpatrician.model.IAIPlayer player, ch.sahits.game.openpatrician.clientserverinterface.model.event.MarriageBrokerAnnouncementState state)Description copied from interface:IAIEventHandlerHandle the offer of a marriage broker.- Specified by:
handleMarriageEventin interfaceIAIEventHandlerstate- of the marriage broker
-
handleMarriageWareDelivery
public void handleMarriageWareDelivery(ch.sahits.game.openpatrician.model.IAIPlayer player, ch.sahits.game.openpatrician.clientserverinterface.model.event.MarriageFeastRequestState state)Description copied from interface:IAIEventHandlerHandle the request to deliver marriage wares.- Specified by:
handleMarriageWareDeliveryin interfaceIAIEventHandler- Parameters:
player- that is requested to deliver the waresstate- request details
-
handleDonationRequest
public void handleDonationRequest(ch.sahits.game.openpatrician.model.IAIPlayer player, ch.sahits.game.openpatrician.clientserverinterface.model.event.DonationRequestState state)Description copied from interface:IAIEventHandlerHandle a donation request.- Specified by:
handleDonationRequestin interfaceIAIEventHandler- Parameters:
player- that is requested to deliver the waresstate- request details
-
handleShipConstructionFinished
public void handleShipConstructionFinished(ch.sahits.game.openpatrician.model.ship.IShip ship, ch.sahits.game.openpatrician.model.IAIPlayer player)Method to handle the finishing of a ship construction.- Parameters:
ship- that is newly constructedplayer- owner of the ship
-
initializeNewShip
public void initializeNewShip(ch.sahits.game.openpatrician.model.ship.IShip ship, ch.sahits.game.openpatrician.model.IAIPlayer player)Method to handle the initializing of a trade strategy for a new ship.- Specified by:
initializeNewShipin interfaceIAIEventHandler- Parameters:
ship- to be initializedplayer- owner of the ship
-
handelLoadedNewGame
public void handelLoadedNewGame(ch.sahits.game.openpatrician.event.GameStateChange event)
Initialize the visible ships.- Parameters:
event- game state change event
-
handleConvoyDissolve
public void handleConvoyDissolve(ch.sahits.game.openpatrician.clientserverinterface.model.event.ConvoyDisolveEvent event)
-
handleShipFittedForOrleg
public void handleShipFittedForOrleg(ch.sahits.game.openpatrician.clientserverinterface.model.event.OrlegShipOutfittedEvent event)
When a ship has finally been fitted for orlead duties, create the convoy.- Parameters:
event-
-
-