Refactored Health usage to IHealth.

This commit is contained in:
Andre Mohren
2018-09-27 02:02:08 +02:00
committed by reaperrr
parent 83cd7cf485
commit 640078a2b1
30 changed files with 68 additions and 61 deletions

View File

@@ -160,7 +160,7 @@ namespace OpenRA.Mods.Common.AI
return (valueInfo != null) ? valueInfo.Cost * Attractiveness : 0;
case DecisionMetric.Health:
var health = a.TraitOrDefault<Health>();
var health = a.TraitOrDefault<IHealth>();
if (health == null)
return 0;
@@ -193,8 +193,8 @@ namespace OpenRA.Mods.Common.AI
return (valueInfo != null) ? valueInfo.Cost * Attractiveness : 0;
case DecisionMetric.Health:
var healthInfo = fa.Info.TraitInfoOrDefault<HealthInfo>();
return (healthInfo != null) ? fa.HP * Attractiveness / healthInfo.HP : 0;
var healthInfo = fa.Info.TraitInfoOrDefault<IHealthInfo>();
return (healthInfo != null) ? fa.HP * Attractiveness / healthInfo.MaxHP : 0;
default:
return Attractiveness;