void calculateUtility(PhysicalInfo physicalInfo){
  if (physicalInfo.getProbabilityToHit() <= 0.0) {
    physicalInfo.setUtility(-10000);
    return;
  }
  double utility=DAMAGE_UTILITY * physicalInfo.getExpectedDamage();
  utility+=CRITICAL_UTILITY * physicalInfo.getExpectedCriticals();
  utility+=KILL_UTILITY * physicalInfo.getKillProbability();
  utility*=calcTargetPotentialDamageMultiplier(physicalInfo.getTarget());
  utility-=(physicalInfo.getTarget() instanceof MechWarrior) ? EJECTED_PILOT_DISUTILITY : 0;
  utility+=calcCommandUtility(physicalInfo.getTarget());
  utility+=calcStrategicBuildingTargetUtility(physicalInfo.getTarget());
  utility+=calcPriorityUnitTargetUtility(physicalInfo.getTarget());
  utility-=calcCivilianTargetDisutility(physicalInfo.getTarget());
  physicalInfo.setUtility(utility);
}

void calculateUtility ( PhysicalInfo physicalInfo ) { if ( physicalInfo . getProbabilityToHit ( ) <= 0.0 ) { physicalInfo . setUtility ( - 10000 ) ; return ; } double utility = DAMAGE_UTILITY * physicalInfo . getExpectedDamage ( ) ; utility += CRITICAL_UTILITY * physicalInfo . getExpectedCriticals ( ) ; utility += KILL_UTILITY * physicalInfo . getKillProbability ( ) ; utility *= calcTargetPotentialDamageMultiplier ( physicalInfo . getTarget ( ) ) ; utility -= ( physicalInfo . getTarget ( ) instanceof MechWarrior ) ? EJECTED_PILOT_DISUTILITY : 0 ; utility += calcCommandUtility ( physicalInfo . getTarget ( ) ) ; utility += calcStrategicBuildingTargetUtility ( physicalInfo . getTarget ( ) ) ; utility += calcPriorityUnitTargetUtility ( physicalInfo . getTarget ( ) ) ; utility -= calcCivilianTargetDisutility ( physicalInfo . getTarget ( ) ) ; physicalInfo . setUtility ( utility ) ; }
calculates the ' utility ' of a physical action .
