Interface MovementEvaluator

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int CAP_NO_HORSES
      The unit does not possess horses
      static int CAP_UNSKILLED
      The unit is not sufficiently skilled in horse riding
    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated 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)
      Deprecated.
      int getRadius​(Unit u, boolean onRoad)
      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).
    • Field Detail

      • CAP_NO_HORSES

        static final int CAP_NO_HORSES
        The unit does not possess horses
        See Also:
        Constant Field Values
      • CAP_UNSKILLED

        static final int CAP_UNSKILLED
        The unit is not sufficiently skilled in horse riding
        See Also:
        Constant Field Values
    • Method Detail

      • getPayloadOnHorse

        int getPayloadOnHorse​(Unit unit)
        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.
        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

        int getPayloadOnFoot​(Unit unit)
        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.
        Returns:
        the payload in GE*100, CAP_UNSKILLED if the unit is not sufficiently skilled in horse riding to travel on foot.
      • getLoad

        int getLoad​(Unit unit)
        Returns the weight of all items of this unit that are not horses or carts in silver
      • getModifiedLoad

        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.
      • getWeight

        int getWeight​(Unit unit)
        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.
        Returns:
        the weight of the unit in silver (GE 100).
      • getModifiedWeight

        int getModifiedWeight​(Unit unit)
        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.
        Returns:
        the modified weight of the unit in silver (GE 100).
      • getModifiedRadius

        int getModifiedRadius​(Unit unit)
        Returns the unit's speed based on payload and horses.
        Parameters:
        unit -
        Returns:
        the unit's speed based on payload and horses
      • getModifiedRadius

        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.
      • getModifiedRadius

        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.
        Parameters:
        unit -
        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.
        Throws:
        java.lang.IllegalArgumentException - if the unit is not in the first path region or the path is not continuous
      • getDestination

        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. The result may be inaccurate when some regions corresponding to coordinates in the path are not in the data.
        Parameters:
        unit -
        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.
        Throws:
        java.lang.IllegalArgumentException - if the unit is not in the first path region or the path is not continuous
      • getDistance

        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.
        Parameters:
        unit -
        path - A sequence of regions. The first region must be the current region of the unit.
        Returns:
        the number of rounds needed to complete the path
      • getRadius

        @Deprecated
        int getRadius​(Unit u)
        Deprecated.
        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.
      • getRadius

        @Deprecated
        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.
      • isPastMovementPassive

        boolean isPastMovementPassive​(Unit unit)
        Checks if the unit's movement was passive (transported or shipped).
        Parameters:
        unit -
        Returns:
        true if the unit's past movement was passive
      • getModifiedMovement

        java.util.List<CoordinateID> getModifiedMovement​(Unit u)
        Returns the list of regions that the unit will move through in the next turn.
        Parameters:
        u -
        Returns:
        A list of regions, starting with the current region. An empty list if the unit doesn't move.
      • getAdditionalMovement

        java.util.List<CoordinateID> getAdditionalMovement​(Unit u)
        Returns the list of regions that the unit will move through after the next turn.
        Parameters:
        u -
        Returns:
        A list of regions, starting with the destination of the current turn. If there is a PAUSE, the region repeats. An empty list if the unit doesn't move.
      • getPassiveMovement

        java.util.List<CoordinateID> getPassiveMovement​(Unit u)
        Returns the list of regions that the unit will be transported through.
        Parameters:
        u -
        Returns:
        A list of regions, starting with the current region. If there is a PAUSE, the region repeats. An empty list if the unit doesn't move.
      • getMovement

        MovementRelation getMovement​(Unit unit,
                                     java.util.List<Direction> directions,
                                     int maxLength)
        Computes the movement of a unit with the given directions as orders
        Parameters:
        unit -
        directions -
        maxLength -
        Returns:
        A MovementRelation expressing the future movement of the unit