Class AtlantisMovementEvaluator

  • All Implemented Interfaces:
    MovementEvaluator

    public class AtlantisMovementEvaluator
    extends java.lang.Object
    implements MovementEvaluator
    Movement evaluator for Atlantis game.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<CoordinateID> getAdditionalMovement​(Unit u)
      Returns the list of regions that the unit will move through after the next turn.
      CoordinateID getDestination​(Unit unit, java.util.List<CoordinateID> path)
      Returns the destination region where this unit is able to travel within one turn based on modified riding skill, horses, carts, load of this unit and roads on the given path.
      int getDistance​(Unit unit, java.util.List<Region> path)
      Returns the number of turns that the unit needs to travel on the specified path based on modified riding skill, horses, carts, load of this unit and roads on the given path.
      int getLoad​(Unit unit)
      Returns the weight of all items of this unit that are not horses or carts in silver
      int getModifiedLoad​(Unit unit)
      Returns the weight of all items of this unit that are not horses or carts in silver based on the modified items.
      java.util.List<CoordinateID> getModifiedMovement​(Unit u)
      Returns the list of regions that the unit will move through in the next turn.
      int getModifiedRadius​(Unit unit)
      Returns the unit's speed based on payload and horses.
      int getModifiedRadius​(Unit unit, boolean onRoad)
      Returns the number of regions this unit is able to travel (on roads if onRoad is true) within one turn based on modified riding skill, horses, carts and load of this unit.
      int getModifiedRadius​(Unit unit, java.util.List<Region> path)
      Returns the number of regions this unit is able to travel within one turn based on modified riding skill, horses, carts, load of this unit and roads on the given path.
      int getModifiedWeight​(Unit unit)
      The modified weight is calculated from the modified number of persons and the modified items.
      MovementRelation getMovement​(Unit unit, java.util.List<Direction> directions, int maxLength)
      Computes the movement of a unit with the given directions as orders
      java.util.List<CoordinateID> getPassiveMovement​(Unit u)
      Returns the list of regions that the unit will be transported through.
      int getPayloadOnFoot​(Unit unit)
      Returns the maximum payload in GE*100 of this unit when it travels on foot.
      int getPayloadOnHorse​(Unit unit)
      Returns the maximum payload in GE*100 of this unit when it travels by horse.
      int getRadius​(Unit u)
      Returns the number of regions this unit is able to travel within one turn based on the riding skill, horses, carts and load of this unit.
      int getRadius​(Unit u, boolean onRoad)
      Returns the number of regions this unit is able to travel (on roads if onRoad is true) within one turn based on the riding skill, horses, carts and load of this unit.
      int getWeight​(Unit unit)
      The initial weight of the unit as it appears in the report.
      boolean isPastMovementPassive​(Unit unit)
      Checks if the unit's movement was passive (transported or shipped).
      protected java.util.List<Direction> pathToDirections​(java.util.List<?> path)  
      • Methods inherited from class java.lang.Object

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

      • AtlantisMovementEvaluator

        protected AtlantisMovementEvaluator​(Rules rules)
    • Method Detail

      • getPayloadOnHorse

        public int getPayloadOnHorse​(Unit unit)
        Description copied from interface: MovementEvaluator
        Returns the maximum payload in GE*100 of this unit when it travels by horse. Horses, carts and persons are taken into account for this calculation. If the unit has a sufficient skill in horse riding but there are too many carts for the horses, the weight of the additional carts are also already considered.
        Specified by:
        getPayloadOnHorse in interface MovementEvaluator
        Returns:
        the payload in GE*100, CAP_NO_HORSES if the unit does not possess horses or CAP_UNSKILLED if the unit is not sufficiently skilled in horse riding to travel on horseback.
      • getPayloadOnFoot

        public int getPayloadOnFoot​(Unit unit)
        Description copied from interface: MovementEvaluator
        Returns the maximum payload in GE*100 of this unit when it travels on foot. Horses, carts and persons are taken into account for this calculation. If the unit has a sufficient skill in horse riding but there are too many carts for the horses, the weight of the additional carts are also already considered. The calculation also takes into account that trolls can tow carts.
        Specified by:
        getPayloadOnFoot in interface MovementEvaluator
        Returns:
        the payload in GE*100, CAP_UNSKILLED if the unit is not sufficiently skilled in horse riding to travel on foot.
      • getLoad

        public int getLoad​(Unit unit)
        Description copied from interface: MovementEvaluator
        Returns the weight of all items of this unit that are not horses or carts in silver
        Specified by:
        getLoad in interface MovementEvaluator
      • getModifiedLoad

        public int getModifiedLoad​(Unit unit)
        Description copied from interface: MovementEvaluator
        Returns the weight of all items of this unit that are not horses or carts in silver based on the modified items.
        Specified by:
        getModifiedLoad in interface MovementEvaluator
      • getWeight

        public int getWeight​(Unit unit)
        Description copied from interface: MovementEvaluator
        The initial weight of the unit as it appears in the report. This should be the game dependent version used to calculate the weight if the information is not available in the report.
        Specified by:
        getWeight in interface MovementEvaluator
        Returns:
        the weight of the unit in silver (GE 100).
      • getModifiedWeight

        public int getModifiedWeight​(Unit unit)
        Description copied from interface: MovementEvaluator
        The modified weight is calculated from the modified number of persons and the modified items. Due to some game dependencies this is done in this class.
        Specified by:
        getModifiedWeight in interface MovementEvaluator
        Returns:
        the modified weight of the unit in silver (GE 100).
      • getModifiedRadius

        public int getModifiedRadius​(Unit unit)
        Description copied from interface: MovementEvaluator
        Returns the unit's speed based on payload and horses.
        Specified by:
        getModifiedRadius in interface MovementEvaluator
        Returns:
        the unit's speed based on payload and horses
      • getModifiedRadius

        public int getModifiedRadius​(Unit unit,
                                     boolean onRoad)
        Description copied from interface: MovementEvaluator
        Returns the number of regions this unit is able to travel (on roads if onRoad is true) within one turn based on modified riding skill, horses, carts and load of this unit.
        Specified by:
        getModifiedRadius in interface MovementEvaluator
      • getModifiedRadius

        public int getModifiedRadius​(Unit unit,
                                     java.util.List<Region> path)
        Description copied from interface: MovementEvaluator
        Returns the number of regions this unit is able to travel within one turn based on modified riding skill, horses, carts, load of this unit and roads on the given path.
        Specified by:
        getModifiedRadius in interface MovementEvaluator
        path - A sequence of regions. The first region must be the current region of the unit. If two successive elements of the path are the same region, this is interpreted as a PAUSE, which always ends a turn. See Unit.getModifiedMovement().
        Returns:
        The number of regions, the unit may move on this path. The result is always <= path.size()-1.
      • getRadius

        public int getRadius​(Unit u)
        Description copied from interface: MovementEvaluator
        Returns the number of regions this unit is able to travel within one turn based on the riding skill, horses, carts and load of this unit.
        Specified by:
        getRadius in interface MovementEvaluator
      • getRadius

        public int getRadius​(Unit u,
                             boolean onRoad)
        Description copied from interface: MovementEvaluator
        Returns the number of regions this unit is able to travel (on roads if onRoad is true) within one turn based on the riding skill, horses, carts and load of this unit.
        Specified by:
        getRadius in interface MovementEvaluator
      • isPastMovementPassive

        public boolean isPastMovementPassive​(Unit unit)
        Description copied from interface: MovementEvaluator
        Checks if the unit's movement was passive (transported or shipped).
        Specified by:
        isPastMovementPassive in interface MovementEvaluator
        Returns:
        true if the unit's past movement was passive
      • getMovement

        public MovementRelation getMovement​(Unit unit,
                                            java.util.List<Direction> directions,
                                            int maxLength)
        Description copied from interface: MovementEvaluator
        Computes the movement of a unit with the given directions as orders
        Specified by:
        getMovement in interface MovementEvaluator
        Returns:
        A MovementRelation expressing the future movement of the unit
      • getDestination

        public CoordinateID getDestination​(Unit unit,
                                           java.util.List<CoordinateID> path)
        Description copied from interface: MovementEvaluator
        Returns the destination region where this unit is able to travel within one turn based on modified riding skill, horses, carts, load of this unit and roads on the given path. The result may be inaccurate when some regions corresponding to coordinates in the path are not in the data.
        Specified by:
        getDestination in interface MovementEvaluator
        path - A sequence of coordinates. The first region must be the current region of the unit. If two successive elements of the path are the same region, this is interpreted as a PAUSE, which always ends a turn. See Unit.getModifiedMovement().
        Returns:
        The number of regions, the unit may move on this path. The result is always <= path.size()-1.
      • pathToDirections

        protected java.util.List<Direction> pathToDirections​(java.util.List<?> path)