Package org.lazywizard.lazylib.combat
Class DefenseUtils
Object
DefenseUtils
Contains methods to make working with a ship's armor grid and defenses
easier.
- Since:
- 1.5
- Author:
- LazyWizard
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatA constant that represents a point not in a ship's armor grid. -
Method Summary
Modifier and TypeMethodDescriptionstatic floatgetArmorDamage(ShipAPI ship, Vector2f loc) Get the total damage taken by aShipAPI's armor at a location.static floatgetArmorLevel(ShipAPI ship, Vector2f loc) Get the armor level of aShipAPIat a location.static floatgetArmorValue(ShipAPI ship, Vector2f loc) Get the armor value of aShipAPIat a location.static DefenseTypegetDefenseAtPoint(ShipAPI ship, Vector2f loc) Determine whatDefenseTypeis present at a specific location on aShipAPI.static PointReturns the most damaged armor cell on aShipAPI, ornullif the ship hasn't taken any armor damage.static booleanhasArmorDamage(ShipAPI ship) Checks if a ship has taken any armor damage.static booleanhasHullDamage(ShipAPI ship) Checks if a ship has taken any hull damage.
-
Field Details
-
NOT_IN_GRID
public static final float NOT_IN_GRIDA constant that represents a point not in a ship's armor grid.- See Also:
-
-
Method Details
-
getArmorValue
Get the armor value of aShipAPIat a location. Equivalent toArmorGridAPI.getArmorValue(int, int), but using world-space coordinates.- Parameters:
ship- TheShipAPIwhoseArmorGridAPIwe will use.loc- The world location we will be checking the armor value at.- Returns:
- The armor value at
loc, orNOT_IN_GRIDif the point isn't withinship'sArmorGridAPI. - Since:
- 1.5
-
getArmorDamage
Get the total damage taken by aShipAPI's armor at a location.- Parameters:
ship- TheShipAPIwhoseArmorGridAPIwe will use.loc- The world location we will be checking the armor damage at.- Returns:
- The armor damage taken at
loc, orNOT_IN_GRIDif the point isn't withinship'sArmorGridAPI. - Since:
- 1.5
-
getArmorLevel
Get the armor level of aShipAPIat a location. Equivalent toArmorGridAPI.getArmorFraction(int, int), but using world-space coordinates.- Parameters:
ship- TheShipAPIwhoseArmorGridAPIwe will use.loc- The world location we will be checking the armor level at.- Returns:
- The armor level at
loc, orNOT_IN_GRIDif the point isn't withinship'sArmorGridAPI. - Since:
- 1.5
-
getDefenseAtPoint
Determine whatDefenseTypeis present at a specific location on aShipAPI. 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.- Parameters:
ship- TheShipAPIto examine.loc- The location to check at.- Returns:
- The
DefenseTypepresent atloc. - Since:
- 1.5
-
hasArmorDamage
Checks if a ship has taken any armor damage.- Parameters:
ship- TheShipAPIto check for armor damage on.- Returns:
trueifshiphas armor damage,falseotherwise.- Since:
- 2.0
-
hasHullDamage
Checks if a ship has taken any hull damage.- Parameters:
ship- TheShipAPIto check for hull damage on.- Returns:
trueifshiphas hull damage,falseotherwise.- Since:
- 2.0
-
getMostDamagedArmorCell
Returns the most damaged armor cell on aShipAPI, ornullif the ship hasn't taken any armor damage.
-