src/evaluators/GetHealthEvaluator.js
/**
	* Calculates the desirability. It's a score between 0 and 1 representing the desirability
	* of a goal.
	*
	* @param {Enemy} owner - The owner of this goal evaluator.
	* @return {Number} The desirability.
	*/
Calculates the desirability. It's a score between 0 and 1 representing the desirability
of a goal.

@param {Enemy} owner - The owner of this goal evaluator.
@return {Number} The desirability.
Calculates the desirability . It ' s a score between 0 and 1 representing the desirability of a goal . @param { Enemy } owner - The owner of this goal evaluator . @return { Number } The desirability .
calculateDesirability( owner ) {
		let desirability = 0;
		if ( owner.isItemIgnored( this.itemType ) === false && owner.health < owner.maxHealth ) {
			const distanceScore = Feature.distanceToItem( owner, this.itemType );
			const healthScore = Feature.health( owner );
			desirability = this.tweaker * ( 1 - healthScore ) / distanceScore;
			desirability = MathUtils.clamp( desirability, 0, 1 );
		}
		return desirability;
	}
calculateDesirability ( owner ) { let desirability = 0 ; if ( owner . isItemIgnored ( this . itemType ) === false && owner . health < owner . maxHealth ) { const distanceScore = Feature . distanceToItem ( owner , this . itemType ) ; const healthScore = Feature . health ( owner ) ; desirability = this . tweaker * ( 1 - healthScore ) / distanceScore ; desirability = MathUtils . clamp ( desirability , 0 , 1 ) ; } return desirability ; }
Calculates the desirability.
Calculates the desirability .