Class PathRanker
- All Implemented Interfaces:
IPathRanker
- Direct Known Subclasses:
BasicPathRanker
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe possible path ranker types. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CoordscalcAllyCenter(int myId, List<Entity> friends, Game game) calculateAlliesCenter(int myId, List<Entity> friends, Game game) protected doublecalculateMovePathPSRDamage(Entity movingEntity, MovePath path) Estimates the most expected damage that a path could cause, given the pilot skill of the path ranker and various conditions.intdistanceToHomeEdge(Coords position, int boardId, CardinalEdge homeEdge, Game game) Returns distance to the unit's home edge.findClosestEnemy(Entity me, Coords position, Game game) Find the closest enemy to a unit with a pathfindClosestEnemy(Entity me, Coords position, Game game, boolean includeStrategicTargets, int minDistance) Find the closest enemy to a unit with a pathgetBestPath(TreeSet<RankedPath> ps) Returns the best path of a list of ranked paths.protected doublegetMovePathSuccessProbability(MovePath movePath) Calculates the probability that a unit can successfully complete the given movement path.protected PrincessgetOwner()protected PathRankerStateConvenience property to access bot-wide state information.protected List<TargetRoll> getPSRList(MovePath path) voidinitUnitTurn(Entity unit, Game game) Performs initialization to help speed later calls of rankPath for this unit on this turn.protected abstract RankedPathrankPath(MovePath path, Game game, int maxRange, double fallTolerance, List<Entity> enemies, Coords friendsCoords) rankPaths(List<MovePath> movePaths, Game game, int maxRange, double fallTolerance, List<Entity> enemies, List<Entity> friends) protected CombatPostureresolvedPostureFor(Game game, int boardId) The posture already resolved for this board this round, ornullwhen none has been.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface megamek.client.bot.princess.IPathRanker
distanceToClosestEnemy, findClosestEnemy
-
Constructor Details
-
PathRanker
-
-
Method Details
-
resolvedPostureFor
The posture already resolved for this board this round, ornullwhen none has been.Read-only by contract: implementations must not resolve a posture that has not been asked for, since resolving announces it. Overridden by
BasicPathRanker; there is nothing to report here.- Parameters:
game- the current gameboardId- the board to report on- Returns:
- the resolved posture, or
null
-
rankPath
-
rankPaths
public TreeSet<RankedPath> rankPaths(List<MovePath> movePaths, Game game, int maxRange, double fallTolerance, List<Entity> enemies, List<Entity> friends) - Specified by:
rankPathsin interfaceIPathRanker
-
getBestPath
Returns the best path of a list of ranked paths.- Specified by:
getBestPathin interfaceIPathRanker- Parameters:
ps- The list of ranked paths to process- Returns:
- "Best" out of those paths
-
initUnitTurn
Performs initialization to help speed later calls of rankPath for this unit on this turn. Rankers that extend this class should override this function- Specified by:
initUnitTurnin interfaceIPathRanker
-
findClosestEnemy
Description copied from interface:IPathRankerFind the closest enemy to a unit with a path- Specified by:
findClosestEnemyin interfaceIPathRanker
-
findClosestEnemy
public Targetable findClosestEnemy(Entity me, Coords position, Game game, boolean includeStrategicTargets, int minDistance) Find the closest enemy to a unit with a path- Specified by:
findClosestEnemyin interfaceIPathRanker
-
getMovePathSuccessProbability
Calculates the probability that a unit can successfully complete the given movement path.This method evaluates all piloting skill rolls required along the path and computes the combined probability of passing all of them. It accounts for:
- Piloting skill rolls from difficult terrain, elevation changes, etc.
- MASC failure chances if MASC is activated during the move
- Supercharger failure chances if a supercharger is used
The method skips "getting up" and "careful stand" piloting rolls as these are handled separately when evaluating immobile status. Results are cached to avoid redundant calculations during path evaluation.
The probability is expressed as a value between 0.0 (guaranteed failure) and 1.0 (guaranteed success).
- Parameters:
movePath- The movement path to evaluate- Returns:
- The probability (0.0 to 1.0) that all required piloting rolls will succeed
-
calculateMovePathPSRDamage
Estimates the most expected damage that a path could cause, given the pilot skill of the path ranker and various conditions.XXX Sleet01: add fall pilot damage and skid damage calcs (low-/high-gravity overspeed leg damage is handled below via
predictGravityOverspeedDamage(megamek.common.units.Entity, megamek.common.moves.MovePath, megamek.common.rolls.TargetRoll)). -
getPSRList
-
distanceToHomeEdge
Description copied from interface:IPathRankerReturns distance to the unit's home edge. Gives the distance to the closest edge- Specified by:
distanceToHomeEdgein interfaceIPathRanker- Parameters:
position- Final coordinates of the proposed move.boardId- The board on which to lookhomeEdge- Unit's home edge.game- The currentGame- Returns:
- The distance, in hexes to the unit's home edge.
-
calculateAlliesCenter
-
calcAllyCenter
-
getOwner
-
getPathRankerState
Convenience property to access bot-wide state information.- Returns:
- the owner's path ranker state
-