Class FormOrJoinConvoyStrategy


  • public class FormOrJoinConvoyStrategy
    extends java.lang.Object
    Trade step to decide if a vessel should form a convoy, join a convoy and doing so.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2018 Created on Sep 18, 2018
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Optional<ch.sahits.game.openpatrician.model.ship.IConvoy> joinOrFormConvoy​(ch.sahits.game.openpatrician.model.ship.IShip vessel, ch.sahits.game.openpatrician.model.city.ICity city)
      Determine if the vessel should form a convoy or join a convoy own or forign and do so.
      boolean mustBeFittableForOrleg​(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel)
      check if the vessel needs to be fitted to become an orleg ship.
      boolean shouldJoinOrFormConvoy​(ch.sahits.game.openpatrician.model.IAIPlayer player)
      Check if there is a need for a ship of the player to join a convoy or form one.
      • Methods inherited from class java.lang.Object

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

      • FormOrJoinConvoyStrategy

        public FormOrJoinConvoyStrategy()
    • Method Detail

      • mustBeFittableForOrleg

        public boolean mustBeFittableForOrleg​(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel)
        check if the vessel needs to be fitted to become an orleg ship.
        Parameters:
        vessel - to be checked
        Returns:
        true if the ship needs to be fitted as orleg ship.
      • joinOrFormConvoy

        public java.util.Optional<ch.sahits.game.openpatrician.model.ship.IConvoy> joinOrFormConvoy​(ch.sahits.game.openpatrician.model.ship.IShip vessel,
                                                                                                    ch.sahits.game.openpatrician.model.city.ICity city)
        Determine if the vessel should form a convoy or join a convoy own or forign and do so.
        Parameters:
        vessel - for which to check the convoy
        city - current city of the vessel.
      • shouldJoinOrFormConvoy

        public boolean shouldJoinOrFormConvoy​(ch.sahits.game.openpatrician.model.IAIPlayer player)
        Check if there is a need for a ship of the player to join a convoy or form one.
        Parameters:
        player - for whom to check
        Returns:
        false if there is no need for a ship to be in a convoy.