LazyLib

org.lazywizard.lazylib.combat
Class AIUtils

java.lang.Object
  extended by org.lazywizard.lazylib.combat.AIUtils

public class AIUtils
extends java.lang.Object

Contains methods that deal with a single combat entity.

Since:
1.0
Author:
LazyWizard

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

Method Detail

getNearestObjective

public static com.fs.starfarer.api.combat.BattleObjectiveAPI getNearestObjective(com.fs.starfarer.api.combat.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 com.fs.starfarer.api.combat.ShipAPI getNearestEnemy(com.fs.starfarer.api.combat.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 com.fs.starfarer.api.combat.ShipAPI getNearestAlly(com.fs.starfarer.api.combat.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 com.fs.starfarer.api.combat.ShipAPI getNearestShip(com.fs.starfarer.api.combat.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 com.fs.starfarer.api.combat.MissileAPI getNearestMissile(com.fs.starfarer.api.combat.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 java.util.List<com.fs.starfarer.api.combat.ShipAPI> getEnemiesOnMap(com.fs.starfarer.api.combat.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 java.util.List<com.fs.starfarer.api.combat.ShipAPI> getEnemiesOnMap(com.fs.starfarer.api.combat.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 java.util.List<com.fs.starfarer.api.combat.ShipAPI> getNearbyEnemies(com.fs.starfarer.api.combat.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 java.util.List<com.fs.starfarer.api.combat.ShipAPI> getNearbyEnemies(com.fs.starfarer.api.combat.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 java.util.List<com.fs.starfarer.api.combat.ShipAPI> getAlliesOnMap(com.fs.starfarer.api.combat.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 java.util.List<com.fs.starfarer.api.combat.ShipAPI> getAlliesOnMap(com.fs.starfarer.api.combat.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 java.util.List<com.fs.starfarer.api.combat.ShipAPI> getNearbyAllies(com.fs.starfarer.api.combat.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 java.util.List<com.fs.starfarer.api.combat.ShipAPI> getNearbyAllies(com.fs.starfarer.api.combat.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 com.fs.starfarer.api.combat.MissileAPI getNearestEnemyMissile(com.fs.starfarer.api.combat.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 java.util.List<com.fs.starfarer.api.combat.MissileAPI> getEnemyMissilesOnMap(com.fs.starfarer.api.combat.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 java.util.List<com.fs.starfarer.api.combat.MissileAPI> getEnemyMissilesOnMap(com.fs.starfarer.api.combat.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 java.util.List<com.fs.starfarer.api.combat.MissileAPI> getNearbyEnemyMissiles(com.fs.starfarer.api.combat.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 java.util.List<com.fs.starfarer.api.combat.MissileAPI> getNearbyEnemyMissiles(com.fs.starfarer.api.combat.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(com.fs.starfarer.api.combat.ShipAPI ship)
Check if a ship's system can be used 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