33 lines
966 B
C#
33 lines
966 B
C#
using Data;
|
|
|
|
namespace Parsing
|
|
{
|
|
public static class ConditionFunctions
|
|
{
|
|
public static bool EntityHealth(Entity.Entity entity, int minHealth)
|
|
{
|
|
return entity.attributes.health >= minHealth;
|
|
}
|
|
|
|
public static bool HasEnemyInSight(Entity.Entity entity)
|
|
{
|
|
return Managers.EntityManage.Instance.ExistsHostile(entity.currentDimensionId, entity.entityPrefab);
|
|
}
|
|
|
|
public static bool HasWeapon(Entity.Entity entity)
|
|
{
|
|
return entity.GetCurrentWeapon() != null;
|
|
}
|
|
|
|
public static bool HasRangedWeapon(Entity.Entity entity)
|
|
{
|
|
var weapon = entity.GetCurrentWeapon();
|
|
return weapon is { Type: WeaponType.Ranged };
|
|
}
|
|
public static bool HasMeleeWeapon(Entity.Entity entity)
|
|
{
|
|
var weapon = entity.GetCurrentWeapon();
|
|
return weapon is { Type: WeaponType.Melee };
|
|
}
|
|
}
|
|
} |