LazyLib

org.lazywizard.lazylib.combat
Class AIUtils

Object
  extended by AIUtils

public class AIUtils
extends Object

Contains methods that deal with a single combat entity.

Since:
1.0
Author:
LazyWizard

Method Summary
static boolean canUseSystemThisFrame(ShipAPI ship)
          Check if a ship's system can be toggled this frame.
static List<ShipAPI> getAlliesOnMap(CombatEntityAPI entity)
          Find all present allies of an entity.
static List<ShipAPI> getAlliesOnMap(CombatEntityAPI entity, boolean sortByDistance)
          Find all present allies of an entity.
static List<ShipAPI> getEnemiesOnMap(CombatEntityAPI entity)
          Find all present enemies of an entity.
static List<ShipAPI> getEnemiesOnMap(CombatEntityAPI entity, boolean sortByDistance)
          Find all present enemies of an entity.
static List<MissileAPI> getEnemyMissilesOnMap(CombatEntityAPI entity)
          Find all present enemy missiles of an entity.
static List<MissileAPI> getEnemyMissilesOnMap(CombatEntityAPI entity, boolean sortByDistance)
          Find all present enemies of an entity.
static List<ShipAPI> getNearbyAllies(CombatEntityAPI entity, float range)
          Finds all allies within a certain range around an entity.
static List<ShipAPI> getNearbyAllies(CombatEntityAPI entity, float range, boolean sortByDistance)
          Finds all allies within a certain range around an entity.
static List<ShipAPI> getNearbyEnemies(CombatEntityAPI entity, float range)
          Finds all enemies within a certain range around an entity.
static List<ShipAPI> getNearbyEnemies(CombatEntityAPI entity, float range, boolean sortByDistance)
          Finds all enemies within a certain range around an entity.
static List<MissileAPI> getNearbyEnemyMissiles(CombatEntityAPI entity, float range)
          Finds all enemy missiles within a certain range around an entity.
static List<MissileAPI> getNearbyEnemyMissiles(CombatEntityAPI entity, float range, boolean sortByDistance)
          Finds all enemy missiles within a certain range around an entity.
static ShipAPI getNearestAlly(CombatEntityAPI entity)
          Find the closest ally of an entity.
static ShipAPI getNearestEnemy(CombatEntityAPI entity)
          Find the closest enemy of an entity.
static MissileAPI getNearestEnemyMissile(CombatEntityAPI entity)
          Find the closest enemy missile near an entity.
static MissileAPI getNearestMissile(CombatEntityAPI entity)
          Find the closest missile near entity.
static BattleObjectiveAPI getNearestObjective(CombatEntityAPI entity)
          Find the closest BattleObjectiveAPI to an entity.
static ShipAPI getNearestShip(CombatEntityAPI entity)
          Find the closest ship near entity.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getNearestObjective

public static BattleObjectiveAPI getNearestObjective(CombatEntityAPI entity)
Find the closest BattleObjectiveAPI to an entity.

Parameters:
entity - The CombatEntityAPI to search around.
Returns:
The BattleObjectiveAPI closest to entity.
Since:
1.0

getNearestEnemy

public static ShipAPI getNearestEnemy(CombatEntityAPI entity)
Find the closest enemy of an entity.

Parameters:
entity - The CombatEntityAPI to search around.
Returns:
The enemy closest to entity.
Since:
1.0

getNearestAlly

public static ShipAPI getNearestAlly(CombatEntityAPI entity)
Find the closest ally of an entity.

Parameters:
entity - The CombatEntityAPI to search around.
Returns:
The ally closest to entity.
Since:
1.0

getNearestShip

public static ShipAPI getNearestShip(CombatEntityAPI entity)
Find the closest ship near entity.

Parameters:
entity - The CombatEntityAPI to search around.
Returns:
The ship closest to entity.
Since:
1.0

getNearestMissile

public static MissileAPI getNearestMissile(CombatEntityAPI entity)
Find the closest missile near entity.

Parameters:
entity - The CombatEntityAPI to search around.
Returns:
The MissileAPI closest to entity.
Since:
1.4

getEnemiesOnMap

public static List<ShipAPI> getEnemiesOnMap(CombatEntityAPI entity,
                                            boolean sortByDistance)
Find all present enemies of an entity.

Parameters:
entity - The CombatEntityAPI to search around.
sortByDistance - Whether to sort the results by distance from entity.
Returns:
All enemies of entity on the battle map.
Since:
1.1

getEnemiesOnMap

public static List<ShipAPI> getEnemiesOnMap(CombatEntityAPI entity)
Find all present enemies of an entity.

Parameters:
entity - The CombatEntityAPI to search around.
Returns:
All enemies of entity on the battle map.
Since:
1.0
See Also:
getEnemiesOnMap(com.fs.starfarer.api.combat.CombatEntityAPI, boolean)

