LazyLib

org.lazywizard.lazylib.combat
Class CombatUtils

Object
  extended by CombatUtils
All Implemented Interfaces:
CombatEnginePlugin, EveryFrameCombatPlugin

public class CombatUtils
extends Object
implements EveryFrameCombatPlugin

Contains methods that deal with the battle map in general.

Since:
1.0
Author:
LazyWizard

Constructor Summary
protected CombatUtils()
           
 
Method Summary
 void advance(float amount, List events)
          Automatically called by the game.
static void applyForce(CombatEntityAPI entity, float direction, float force)
          Apply force to an object.
static void applyForce(CombatEntityAPI entity, Vector2f direction, float force)
          Apply force to an object.
static List<CombatEntityAPI> getAsteroidsWithinRange(Vector2f location, float range)
          Returns all asteroids in range of a given location.
static List<CombatEntityAPI> getAsteroidsWithinRange(Vector2f location, float range, boolean sortByDistance)
          Returns all asteroids in range of a given location.
static CombatEngineAPI getCombatEngine()
          Deprecated. Use Global.getCombatEngine() instead.
static float getElapsedCombatTime()
          Deprecated. Use CombatEngineAPI.getTotalElapsedTime(boolean) instead.
static float getElapsedCombatTimeIncludingPaused()
          Deprecated. Use CombatEngineAPI.getTotalElapsedTime(boolean) instead.
static List<CombatEntityAPI> getEntitiesWithinRange(Vector2f location, float range)
          Returns all entities in range of a given location.
static List<CombatEntityAPI> getEntitiesWithinRange(Vector2f location, float range, boolean sortByDistance)
          Returns all entities in range of a given location.
static FleetMemberAPI getFleetMember(ShipAPI ship)
          Find a ShipAPI's corresponding FleetMemberAPI in the campaign.
static List<MissileAPI> getMissilesWithinRange(Vector2f location, float range)
          Returns all missiles in range of a given location.
static List<MissileAPI> getMissilesWithinRange(Vector2f location, float range, boolean sortByDistance)
          Returns all missiles in range of a given location.
static List<BattleObjectiveAPI> getObjectivesWithinRange(Vector2f location, float range)
          Returns all objectives in range of a given location.
static List<BattleObjectiveAPI> getObjectivesWithinRange(Vector2f location, float range, boolean sortByDistance)
          Returns all objectives in range of a given location.
static List<DamagingProjectileAPI> getProjectilesWithinRange(Vector2f location, float range)
          Returns all projectiles in range of a given location.
static List<DamagingProjectileAPI> getProjectilesWithinRange(Vector2f location, float range, boolean sortByDistance)
          Returns all projectiles in range of a given location.
static List<ShipAPI> getShipsWithinRange(Vector2f location, float range)
          Returns all ships in range of a given location.
static List<ShipAPI> getShipsWithinRange(Vector2f location, float range, boolean sortByDistance)
          Returns all ships in range of a given location.
static float getTimeSinceLastFrame()
          Deprecated. Use CombatEngineAPI.getElapsedInLastFrame() instead.
 void init(CombatEngineAPI engine)
          Automatically called by the game.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CombatUtils

protected CombatUtils()
Method Detail

getFleetMember

public static FleetMemberAPI getFleetMember(ShipAPI ship)
Find a ShipAPI's corresponding FleetMemberAPI in the campaign.

Parameters:
ship - The ShipAPI whose corresponding FleetMemberAPI we are trying to find.
Returns:
The FleetMemberAPI that represents this ShipAPI in the campaign, or null if no match is found.
Since:
1.5

getProjectilesWithinRange

public static List<DamagingProjectileAPI> getProjectilesWithinRange(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.
Since:
1.1

getProjectilesWithinRange

public static List<DamagingProjectileAPI> getProjectilesWithinRange(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.
Since:
1.0
See Also:
getProjectilesWithinRange(org.lwjgl.util.vector.Vector2f, float, boolean)

getMissilesWithinRange

public static List<MissileAPI> getMissilesWithinRange(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.
Since:
1.1

getMissilesWithinRange

public static List<MissileAPI> getMissilesWithinRange(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.
Since:
1.0
See Also:
getMissilesWithinRange(org.lwjgl.util.vector.Vector2f, float, boolean)

getShipsWithinRange

public static List<ShipAPI> getShipsWithinRange(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.
Since:
1.1

getShipsWithinRange

public static List<ShipAPI> getShipsWithinRange(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.
Since:
1.0
See Also:
getShipsWithinRange(org.lwjgl.util.vector.Vector2f, float, boolean)

getAsteroidsWithinRange

public static List<CombatEntityAPI> getAsteroidsWithinRange(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.
Since:
1.1

getAsteroidsWithinRange

public static List<CombatEntityAPI> getAsteroidsWithinRange(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.
Since:
1.0
See Also:
getAsteroidsWithinRange(org.lwjgl.util.vector.Vector2f, float, boolean)

getObjectivesWithinRange

public static List<BattleObjectiveAPI> getObjectivesWithinRange(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.
Since:
1.1

getObjectivesWithinRange

public static List<BattleObjectiveAPI> getObjectivesWithinRange(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.
Since:
1.0
See Also:
getObjectivesWithinRange(org.lwjgl.util.vector.Vector2f, float, boolean)

getEntitiesWithinRange

public static List<CombatEntityAPI> getEntitiesWithinRange(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.
Since:
1.1

getEntitiesWithinRange

public static List<CombatEntityAPI> getEntitiesWithinRange(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.
Since:
1.0
See Also:
getEntitiesWithinRange(org.lwjgl.util.vector.Vector2f, float, boolean)

applyForce

public static void applyForce(CombatEntityAPI entity,
                              Vector2f direction,
                              float force)
Apply force to an object. Remember Newton's Second Law. Force is multiplied by 100 to avoid requiring ridiculous force amounts.

Parameters:
entity - The CombatEntityAPI to apply the force to.
direction - The directional vector of the force (this will automatically be normalized).
force - How much force to apply.
Since:
1.2

applyForce

public static void applyForce(CombatEntityAPI entity,
                              float direction,
                              float force)
Apply force to an object. Remember Newton's Second Law.

Parameters:
entity - The CombatEntityAPI to apply the force to.
direction - The angle the force will be applied towards.
force - How much force to apply.
Since:
1.2

getCombatEngine

@Deprecated
public static CombatEngineAPI getCombatEngine()
Deprecated. Use Global.getCombatEngine() instead.

Since:
1.0

getElapsedCombatTimeIncludingPaused

@Deprecated
public static float getElapsedCombatTimeIncludingPaused()
Deprecated. Use CombatEngineAPI.getTotalElapsedTime(boolean) instead.

Since:
1.2

getElapsedCombatTime

@Deprecated
public static float getElapsedCombatTime()
Deprecated. Use CombatEngineAPI.getTotalElapsedTime(boolean) instead.

Since:
1.0

getTimeSinceLastFrame

@Deprecated
public static float getTimeSinceLastFrame()
Deprecated. Use CombatEngineAPI.getElapsedInLastFrame() instead.

Since:
1.4

advance

public void advance(float amount,
                    List events)
Automatically called by the game. Don't call this manually.

Specified by:
advance in interface EveryFrameCombatPlugin

init

public void init(CombatEngineAPI engine)
Automatically called by the game. Don't call this manually.

Specified by:
init in interface CombatEnginePlugin

LazyLib