Class LifeDrainArea

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

public class LifeDrainArea extends OccupantArea
An area that drains an RPEntity of HP while over it.
  • Field Details

    • minimumDamage

      protected int minimumDamage
      The minimum damage inflicted.
    • damageRatio

      protected double damageRatio
      The ratio of HP to inflicted.
  • Constructor Details

    • LifeDrainArea

      public LifeDrainArea(int width, int height, int interval, double damageRatio, int minimumDamage)
      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).
      damageRatio - The ratio of damage to inflict.
      minimumDamage - The minimum damage to inflict.
  • Method Details

    • 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.
    • 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.