org.lazywizard.lazylib.combat
Class WeaponUtils

java.lang.Object
  extended by org.lazywizard.lazylib.combat.WeaponUtils

public class WeaponUtils
extends java.lang.Object

Contains methods that deal with weapons and weapon arcs.

Author:
LazyWizard

Method Summary
static float calculateActualDamage(float baseDamage, com.fs.starfarer.api.combat.WeaponAPI weapon)
          Calculates the damage done by a weapon after MutableShipStats are applied.
static float calculateDamagePerBurst(com.fs.starfarer.api.combat.WeaponAPI weapon)
          Calculates the damage done per burst by a weapon after MutableShipStats are applied.
static float calculateDamagePerSecond(com.fs.starfarer.api.combat.WeaponAPI weapon)
          Calculates the damage done per second by a weapon after MutableShipStats are applied.
static float calculateDamagePerShot(com.fs.starfarer.api.combat.WeaponAPI weapon)
          Calculates the damage done per shot by a weapon after MutableShipStats are applied.
static float getTimeToAim(com.fs.starfarer.api.combat.WeaponAPI weapon, org.lwjgl.util.vector.Vector2f aimAt)
          Calculate how long it would take to turn a WeaponAPI to aim at a location.
static boolean isWithinArc(com.fs.starfarer.api.combat.CombatEntityAPI entity, com.fs.starfarer.api.combat.WeaponAPI weapon)
          Checks if a CombatEntityAPI is within the arc and range of a WeaponAPI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

calculateActualDamage

public static float calculateActualDamage(float baseDamage,
                                          com.fs.starfarer.api.combat.WeaponAPI weapon)
Calculates the damage done by a weapon after MutableShipStats are applied.

Parameters:
baseDamage - The base damage of this weapon.
weapon - The WeaponAPI to check for bonuses on.
Returns:
The actual damage done by weapon after bonuses are applied.

calculateDamagePerShot

public static float calculateDamagePerShot(com.fs.starfarer.api.combat.WeaponAPI weapon)
Calculates the damage done per shot by a weapon after MutableShipStats are applied.

Parameters:
weapon - The weapon to check.
Returns:
The actual damage done by weapon per shot, after bonuses.

calculateDamagePerSecond

public static float calculateDamagePerSecond(com.fs.starfarer.api.combat.WeaponAPI weapon)
Calculates the damage done per second by a weapon after MutableShipStats are applied.

Parameters:
weapon - The weapon to check.
Returns:
The actual damage done by weapon per second, after bonuses.

calculateDamagePerBurst

public static float calculateDamagePerBurst(com.fs.starfarer.api.combat.WeaponAPI weapon)
Calculates the damage done per burst by a weapon after MutableShipStats are applied.

Parameters:
weapon - The weapon to check.
Returns:
The actual damage done by weapon per burst, after bonuses.

isWithinArc

public static boolean isWithinArc(com.fs.starfarer.api.combat.CombatEntityAPI entity,
                                  com.fs.starfarer.api.combat.WeaponAPI weapon)
Checks if a CombatEntityAPI is within the arc and range of a WeaponAPI.

Parameters:
entity - The CombatEntityAPI to check if weapon is aimed at.
weapon - The WeaponAPI to test against.
Returns:
true if in arc and in range, false otherwise.

getTimeToAim

public static float getTimeToAim(com.fs.starfarer.api.combat.WeaponAPI weapon,
                                 org.lwjgl.util.vector.Vector2f aimAt)
Calculate how long it would take to turn a WeaponAPI to aim at a location.

Parameters:
weapon - The WeaponAPI to turn.
aimAt - The Vector2f to aim at.
Returns:
The time in seconds it would take to aim weapon.