public class DefenseUtils extends Object
Modifier and Type | Field and Description |
---|---|
static float |
NOT_IN_GRID
A constant that represents a point not in a ship's armor grid.
|
Modifier and Type | Method and Description |
---|---|
static float |
getArmorDamage(ShipAPI ship,
Vector2f loc)
Get the total damage taken by a
ShipAPI 's armor at a location. |
static float |
getArmorLevel(ShipAPI ship,
Vector2f loc)
Get the armor level of a
ShipAPI at a location. |
static float |
getArmorValue(ShipAPI ship,
Vector2f loc)
Get the armor value of a
ShipAPI at a location. |
static DefenseType |
getDefenseAtPoint(ShipAPI ship,
Vector2f loc)
Determine what
DefenseType is present at a specific location
on a ShipAPI . |
static @Nullable Point |
getMostDamagedArmorCell(ShipAPI ship)
Returns the most damaged armor cell on a
ShipAPI , or null
if the ship hasn't taken any armor damage. |
static boolean |
hasArmorDamage(ShipAPI ship)
Checks if a ship has taken any armor damage.
|
static boolean |
hasHullDamage(ShipAPI ship)
Checks if a ship has taken any hull damage.
|
public static final float NOT_IN_GRID
public static float getArmorValue(ShipAPI ship, Vector2f loc)
ShipAPI
at a location. Equivalent
to ArmorGridAPI.getArmorValue(int, int)
, but using
world-space coordinates.ship
- The ShipAPI
whose ArmorGridAPI
we will use.loc
- The world location we will be checking the armor value at.loc
, or
NOT_IN_GRID
if the point isn't within ship
's ArmorGridAPI
.public static float getArmorDamage(ShipAPI ship, Vector2f loc)
ShipAPI
's armor at a location.ship
- The ShipAPI
whose ArmorGridAPI
we will use.loc
- The world location we will be checking the armor damage at.loc
, or
NOT_IN_GRID
if the point isn't within
ship
's ArmorGridAPI
.public static float getArmorLevel(ShipAPI ship, Vector2f loc)
ShipAPI
at a location. Equivalent
to ArmorGridAPI.getArmorFraction(int, int)
, but using
world-space coordinates.ship
- The ShipAPI
whose ArmorGridAPI
we will use.loc
- The world location we will be checking the armor level at.loc
, or
NOT_IN_GRID
if the point isn't within ship
's ArmorGridAPI
.public static DefenseType getDefenseAtPoint(ShipAPI ship, Vector2f loc)
DefenseType
is present at a specific location
on a ShipAPI
. This method will consider points not inside of the
ship's bounds as a miss even if said point is still within the armor
grid.ship
- The ShipAPI
to examine.loc
- The location to check at.DefenseType
present at loc
.public static boolean hasArmorDamage(ShipAPI ship)
ship
- The ShipAPI
to check for armor damage on.true
if ship
has armor damage, false
otherwise.public static boolean hasHullDamage(ShipAPI ship)
ship
- The ShipAPI
to check for hull damage on.true
if ship
has hull damage, false
otherwise.@Nullable public static @Nullable Point getMostDamagedArmorCell(ShipAPI ship)
ShipAPI
, or null
if the ship hasn't taken any armor damage.ship
- The ShipAPI
to check for armor damage on.Point
containing the armor grid coordinates of the most
damaged armor cell, or null
if no armor damage was found.
If multiple cells are at 0 armor, the first found will be
returned.