Class Reach
java.lang.Object
com.github.yellowstonegames.path.technique.Reach
A struct-like class that holds information about targeting rules for actions or other effects that reach from one
square into another one, with certain potential restrictions.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionAn AimLimit enum that may be used to determine limitations to targeting cells; defaults to FREE (no limits other than those from distance), but can also be set to ORTHOGONAL (rook move in chess), DIAGONAL (bishop move in chess), EIGHT_WAY (queen or king move in chess), or null (which usually is equivalent to FREE).intThe maximum distance in cells that this Reach can target.com.github.yellowstonegames.grid.RadiusDetermines how distance will be measured.intThe minimum distance in cells that this Reach can target. -
Constructor Summary
ConstructorsConstructorDescriptionReach()Constructs a Reach with all fields given default values; maxDistance is set to 1, minDistance is set to 0, limit is set to AimLimit.FREE, and metric is set to Radius.SQUARE (8-way movement).Reach(int maxDistance) Constructs a Reach with the specified maxDistance, to a minimum of 0.Reach(int minDistance, int maxDistance) Constructs a Reach with the specified minDistance, to a minimum of 0, and maxDistance, to a minimum equal to minDistance (after factoring in any change to meet the minimum of 0).Reach(int minDistance, int maxDistance, com.github.yellowstonegames.grid.Radius metric) Constructs a Reach with the specified minDistance, to a minimum of 0, maxDistance, to a minimum equal to minDistance (after factoring in any change to meet the minimum of 0), and distance calculation metric as a Radius enum.Reach(int minDistance, int maxDistance, com.github.yellowstonegames.grid.Radius metric, AimLimit limit) Constructs a Reach with the specified minDistance, to a minimum of 0, maxDistance, to a minimum equal to minDistance (after factoring in any change to meet the minimum of 0), and distance calculation metric as a Radius enum. -
Method Summary
-
Field Details
-
minDistance
public int minDistanceThe minimum distance in cells that this Reach can target. Distance will be measured using themetricfield. -
maxDistance
public int maxDistanceThe maximum distance in cells that this Reach can target. Distance will be measured using themetricfield. -
limit
An AimLimit enum that may be used to determine limitations to targeting cells; defaults to FREE (no limits other than those from distance), but can also be set to ORTHOGONAL (rook move in chess), DIAGONAL (bishop move in chess), EIGHT_WAY (queen or king move in chess), or null (which usually is equivalent to FREE). -
metric
public com.github.yellowstonegames.grid.Radius metricDetermines how distance will be measured. SQUARE or CUBE correspond to 8-way or Chebyshev movement, DIAMOND or OCTAHEDRON correspond to 4-way or Manhattan movement, and CIRCLE or SPHERE correspond to Euclidean movement.
-
-
Constructor Details
-
Reach
public Reach()Constructs a Reach with all fields given default values; maxDistance is set to 1, minDistance is set to 0, limit is set to AimLimit.FREE, and metric is set to Radius.SQUARE (8-way movement). -
Reach
public Reach(int maxDistance) Constructs a Reach with the specified maxDistance, to a minimum of 0. Other fields are given default values; minDistance is set to 0, limit is set to AimLimit.FREE, and metric is set to Radius.SQUARE (8-way movement).- Parameters:
maxDistance- the longest distance in cells this Reach can target; will be set to 0 if negative
-
Reach
public Reach(int minDistance, int maxDistance) Constructs a Reach with the specified minDistance, to a minimum of 0, and maxDistance, to a minimum equal to minDistance (after factoring in any change to meet the minimum of 0). Other fields are given default values; limit is set to AimLimit.FREE, and metric is set to Radius.SQUARE (8-way movement).- Parameters:
minDistance- the shortest distance in cells this Reach can target; will be set to 0 if negativemaxDistance- the longest distance in cells this Reach can target; will be set to the final value of minDistance if it is lower than the calculated minDistance
-
Reach
public Reach(int minDistance, int maxDistance, com.github.yellowstonegames.grid.Radius metric) Constructs a Reach with the specified minDistance, to a minimum of 0, maxDistance, to a minimum equal to minDistance (after factoring in any change to meet the minimum of 0), and distance calculation metric as a Radius enum. Other than that, limit is set to AimLimit.FREE.- Parameters:
minDistance- the shortest distance in cells this Reach can target; will be set to 0 if negativemaxDistance- the longest distance in cells this Reach can target; will be set to the final value of minDistance if it is lower than the calculated minDistancemetric- a Radius enum that determines how distance will be calculated
-
Reach
public Reach(int minDistance, int maxDistance, com.github.yellowstonegames.grid.Radius metric, AimLimit limit) Constructs a Reach with the specified minDistance, to a minimum of 0, maxDistance, to a minimum equal to minDistance (after factoring in any change to meet the minimum of 0), and distance calculation metric as a Radius enum. Other than that, limit is set to AimLimit.FREE.- Parameters:
minDistance- the shortest distance in cells this Reach can target; will be set to 0 if negativemaxDistance- the longest distance in cells this Reach can target; will be set to the final value of minDistance if it is lower than the calculated minDistancemetric- a Radius enum that determines how distance will be calculatedlimit- an AimLimit enum that can be used to limit targeting to specific angles, or not at all (if null or equal to AimLimit.FREE)
-
-
Method Details
-
equals
-
hashCode
-
toString
-