Class EresseaMovementEvaluator

    • Field Detail

      • FOOT_NORMAL_SPEED

        public static final int FOOT_NORMAL_SPEED
        normal walking speed
        See Also:
        Constant Field Values
      • FOOT_ROAD_SPEED

        public static final int FOOT_ROAD_SPEED
        walking speed on road
        See Also:
        Constant Field Values
      • HORSE_NORMAL_SPEED

        public static final int HORSE_NORMAL_SPEED
        normal riding speed
        See Also:
        Constant Field Values
      • HORSE_ROAD_SPEED

        public static final int HORSE_ROAD_SPEED
        riding speed on road
        See Also:
        Constant Field Values
      • BF_NORMAL

        public static final int BF_NORMAL
        The movement cost for normal movement
        See Also:
        Constant Field Values
      • BF_ROAD

        public static final int BF_ROAD
        The movement cost for road movement
        See Also:
        Constant Field Values
      • BF_WALKING

        public static final int BF_WALKING
        The movement budget for walking units
        See Also:
        Constant Field Values
      • BF_RIDING

        public static final int BF_RIDING
        The movement budget for riding units
        See Also:
        Constant Field Values
    • Constructor Detail

      • EresseaMovementEvaluator

        protected EresseaMovementEvaluator​(Rules rules)
    • Method Detail

      • getPayloadOnHorse

        public 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.
        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.
      • getMaxHorsesRiding

        protected int getMaxHorsesRiding​(Unit unit)
      • getMaxHorsesWalking

        protected int getMaxHorsesWalking​(Unit unit)
      • getHorses

        protected int getHorses​(Unit unit)
      • getPayloadOnFoot

        public 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.
        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 horseback.
      • getRadius

        @Deprecated
        public int getRadius​(Unit u,
                             boolean onRoad)
        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
      • getWeight

        public int getWeight​(Unit unit)
        The initial weight of the unit as it appear in the report. This is the eressea 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)
        The modified weight is calculated from the modified number of persons and the modified items. Due to some eressea dependencies this is done in this class.
        Specified by:
        getModifiedWeight in interface MovementEvaluator
        Returns:
        the modified weight of the unit in silver (GE 100).
      • canWalk

        public boolean canWalk​(Unit unit)
        Returns:
        true if the movement can walk and is not overloaded.
      • canRide

        public boolean canRide​(Unit unit)
        Returns:
        true if the movement can ride without being overloaded.
      • getTransportMessageType

        protected MessageType getTransportMessageType()
      • 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
      • 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.
      • pathToDirections

        protected java.util.List<Direction> pathToDirections​(java.util.List<?> path)
      • 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.
      • getRules

        protected Rules getRules()