Class PirateEngine


  • @Lazy
    @Service
    @DependentInitialisation(ch.sahits.game.openpatrician.model.initialisation.StartNewGameBean.class)
    public class PirateEngine
    extends AbstractEngine
    Engine governing all pirates.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2013 Created on Jan 29, 2013
    • Constructor Summary

      Constructors 
      Constructor Description
      PirateEngine()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<AbstractEngine> getChildren()
      Any engine may hold various child engines.
      void handleNewPirate​(ch.sahits.game.openpatrician.model.event.NewPirateEvent pirateEvent)
      Handle the even when a new pirate becomes available.
      void handleRepairFinished​(ch.sahits.game.openpatrician.event.data.RepairFinishedEvent event)
      Handle the event for the finished repair.
      void handleRepairPirateShip​(ch.sahits.game.openpatrician.event.data.ShipEntersPortEvent event)
      When a pirate ship enters a port it does so for repair.
      void handleShipPositionUpdate​(ch.sahits.game.openpatrician.event.data.ShipPositionUpdateEvent event)
      Check if there is a ship near the new position and decide if an attack should be initiated.
      void handleShipReachesDestination​(ch.sahits.game.openpatrician.event.data.ShipArrivesAtDestinationEvent event)
      Ship has reached it's destination, select a new one.
      void handleWeeklyUpdate​(ch.sahits.game.event.data.PeriodicalTimeWeekEndUpdate event)
      Periodically check if there is a free pirate and if not, create one.
      void initializedGraph​(ch.sahits.game.openpatrician.event.data.GraphInitialisationComplete event)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PirateEngine

        public PirateEngine()
    • Method Detail

      • getChildren

        public java.util.List<AbstractEngine> getChildren()
        Description copied from class: AbstractEngine
        Any 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:
        getChildren in class AbstractEngine
        Returns:
        list of child engines.
      • initializedGraph

        public void initializedGraph​(ch.sahits.game.openpatrician.event.data.GraphInitialisationComplete event)
      • handleNewPirate

        public void handleNewPirate​(ch.sahits.game.openpatrician.model.event.NewPirateEvent pirateEvent)
        Handle the even when a new pirate becomes available.
        Parameters:
        pirateEvent - new pirate emerged
      • handleShipReachesDestination

        public void handleShipReachesDestination​(ch.sahits.game.openpatrician.event.data.ShipArrivesAtDestinationEvent event)
        Ship has reached it's destination, select a new one.
        Parameters:
        event - ship arrives at destination
      • handleShipPositionUpdate

        public void handleShipPositionUpdate​(ch.sahits.game.openpatrician.event.data.ShipPositionUpdateEvent event)
        Check if there is a ship near the new position and decide if an attack should be initiated.
        Parameters:
        event - ship changes position
      • handleRepairPirateShip

        public void handleRepairPirateShip​(ch.sahits.game.openpatrician.event.data.ShipEntersPortEvent event)
        When a pirate ship enters a port it does so for repair.
      • handleRepairFinished

        public void handleRepairFinished​(ch.sahits.game.openpatrician.event.data.RepairFinishedEvent event)
        Handle the event for the finished repair.
        Parameters:
        event - repair has finished
      • handleWeeklyUpdate

        public void handleWeeklyUpdate​(ch.sahits.game.event.data.PeriodicalTimeWeekEndUpdate event)
        Periodically check if there is a free pirate and if not, create one.
        Parameters:
        event - weekly update