Package org.lazywizard.lazylib.combat
Class AIUtils
Object
AIUtils
Contains methods that deal with a single combat entity and how it views the
battle map. These methods respect the fog of war, unlike those in
CombatUtils.- Since:
- 1.0
- Author:
- LazyWizard
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanUseSystemThisFrame(ShipAPI ship) Check if a ship's system can be used/toggled this frame.getAlliesOnMap(CombatEntityAPI entity) Find all present allies of an entity.static Vector2fgetBestInterceptPoint(Vector2f point, float speed, Vector2f targetLoc, Vector2f targetVel) Returns the best place to aim to hit a target, given its current location and velocity.getEnemiesOnMap(CombatEntityAPI entity) Find all present and visible enemies of an entity.static List<MissileAPI>getEnemyMissilesOnMap(CombatEntityAPI entity) Find all present visible enemy missiles of an entity.getNearbyAllies(CombatEntityAPI entity, float range) Finds all allies within a certain range around an entity.getNearbyEnemies(CombatEntityAPI entity, float range) Finds all visible enemies within a certain range around an entity.static List<MissileAPI>getNearbyEnemyMissiles(CombatEntityAPI entity, float range) Finds all visible enemy missiles within a certain range around an entity.static ShipAPIgetNearestAlly(CombatEntityAPI entity) Find the closest ally of an entity.static ShipAPIgetNearestEnemy(CombatEntityAPI entity) Find the closest visible enemy of an entity.static MissileAPIFind the closest visible enemy missile near an entity.static MissileAPIgetNearestMissile(CombatEntityAPI entity) Find the closest visible missile near entity.static BattleObjectiveAPIgetNearestObjective(CombatEntityAPI entity) Find the closestBattleObjectiveAPIto an entity.static ShipAPIgetNearestShip(CombatEntityAPI entity) Find the closest visible ship near an entity.
-
Method Details
-
getNearestObjective
Find the closestBattleObjectiveAPIto an entity.- Parameters:
entity- TheCombatEntityAPIto search around.- Returns:
- The
BattleObjectiveAPIclosest toentity, ornullif none are found. - Since:
- 1.0
-
getNearestEnemy
Find the closest visible enemy of an entity.- Parameters:
entity- TheCombatEntityAPIto search around.- Returns:
- The enemy closest to
entitywho can be seen within the fog of war, ornullif none are found. - Since:
- 1.0
-
getNearestAlly
Find the closest ally of an entity.- Parameters:
entity- TheCombatEntityAPIto search around.- Returns:
- The ally closest to
entity, ornullif none are found. - Since:
- 1.0
-
getNearestShip
Find the closest visible ship near an entity.- Parameters:
entity- TheCombatEntityAPIto search around.- Returns:
- The ship closest to
entitythat can be seen within the fog of war, ornullif none are found. - Since:
- 1.0
-
getNearestMissile
Find the closest visible missile near entity.- Parameters:
entity- TheCombatEntityAPIto search around.- Returns:
- The
MissileAPIclosest toentitythat can be seen within the fog of war, ornullif none are found. - Since:
- 1.4
-
getEnemiesOnMap
Find all present and visible enemies of an entity.- Parameters:
entity- TheCombatEntityAPIto search around.- Returns:
- All enemies of
entityon the battle map that can be seen within the fog of war. - Since:
- 1.0
-
getNearbyEnemies
Finds all visible enemies within a certain range around an entity.- Parameters:
entity- The entity to search around.range- How far aroundentityto search.- Returns:
- A
Listcontaining all enemy ships within range that can be seen within the fog of war. - Since:
- 1.0
-
getAlliesOnMap
Find all present allies of an entity.- Parameters:
entity- TheCombatEntityAPIto search around.- Returns:
- All allies of
entityon the battle map. - Since:
- 1.0
-
getNearbyAllies
Finds all allies within a certain range around an entity.- Parameters:
entity- The entity to search around.range- How far aroundentityto search.- Returns:
- A
Listcontaining all allied ships within range. - Since:
- 1.0
-
getNearestEnemyMissile
Find the closest visible enemy missile near an entity.- Parameters:
entity- TheCombatEntityAPIto search around.- Returns:
- The enemy
MissileAPIclosest toentitythat can be seen within the fog of war, ornullif none are found. - Since:
- 1.4
-
getEnemyMissilesOnMap
Find all present visible enemy missiles of an entity.- Parameters:
entity- TheCombatEntityAPIto search around.- Returns:
- All enemy
MissileAPIs ofentityon the battle map that can be seen within the fog of war. - Since:
- 1.4
-
getNearbyEnemyMissiles
Finds all visible enemy missiles within a certain range around an entity.- Parameters:
entity- The entity to search around.range- How far aroundentityto search.- Returns:
- A
Listcontaining all enemy missiles within range that can be seen within the fog of war. - Since:
- 1.4
-
getBestInterceptPoint
@Nullable public static Vector2f getBestInterceptPoint(Vector2f point, float speed, Vector2f targetLoc, Vector2f targetVel) Returns the best place to aim to hit a target, given its current location and velocity. This method does not take acceleration into account.- Parameters:
point- The origin point of the object that will attempt to collide with the target (usually a weapon's projectile spawn point).speed- The speed of the object that will attempt to collide with the target (usually a projectile's travel speed).targetLoc- The location of the target.targetVel- The current velocity of the target.- Returns:
- The best point to aim towards to hit
targetgiven current velocities, ornullif a collision is not possible. - Since:
- 1.9
-
canUseSystemThisFrame
Check if a ship's system can be used/toggled this frame. Equivalent to checking whether the 'use system' key would do anything this frame. This still returns true if the shipsystem is already on!- Parameters:
ship- The ship to check the system of.- Returns:
trueifshipcan use its system,falseotherwise.- Since:
- 1.0
-