(900eddc26) Take the priority modifier in account when calculating the priority, not the max value.

This commit is contained in:
Joonas Rikkonen
2019-05-16 05:13:03 +03:00
parent 3c8707fc16
commit ab2ca90d08
15 changed files with 123 additions and 94 deletions
@@ -91,17 +91,16 @@ namespace Barotrauma
{
if (character.Submarine == null) { return 0; }
if (targets.None()) { return 0; }
//if (objectiveManager.CurrentOrder == this)
//{
// return AIObjectiveManager.OrderPriority;
//}
float targetValue = MathHelper.Clamp(TargetEvaluation(), 0, 100);
// If the target value is less than 1% of the max value, let's just treat it as zero.
if (targetValue < 1) { return 0; }
float maxMultiplier = MathHelper.Min(PriorityModifier, 1);
float max = MathHelper.Min((AIObjectiveManager.OrderPriority - 1) * maxMultiplier, 90);
if (objectiveManager.CurrentOrder == this)
{
return AIObjectiveManager.OrderPriority;
}
float max = MathHelper.Min(AIObjectiveManager.OrderPriority - 1, 90);
float devotion = MathHelper.Min(10, Priority);
float value = MathHelper.Min((devotion + targetValue) / 100, 1);
float value = MathHelper.Min((devotion + targetValue * PriorityModifier) / 100, 1);
return MathHelper.Lerp(0, max, value);
}