public override float Score(IAIContext context, BasePlayer option) { float single; float single1; PlayerTargetContext playerTargetContext = context as PlayerTargetContext; if (playerTargetContext == null) { playerTargetContext.DistanceSqr[playerTargetContext.CurrentOptionsIndex] = -1f; return(0f); } BestPlayerDistance.Evaluate(playerTargetContext.Self, option.ServerPosition, out single, out single1); playerTargetContext.DistanceSqr[playerTargetContext.CurrentOptionsIndex] = single; return((1f - single / single1) * this.score); }
public virtual float Score(IAIContext context, BasePlayer option) { PlayerTargetContext playerTargetContext = context as PlayerTargetContext; if (playerTargetContext != null) { float distanceSqr; float aggroRangeSqr; BestPlayerDistance.Evaluate(playerTargetContext.Self, option.ServerPosition, out distanceSqr, out aggroRangeSqr); playerTargetContext.DistanceSqr[playerTargetContext.CurrentOptionsIndex] = distanceSqr; return((float)(1.0 - (double)distanceSqr / (double)aggroRangeSqr) * this.score); } playerTargetContext.DistanceSqr[playerTargetContext.CurrentOptionsIndex] = -1f; return(0.0f); }