LazyLib

org.lazywizard.lazylib.combat
Class CombatUtils

java.lang.Object
  extended by org.lazywizard.lazylib.combat.CombatUtils
All Implemented Interfaces:
com.fs.starfarer.api.combat.CombatEnginePlugin, com.fs.starfarer.api.combat.EveryFrameCombatPlugin

public class CombatUtils
extends java.lang.Object
implements com.fs.starfarer.api.combat.EveryFrameCombatPlugin

Contains methods that deal with the battle map in general.

Author:
LazyWizard

Constructor Summary
protected CombatUtils()
           
 
Method Summary
 void advance(float amount, java.util.List<com.fs.starfarer.api.input.InputEventAPI> events)
          Automatically called by the game.
static java.util.List<com.fs.starfarer.api.combat.CombatEntityAPI> getAsteroidsWithinRange(org.lwjgl.util.vector.Vector2f location, float range)
          Returns all asteroids in range of a given location.
static java.util.List<com.fs.starfarer.api.combat.CombatEntityAPI> getAsteroidsWithinRange(org.lwjgl.util.vector.Vector2f location, float range, boolean sortByDistance)
          Returns all asteroids in range of a given location.
static com.fs.starfarer.api.combat.CombatEngineAPI getCombatEngine()
          Returns the currently used CombatEngineAPI.
static float getElapsedCombatTime()
          Returns the length of the current battle.
static java.util.List<com.fs.starfarer.api.combat.CombatEntityAPI> getEntitiesWithinRange(org.lwjgl.util.vector.Vector2f location, float range)
          Returns all entities in range of a given location.
static java.util.List<com.fs.starfarer.api.combat.CombatEntityAPI> getEntitiesWithinRange(org.lwjgl.util.vector.Vector2f location, float range, boolean sortByDistance)
          Returns all entities in range of a given location.
static java.util.List<com.fs.starfarer.api.combat.MissileAPI> getMissilesWithinRange(org.lwjgl.util.vector.Vector2f location, float range)
          Returns all missiles in range of a given location.
static java.util.List<com.fs.starfarer.api.combat.MissileAPI> getMissilesWithinRange(org.lwjgl.util.vector.Vector2f location, float range, boolean sortByDistance)
          Returns all missiles in range of a given location.
static java.util.List<com.fs.starfarer.api.combat.BattleObjectiveAPI> getObjectivesWithinRange(org.lwjgl.util.vector.Vector2f location, float range)
          Returns all objectives in range of a given location.
static java.util.List<com.fs.starfarer.api.combat.BattleObjectiveAPI> getObjectivesWithinRange(org.lwjgl.util.vector.Vector2f location, float range, boolean sortByDistance)
          Returns all objectives in range of a given location.
static java.util.List<com.fs.starfarer.api.combat.DamagingProjectileAPI> getProjectilesWithinRange(org.lwjgl.util.vector.Vector2f location, float range)
          Returns all projectiles in range of a given location.
static java.util.List<com.fs.starfarer.api.combat.DamagingProjectileAPI> getProjectilesWithinRange(org.lwjgl.util.vector.Vector2f location, float range, boolean sortByDistance)
          Returns all projectiles in range of a given location.
static java.util.List<com.fs.starfarer.api.combat.ShipAPI> getShipsWithinRange(org.lwjgl.util.vector.Vector2f location, float range)
          Returns all ships in range of a given location.
static java.util.List<com.fs.starfarer.api.combat.ShipAPI> getShipsWithinRange(org.lwjgl.util.vector.Vector2f location, float range, boolean sortByDistance)
          Returns all ships in range of a given location.
 void init(com.fs.starfarer.api.combat.CombatEngineAPI engine)
          Automatically called by the game.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CombatUtils

protected CombatUtils()
Method Detail

getCombatEngine

public static com.fs.starfarer.api.combat.CombatEngineAPI getCombatEngine()
Returns the currently used CombatEngineAPI.

Returns:
The CombatEngineAPI used by the current battle.

getElapsedCombatTime

public static float getElapsedCombatTime()
Returns the length of the current battle.

Returns:
The total elapsed time for this combat encounter, in seconds.

getProjectilesWithinRange

public static java.util.List<com.fs.starfarer.api.combat.DamagingProjectileAPI> getProjectilesWithinRange(org.lwjgl.util.vector.Vector2f location,
                                                                                                          float range,
                                                                                                          boolean sortByDistance)
Returns all projectiles in range of a given location.

Parameters:
location - The location to search around.
range - How far around location to search.
sortByDistance - Whether to sort the results by distance from location.
Returns:
A List of DamagingProjectileAPIs within range of location.

getProjectilesWithinRange

public static java.util.List<com.fs.starfarer.api.combat.DamagingProjectileAPI> getProjectilesWithinRange(org.lwjgl.util.vector.Vector2f location,
                                                                                                          float range)
Returns all projectiles in range of a given location.

Parameters:
location - The location to search around.
range - How far around location to search.
Returns:
A List of DamagingProjectileAPIs within range of location.
See Also:
getProjectilesWithinRange(org.lwjgl.util.vector.Vector2f, float, boolean)

getMissilesWithinRange