getNearbyEnemies

public static List<ShipAPI> getNearbyEnemies(CombatEntityAPI entity,
                                             float range,
                                             boolean sortByDistance)
Finds all enemies within a certain range around an entity.

Parameters:
entity - The entity to search around.
range - How far around entity to search.
sortByDistance - Whether to sort the results by distance from entity.
Returns:
A List containing all enemy ships within range.
Since:
1.1

getNearbyEnemies

public static List<ShipAPI> getNearbyEnemies(CombatEntityAPI entity,
                                             float range)
Finds all enemies within a certain range around an entity.

Parameters:
entity - The entity to search around.
range - How far around entity to search.
Returns:
A List containing all enemy ships within range.
Since:
1.0
See Also:
getNearbyEnemies(com.fs.starfarer.api.combat.CombatEntityAPI, float, boolean)

getAlliesOnMap

public static List<ShipAPI> getAlliesOnMap(CombatEntityAPI entity,
                                           boolean sortByDistance)
Find all present allies of an entity.

Parameters:
entity - The CombatEntityAPI to search around.
sortByDistance - Whether to sort the results by distance from entity.
Returns:
All allies of entity on the battle map.
Since:
1.1

getAlliesOnMap

public static List<ShipAPI> getAlliesOnMap(CombatEntityAPI entity)
Find all present allies of an entity.

Parameters:
entity - The CombatEntityAPI to search around.
Returns:
All allies of entity on the battle map.
Since:
1.0
See Also:
getAlliesOnMap(com.fs.starfarer.api.combat.CombatEntityAPI, boolean)

getNearbyAllies

public static List<ShipAPI> getNearbyAllies(CombatEntityAPI entity,
                                            float range,
                                            boolean sortByDistance)
Finds all allies within a certain range around an entity.

Parameters:
entity - The entity to search around.
range - How far around entity to search.
sortByDistance - Whether to sort the results by distance from entity.
Returns:
A List containing all allied ships within range.
Since:
1.1

getNearbyAllies

public static List<ShipAPI> getNearbyAllies(CombatEntityAPI entity,
                                            float range)
Finds all allies within a certain range around an entity.

Parameters:
entity - The entity to search around.
range - How far around entity to search.
Returns:
A List containing all allied ships within range.
Since:
1.0
See Also:
getNearbyAllies(com.fs.starfarer.api.combat.CombatEntityAPI, float, boolean)

getNearestEnemyMissile

public static MissileAPI getNearestEnemyMissile(CombatEntityAPI entity)
Find the closest enemy missile near an entity.

Parameters:
entity - The CombatEntityAPI to search around.
Returns:
The enemy MissileAPI closest to entity.
Since:
1.4

getEnemyMissilesOnMap

public static List<MissileAPI> getEnemyMissilesOnMap(CombatEntityAPI entity,
                                                     boolean sortByDistance)
Find all present enemies of an entity.

Parameters:
entity - The CombatEntityAPI to search around.
sortByDistance - Whether to sort the results by distance from entity.
Returns:
All enemies of entity on the battle map.
Since:
1.4

getEnemyMissilesOnMap

public static List<MissileAPI> getEnemyMissilesOnMap(CombatEntityAPI entity)
Find all present enemy missiles of an entity.

Parameters:
entity - The CombatEntityAPI to search around.
Returns:
All enemy MissileAPIs of entity on the battle map.
Since:
1.4
See Also:
getEnemyMissilesOnMap(com.fs.starfarer.api.combat.CombatEntityAPI, boolean)

getNearbyEnemyMissiles

public static List<MissileAPI> getNearbyEnemyMissiles(CombatEntityAPI entity,
                                                      float range,
                                                      boolean sortByDistance)
Finds all enemy missiles within a certain range around an entity.

Parameters:
entity - The entity to search around.
range - How far around entity to search.
sortByDistance - Whether to sort the results by distance from entity.
Returns:
A List containing all enemy missiles within range.
Since:
1.4

getNearbyEnemyMissiles

public static List<MissileAPI> getNearbyEnemyMissiles(CombatEntityAPI entity,
                                                      float range)
Finds all enemy missiles within a certain range around an entity.

Parameters:
entity - The entity to search around.
range - How far around entity to search.
Returns:
A List containing all enemy missiles within range.
Since:
1.4
See Also:
getNearbyEnemyMissiles(com.fs.starfarer.api.combat.CombatEntityAPI, float, boolean)

canUseSystemThisFrame

public static boolean canUseSystemThisFrame(ShipAPI ship)
Check if a ship's system can be toggled this frame. This still returns true if the shipsystem is already on!

Parameters:
ship - The ship to check the system of.
Returns:
true if ship can use its system, false otherwise.
Since:
1.0

LazyLib