void calculateUtility(FiringPlan firingPlan,int overheatTolerance,boolean shooterIsAero){
  int overheat=0;
  if (firingPlan.getHeat() > overheatTolerance) {
    overheat=firingPlan.getHeat() - overheatTolerance;
  }
  double modifier=1;
  modifier+=calcCommandUtility(firingPlan.getTarget());
  modifier+=calcStrategicBuildingTargetUtility(firingPlan.getTarget());
  modifier+=calcPriorityUnitTargetUtility(firingPlan.getTarget());
  double utility=0;
  utility+=DAMAGE_UTILITY * firingPlan.getExpectedDamage();
  utility+=CRITICAL_UTILITY * firingPlan.getExpectedCriticals();
  utility+=KILL_UTILITY * firingPlan.getKillProbability();
  utility*=calcTargetPotentialDamageMultiplier(firingPlan.getTarget());
  utility+=TARGET_HP_FRACTION_DEALT_UTILITY * calcDamageAllocationUtility(firingPlan.getTarget(),firingPlan.getExpectedDamage());
  utility-=calcCivilianTargetDisutility(firingPlan.getTarget());
  utility*=modifier;
  utility-=(shooterIsAero ? OVERHEAT_DISUTILITY_AERO : OVERHEAT_DISUTILITY) * overheat;
  utility-=(firingPlan.getTarget() instanceof MechWarrior) ? EJECTED_PILOT_DISUTILITY : 0;
  firingPlan.setUtility(utility);
}

void calculateUtility ( FiringPlan firingPlan , int overheatTolerance , boolean shooterIsAero ) { int overheat = 0 ; if ( firingPlan . getHeat ( ) > overheatTolerance ) { overheat = firingPlan . getHeat ( ) - overheatTolerance ; } double modifier = 1 ; modifier += calcCommandUtility ( firingPlan . getTarget ( ) ) ; modifier += calcStrategicBuildingTargetUtility ( firingPlan . getTarget ( ) ) ; modifier += calcPriorityUnitTargetUtility ( firingPlan . getTarget ( ) ) ; double utility = 0 ; utility += DAMAGE_UTILITY * firingPlan . getExpectedDamage ( ) ; utility += CRITICAL_UTILITY * firingPlan . getExpectedCriticals ( ) ; utility += KILL_UTILITY * firingPlan . getKillProbability ( ) ; utility *= calcTargetPotentialDamageMultiplier ( firingPlan . getTarget ( ) ) ; utility += TARGET_HP_FRACTION_DEALT_UTILITY * calcDamageAllocationUtility ( firingPlan . getTarget ( ) , firingPlan . getExpectedDamage ( ) ) ; utility -= calcCivilianTargetDisutility ( firingPlan . getTarget ( ) ) ; utility *= modifier ; utility -= ( shooterIsAero ? OVERHEAT_DISUTILITY_AERO : OVERHEAT_DISUTILITY ) * overheat ; utility -= ( firingPlan . getTarget ( ) instanceof MechWarrior ) ? EJECTED_PILOT_DISUTILITY : 0 ; firingPlan . setUtility ( utility ) ; }
calculates the ' utility ' of a firing plan . override this function if you have a better idea about what firing plans are good
