Skip to content

Commit

Permalink
Merge pull request #6479 from Scoppio/fix/hyperagression-fixed
Browse files Browse the repository at this point in the history
fix: removes an argument and early exit added by mistake to hyperagreression
  • Loading branch information
Sleet01 authored Feb 1, 2025
2 parents db6a9eb + c429bd0 commit 6337417
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions megamek/src/megamek/client/bot/princess/BasicPathRanker.java
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,8 @@ EntityEvaluationResponse evaluateMovedEnemy(Entity enemy, MovePath path, Game ga

// The further I am from a target, the lower this path ranks (weighted by
// Hyper Aggression.
protected double calculateAggressionMod(Entity movingUnit, MovePath path, double maximumDamageDone, Game game) {
if (maximumDamageDone <= 0) {
return 0;
}
protected double calculateAggressionMod(Entity movingUnit, MovePath path, Game game) {

double distToEnemy = distanceToClosestEnemy(movingUnit, path.getFinalCoords(), game);

if ((distToEnemy == 0) && !(movingUnit instanceof Infantry)) {
Expand Down Expand Up @@ -564,7 +562,7 @@ protected RankedPath rankPath(MovePath path, Game game, int maxRange, double fal
// The further I am from a target, the lower this path ranks
// (weighted by Aggression slider).
double aggressionMod = isNotAirborne ?
calculateAggressionMod(movingUnit, pathCopy, damageEstimate.getMaximumDamageEstimate(), game) : 0;
calculateAggressionMod(movingUnit, pathCopy, game) : 0;
// The further I am from my teammates, the lower this path
// ranks (weighted by Herd Mentality).
double herdingMod = isNotAirborne ? calculateHerdingMod(friendsCoords, pathCopy) : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected RankedPath rankPath(MovePath path, Game game, int maxRange, double fal
// If an infantry unit is not in range to do damage,
// then we want it to move closer. Otherwise, let's avoid charging up to unmoved units,
// that's not going to end well.
var aggressionMod = calculateAggressionMod(movingUnit, pathCopy, maximumDamageDone, game);
var aggressionMod = calculateAggressionMod(movingUnit, pathCopy, game);

// The further I am from my teammates, the lower this path
// ranks (weighted by Herd Mentality).
Expand Down

0 comments on commit 6337417

Please sign in to comment.