Package megamek.client.bot.princess
Class UtilityPathRanker
java.lang.Object
megamek.client.bot.princess.PathRanker
megamek.client.bot.princess.BasicPathRanker
megamek.client.bot.princess.UtilityPathRanker
- All Implemented Interfaces:
IPathRanker
-
Nested Class Summary
Nested classes/interfaces inherited from class megamek.client.bot.princess.BasicPathRanker
BasicPathRanker.FiringPhysicalDamageNested classes/interfaces inherited from class megamek.client.bot.princess.PathRanker
PathRanker.PathRankerType -
Field Summary
Fields inherited from class megamek.client.bot.princess.BasicPathRanker
bestDamageByEnemies, blackIce, ESTIMATE_NOISE_MARGIN, FACING_MOD_MULTIPLIER, HOLD_CREDIT_ATTACK_CAP_FACTOR, HOLD_CREDIT_DEFEND_CAP_FACTOR, LOG_DECIMAL, LOG_PERCENT, REPRESENTATIVE_TO_HIT, TEMPO_REFERENCE_MP, THREAT_CONTACT_RANGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected doublecalculateAggressionMod(Entity movingUnit, MovePath path, double maxRange, Game game) calculateAlliesCenter(int myId, List<Entity> friends, Game game) protected doublecalculateFacingMod(MovePath path) protected doublecalculateFallMod(double successProbability) protected doublecalculateMovementMod(MovePath pathCopy, Game game) Calculates the TMM score of the unitprotected doublecalculateSelfPreservationMod(Entity movingUnit, MovePath path, Game game) Calculates a self-preservation modifier that encourages units to retreat when appropriate.getBestPath(TreeSet<RankedPath> ps) Returns the best path of a list of ranked paths.protected doublegetBraveryMod(double successProbability, BasicPathRanker.FiringPhysicalDamage damageEstimate, double expectedDamageTaken) Calculates bravery modifier of the unitprotected RankedPathrankPath(MovePath path, Game game, int maxRange, double fallTolerance, List<Entity> enemies, Coords friendsCoords) A path rankingMethods inherited from class megamek.client.bot.princess.BasicPathRanker
attackerMovementDamageDiscount, calcDamageToStrategicTargets, calculateAerospaceMod, calculateAggressionMod, calculateCloseRangeIncentive, calculateCrowdingTolerance, calculateFacingMod, calculateMovementMod, calculateMutualSupportMod, calculateOffBoardMod, calculatePositionHoldMod, checkBlackIce, checkPathForHazards, distanceToClosestEnemy, doctrineScores, evaluateAsMoved, getPSRList, hexProperties, incomingFireTerrainDiscount, initUnitTurn, isExtremeRange, isLosRange, isWithdrawing, rankPaths, resolvedPostureFor, resolvePostureMethods inherited from class megamek.client.bot.princess.PathRanker
calcAllyCenter, calculateMovePathPSRDamage, distanceToHomeEdge, findClosestEnemy, findClosestEnemy, getMovePathSuccessProbability, getOwner, getPathRankerStateMethods 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
findClosestEnemy
-
Constructor Details
-
UtilityPathRanker
-
-
Method Details
-
calculateAlliesCenter
- Overrides:
calculateAlliesCenterin classPathRanker
-
getBestPath
Returns the best path of a list of ranked paths.- Specified by:
getBestPathin interfaceIPathRanker- Overrides:
getBestPathin classPathRanker- Parameters:
ps- The list of ranked paths to process- Returns:
- "Best" out of those paths
-
rankPath
protected RankedPath rankPath(MovePath path, Game game, int maxRange, double fallTolerance, List<Entity> enemies, Coords friendsCoords) A path ranking- Overrides:
rankPathin classBasicPathRanker- Parameters:
path- The movement path to be evaluatedgame- The current game statemaxRange- Entity max weapon rangefallTolerance- a maximum PSR failure chance to be acceptableenemies- List of enemy units visiblefriendsCoords- Center of Gravity of friendly units (average coordinate position)- Returns:
- A double representing the utility/desirability of the path (higher is better)
-
getBraveryMod
protected double getBraveryMod(double successProbability, BasicPathRanker.FiringPhysicalDamage damageEstimate, double expectedDamageTaken) Calculates bravery modifier of the unit- Overrides:
getBraveryModin classBasicPathRanker- Parameters:
successProbability- The probability of success of the movedamageEstimate- The estimated damage that the unit can doexpectedDamageTaken- The expected damage that the unit will take- Returns:
- The bravery modifier score
-
calculateMovementMod
Calculates the TMM score of the unit- Parameters:
pathCopy- The path to evaluategame- The game- Returns:
- The TMM score
-
calculateFallMod
protected double calculateFallMod(double successProbability) -
calculateFacingMod
-
calculateAggressionMod
-
calculateSelfPreservationMod
Description copied from class:BasicPathRankerCalculates a self-preservation modifier that encourages units to retreat when appropriate.This method applies penalties or bonuses based on the unit's movement toward safety:
- For units in forced withdrawal or moving to a destination, encourages movement toward home edge
- Applies a significant bonus (
BasicPathRanker.ARRIVED_AT_DESTINATION_FACTOR) if the path reaches the home edge - Applies a penalty proportional to distance from home edge otherwise
The method only applies these modifiers when the unit is in forced withdrawal or deliberately moving to a designated location. For normal combat operations, it returns 0 to indicate self-preservation is not a priority factor.
- Overrides:
calculateSelfPreservationModin classBasicPathRanker- Parameters:
movingUnit- The entity being movedpath- The movement path being evaluatedgame- The current game state- Returns:
- A self-preservation modifier value (negative values are better) to be used in path ranking
-