Class DamagingArea

All Implemented Interfaces:
MovementListener, TurnListener, Killer, Cloneable, Iterable<String>, Serializable

public class DamagingArea extends OccupantArea
An area that damages an RPEntity while over it.
  • Field Details

    • damage

      protected int damage
      The damage inflicted each hit.
    • probability

      protected double probability
      The chance of damage while walking (0.0 - 1.0).
    • rand

      protected Random rand
      Random number generator.
  • Constructor Details

    • DamagingArea

      public DamagingArea(int width, int height, int interval, int damage, double probability)
      Create a damaging area.
      Parameters:
      width - Width of this area
      height - Height of this area
      interval - How often damage is given while stationary (in turns).
      damage - The amount of damage to inflict.
      probability - The chance of damage while walking (0.0 - 1.0).
  • Method Details

    • calculateDefense

      protected float calculateDefense(RPEntity entity)
      Calculate the entity's final defense value. Taken from new (potential replacement) combat code.
      Parameters:
      entity -
      Returns:
      defense value
    • doDamage

      protected boolean doDamage(RPEntity entity)
      Inflict damage on an entity.
      Parameters:
      entity - The entity to damage.
      Returns:
      false if this entity should be removed from further processing, true otherwise.
    • handleAdded

      protected boolean handleAdded(RPEntity entity)
      An entity has entered the area. This should not apply any actions that handleMovement() does.
      Overrides:
      handleAdded in class OccupantArea
      Parameters:
      entity - The RPEntity that was added.
      Returns:
      false if this entity should not be processed, true otherwise.
    • handleInterval

      protected boolean handleInterval(RPEntity entity)
      Apply actions done at regular intervals.
      Overrides:
      handleInterval in class OccupantArea
      Parameters:
      entity - The RPEntity occupant.
      Returns:
      false if this entity should be removed from further processing, true otherwise.
    • handleMovement

      protected boolean handleMovement(RPEntity entity)
      Apply actions done while moving.
      Overrides:
      handleMovement in class OccupantArea
      Parameters:
      entity - The RPEntity that moved.
      Returns:
      false if this entity should be removed from further processing, true otherwise.
    • handleRemoved

      protected void handleRemoved(RPEntity entity)
      An entity has left the area. This should not apply any actions that handleMovement() does.
      Overrides:
      handleRemoved in class OccupantArea
      Parameters:
      entity - The RPEntity that was added.