Package name.moore.kevin.ze.game.verbs
Class fire
java.lang.Object
name.moore.kevin.ze.game.verbs.fire
Fire a weapon to cause damage to a target. Typical usage:
new fire(a).getWeapon().setTarget(b).damage();
components used
- distribution = rw
- Author:
- Kevin Moore
<dev@kevin.moore.name>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classUsing the inner class allows the calculation to be applied in a stream through all the individual parts.(package private) classThis comparator ensures the most fragile parts are damaged before other more robust parts. -
Field Summary
FieldsModifier and TypeFieldDescriptionA Map intended for use in creating a CSV of internal calculations.private intprivate static org.slf4j.Loggerprivate com.simsilica.es.EntityIdprivate org.jscience.physics.amount.Amount<javax.measure.quantity.Energy>private com.simsilica.es.EntityIdprivate com.simsilica.es.EntityIdprivate static org.jscience.physics.amount.Amount<javax.measure.quantity.Energy> -
Constructor Summary
ConstructorsConstructorDescriptionfire(com.simsilica.es.EntityId vehicle)The constructor anticipates the parameter as the EntityId of something like a ship, needs an engine and (optional!) weapon(s) -
Method Summary
Modifier and TypeMethodDescriptiondamage()Apply the energy from the weapon to the target causing damage.org.jscience.physics.amount.Amount<javax.measure.quantity.Energy>Choose which weapon to fire, extract the accumulated energy - set theremainingenergy.getWeapon(com.simsilica.es.EntityId wep)Collect the energy from a specific weapon.setTarget(com.simsilica.es.EntityId victim)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
ZERO
private static final org.jscience.physics.amount.Amount<javax.measure.quantity.Energy> ZERO -
m
private com.simsilica.es.EntityId m -
remaining
private org.jscience.physics.amount.Amount<javax.measure.quantity.Energy> remaining -
v
private com.simsilica.es.EntityId v -
w
private com.simsilica.es.EntityId w -
diagnostic
A Map intended for use in creating a CSV of internal calculations. Keys are the column headings, values are results of calculations.Headings hit : sequence of hit shield : the defending shield strength - from spec - in J incoming : attacking energy in J health : shield health % 0->100
Usage of damage() updates the Map, so the caller should collect the data with getDiagnostic() and use as desired. -
hitcounter
private int hitcounter
-
-
Constructor Details
-
fire
public fire(com.simsilica.es.EntityId vehicle)The constructor anticipates the parameter as the EntityId of something like a ship, needs an engine and (optional!) weapon(s)- Parameters:
vehicle-
-
-
Method Details
-
getWeapon
Choose which weapon to fire, extract the accumulated energy - set theremainingenergy.If the weapon is able to fire, drains the weapon and collects the energy ready for damage(). If not then just returns.
// TODO this uses the first weapon, how to select which to fire if there are more than one??- Returns:
-
getWeapon
Collect the energy from a specific weapon.The attacking vehicle may be EntityId.NULL
-
setTarget
-
damage
Apply the energy from the weapon to the target causing damage.- Returns:
-
getDiagnostic
-
getEnergy
public org.jscience.physics.amount.Amount<javax.measure.quantity.Energy> getEnergy()
-