public static java.util.List<com.fs.starfarer.api.combat.MissileAPI> getMissilesWithinRange(org.lwjgl.util.vector.Vector2f location,
                                                                                            float range,
                                                                                            boolean sortByDistance)
Returns all missiles in range of a given location.

Parameters:
location - The location to search around.
range - How far around location to search.
sortByDistance - Whether to sort the results by distance from location.
Returns:
A List of MissileAPIs within range of location.

getMissilesWithinRange

public static java.util.List<com.fs.starfarer.api.combat.MissileAPI> getMissilesWithinRange(org.lwjgl.util.vector.Vector2f location,
                                                                                            float range)
Returns all missiles in range of a given location.

Parameters:
location - The location to search around.
range - How far around location to search.
Returns:
A List of MissileAPIs within range of location.
See Also:
getMissilesWithinRange(org.lwjgl.util.vector.Vector2f, float, boolean)

getShipsWithinRange

public static java.util.List<com.fs.starfarer.api.combat.ShipAPI> getShipsWithinRange(org.lwjgl.util.vector.Vector2f location,
                                                                                      float range,
                                                                                      boolean sortByDistance)
Returns all ships in range of a given location.

Parameters:
location - The location to search around.
range - How far around location to search.
sortByDistance - Whether to sort the results by distance from location.
Returns:
A List of ShipAPIs within range of location.

getShipsWithinRange

public static java.util.List<com.fs.starfarer.api.combat.ShipAPI> getShipsWithinRange(org.lwjgl.util.vector.Vector2f location,
                                                                                      float range)
Returns all ships in range of a given location.

Parameters:
location - The location to search around.
range - How far around location to search.
Returns:
A List of ShipAPIs within range of location.
See Also:
getShipsWithinRange(org.lwjgl.util.vector.Vector2f, float, boolean)

getAsteroidsWithinRange

public static java.util.List<com.fs.starfarer.api.combat.CombatEntityAPI> getAsteroidsWithinRange(org.lwjgl.util.vector.Vector2f location,
                                                                                                  float range,
                                                                                                  boolean sortByDistance)
Returns all asteroids in range of a given location.

Parameters:
location - The location to search around.
range - How far around location to search.
sortByDistance - Whether to sort the results by distance from location.
Returns:
A List of asteroids within range of location.

getAsteroidsWithinRange

public static java.util.List<com.fs.starfarer.api.combat.CombatEntityAPI> getAsteroidsWithinRange(org.lwjgl.util.vector.Vector2f location,
                                                                                                  float range)
Returns all asteroids in range of a given location.

Parameters:
location - The location to search around.
range - How far around location to search.
Returns:
A List of asteroids within range of location.
See Also:
getAsteroidsWithinRange(org.lwjgl.util.vector.Vector2f, float, boolean)

getObjectivesWithinRange

public static java.util.List<com.fs.starfarer.api.combat.BattleObjectiveAPI> getObjectivesWithinRange(org.lwjgl.util.vector.Vector2f location,
                                                                                                      float range,
                                                                                                      boolean sortByDistance)
Returns all objectives in range of a given location.

Parameters:
location - The location to search around.
range - How far around location to search.
sortByDistance - Whether to sort the results by distance from location.
Returns:
A List of BattleObjectiveAPIs within range of location.

getObjectivesWithinRange

public static java.util.List<com.fs.starfarer.api.combat.BattleObjectiveAPI> getObjectivesWithinRange(org.lwjgl.util.vector.Vector2f location,
                                                                                                      float range)
Returns all objectives in range of a given location.

Parameters:
location - The location to search around.
range - How far around location to search.
Returns:
A List of BattleObjectiveAPIs within range of location.
See Also:
getObjectivesWithinRange(org.lwjgl.util.vector.Vector2f, float, boolean)

getEntitiesWithinRange

public static java.util.List<com.fs.starfarer.api.combat.CombatEntityAPI> getEntitiesWithinRange(org.lwjgl.util.vector.Vector2f location,
                                                                                                 float range,
                                                                                                 boolean sortByDistance)
Returns all entities in range of a given location.

Parameters:
location - The location to search around.
range - How far around location to search.
sortByDistance - Whether to sort the results by distance from location.
Returns:
A List of CombatEntityAPIs within range of location.

getEntitiesWithinRange

public static java.util.List<com.fs.starfarer.api.combat.CombatEntityAPI> getEntitiesWithinRange(org.lwjgl.util.vector.Vector2f location,
                                                                                                 float range)
Returns all entities in range of a given location.

Parameters:
location - The location to search around.
range - How far around location to search.
Returns:
A List of CombatEntityAPIs within range of location.
See Also:
getEntitiesWithinRange(org.lwjgl.util.vector.Vector2f, float, boolean)

advance

public void advance(float amount,
                    java.util.List<com.fs.starfarer.api.input.InputEventAPI> events)
Automatically called by the game. Don't call this manually.

Specified by:
advance in interface com.fs.starfarer.api.combat.EveryFrameCombatPlugin

init

public void init(com.fs.starfarer.api.combat.CombatEngineAPI engine)
Automatically called by the game. Don't call this manually.

Specified by:
init in interface com.fs.starfarer.api.combat.CombatEnginePlugin

LazyLib