2021-09-15 03:07:37 +10:00
|
|
|
using Content.Server.AI.WorldState;
|
2020-06-18 22:52:44 +10:00
|
|
|
using Content.Server.AI.WorldState.States;
|
2021-09-15 03:07:37 +10:00
|
|
|
using Content.Shared.Damage;
|
2021-12-03 11:30:03 +01:00
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
using Robust.Shared.IoC;
|
2020-06-18 22:52:44 +10:00
|
|
|
|
|
|
|
|
namespace Content.Server.AI.Utility.Considerations.Combat
|
|
|
|
|
{
|
|
|
|
|
public sealed class TargetHealthCon : Consideration
|
|
|
|
|
{
|
2020-07-08 09:37:35 +10:00
|
|
|
protected override float GetScore(Blackboard context)
|
2020-06-18 22:52:44 +10:00
|
|
|
{
|
|
|
|
|
var target = context.GetState<TargetEntityState>().GetValue();
|
|
|
|
|
|
2021-12-20 15:20:27 +01:00
|
|
|
if (target == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(target, out DamageableComponent? damageableComponent))
|
2020-06-18 22:52:44 +10:00
|
|
|
{
|
|
|
|
|
return 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-03 16:48:03 -07:00
|
|
|
return (float) damageableComponent.TotalDamage / 300.0f;
|
2020-06-18 22:52:44 +10:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|