Class fire

java.lang.Object
name.moore.kevin.ze.game.verbs.fire

public class fire extends Object
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 Classes
    Modifier and Type
    Class
    Description
    (package private) class 
    Using the inner class allows the calculation to be applied in a stream through all the individual parts.
    (package private) class 
    This comparator ensures the most fragile parts are damaged before other more robust parts.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Map<String,​Number>
    A Map intended for use in creating a CSV of internal calculations.
    private int
     
    private static org.slf4j.Logger
     
    private com.simsilica.es.EntityId
     
    private org.jscience.physics.amount.Amount<javax.measure.quantity.Energy>
     
    private com.simsilica.es.EntityId
     
    private com.simsilica.es.EntityId
     
    private static org.jscience.physics.amount.Amount<javax.measure.quantity.Energy>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    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)
  • Method Summary

    Modifier and Type
    Method
    Description
    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 the remaining energy.
    getWeapon​(com.simsilica.es.EntityId wep)
    Collect the energy from a specific weapon.
    setTarget​(com.simsilica.es.EntityId victim)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      private Map<String,​Number> 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

      public fire getWeapon()
      Choose which weapon to fire, extract the accumulated energy - set the remaining energy.

      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

      public fire getWeapon(com.simsilica.es.EntityId wep)
      Collect the energy from a specific weapon.

      The attacking vehicle may be EntityId.NULL

    • setTarget

      public fire setTarget(com.simsilica.es.EntityId victim)
    • damage

      public fire damage()
      Apply the energy from the weapon to the target causing damage.
      Returns:
    • getDiagnostic

      public Map<String,​Number> getDiagnostic()
    • getEnergy

      public org.jscience.physics.amount.Amount<javax.measure.quantity.Energy> getEnergy()