Class CombatEntity

All Implemented Interfaces:
EntityRenderedListener, EntityRenderListener, ICollisionEntity, ICombatEntity, IEntity, Tweenable, EventListener
Direct Known Subclasses:
Creature, Prop

public class CombatEntity extends CollisionEntity implements ICombatEntity
  • Field Details

  • Constructor Details

    • CombatEntity

      public CombatEntity()
      Instantiates a new CombatEntity.
  • Method Details

    • addCombatEntityListener

      public void addCombatEntityListener(CombatEntityListener listener)
      Description copied from interface: ICombatEntity
      Adds a CombatEntityListener to this entity.
      Specified by:
      addCombatEntityListener in interface ICombatEntity
      Parameters:
      listener - the listener to add
    • removeCombatEntityListener

      public void removeCombatEntityListener(CombatEntityListener listener)
      Description copied from interface: ICombatEntity
      Removes a CombatEntityListener from this entity.
      Specified by:
      removeCombatEntityListener in interface ICombatEntity
      Parameters:
      listener - the listener to remove
    • onHit

      public void onHit(CombatEntityHitListener listener)
      Description copied from interface: ICombatEntity
      Registers a listener to be called when this entity is hit.
      Specified by:
      onHit in interface ICombatEntity
      Parameters:
      listener - the listener to register
    • onDeath

      public void onDeath(CombatEntityDeathListener listener)
      Description copied from interface: ICombatEntity
      Registers a listener to be called when this entity dies.
      Specified by:
      onDeath in interface ICombatEntity
      Parameters:
      listener - the listener to register
    • onResurrect

      public void onResurrect(CombatEntityResurrectListener listener)
      Description copied from interface: ICombatEntity
      Registers a listener to be called when this entity is resurrected.
      Specified by:
      onResurrect in interface ICombatEntity
      Parameters:
      listener - the listener to register
    • removeListener

      public void removeListener(CombatEntityHitListener listener)
      Description copied from interface: ICombatEntity
      Removes a hit listener from this entity.
      Specified by:
      removeListener in interface ICombatEntity
      Parameters:
      listener - the listener to remove
    • removeListener

      public void removeListener(CombatEntityDeathListener listener)
      Description copied from interface: ICombatEntity
      Removes a death listener from this entity.
      Specified by:
      removeListener in interface ICombatEntity
      Parameters:
      listener - the listener to remove
    • removeListener

      public void removeListener(CombatEntityResurrectListener listener)
      Description copied from interface: ICombatEntity
      Removes a resurrect listener from this entity.
      Specified by:
      removeListener in interface ICombatEntity
      Parameters:
      listener - the listener to remove
    • die

      public void die()
      Description copied from interface: ICombatEntity
      Causes this entity to die.
      Specified by:
      die in interface ICombatEntity
    • getAppliedEffects

      public List<Effect> getAppliedEffects()
      Description copied from interface: ICombatEntity
      Gets the list of effects currently applied to this entity.
      Specified by:
      getAppliedEffects in interface ICombatEntity
      Returns:
      a list of applied effects
    • getHitPoints

      public RangeAttribute<Integer> getHitPoints()
      Gets the attributes.
      Specified by:
      getHitPoints in interface ICombatEntity
      Returns:
      the attributes
    • getHitBox

      public Shape getHitBox()
      Gets the hit box.
      Specified by:
      getHitBox in interface ICombatEntity
      Returns:
      the hit box
    • getTarget

      public ICombatEntity getTarget()
      Description copied from interface: ICombatEntity
      Gets the current target of this entity.
      Specified by:
      getTarget in interface ICombatEntity
      Returns:
      the target entity
    • getTeam

      public int getTeam()
      Description copied from interface: ICombatEntity
      Gets the team of this entity.
      Specified by:
      getTeam in interface ICombatEntity
      Returns:
      the team as an integer
    • getTweenValues

      public float[] getTweenValues(TweenType tweenType)
      Description copied from interface: Tweenable
      Gets one or many values from the target object associated to the given tween type. It is used by the Tween Engine to determine starting values.
      Specified by:
      getTweenValues in interface Tweenable
      Overrides:
      getTweenValues in class CollisionEntity
      Parameters:
      tweenType - The tween type of this interpolation, determining which values are modified.
      Returns:
      The array of current tween values.
    • setTweenValues

      public void setTweenValues(TweenType tweenType, float[] newValues)
      Description copied from interface: Tweenable
      This method is called in a Tween's update() method to set the new interpolated values.
      Specified by:
      setTweenValues in interface Tweenable
      Overrides:
      setTweenValues in class CollisionEntity
      Parameters:
      tweenType - The tween type of this interpolation, determining which values are modified.
      newValues - The new values determined by the tween equation.
    • hit

      public void hit(int damage)
      Description copied from interface: ICombatEntity
      Inflicts damage to this entity.
      Specified by:
      hit in interface ICombatEntity
      Parameters:
      damage - the amount of damage to inflict
    • hit

      public void hit(int damage, Ability ability)
      Description copied from interface: ICombatEntity
      Inflicts damage to this entity with a specific ability.
      Specified by:
      hit in interface ICombatEntity
      Parameters:
      damage - the amount of damage to inflict
      ability - the ability causing the damage
    • fireDeathEvent

      protected void fireDeathEvent()
    • isDead

      public boolean isDead()
      Checks if is dead.
      Specified by:
      isDead in interface ICombatEntity
      Returns:
      true, if is dead
    • isFriendly

      public boolean isFriendly(ICombatEntity entity)
      Checks if is friendly.
      Specified by:
      isFriendly in interface ICombatEntity
      Parameters:
      entity - the entity
      Returns:
      true, if is friendly
    • isIndestructible

      public boolean isIndestructible()
      Checks if is indestructible.
      Specified by:
      isIndestructible in interface ICombatEntity
      Returns:
      true, if is indestructible
    • isNeutral

      public boolean isNeutral()
      Description copied from interface: ICombatEntity
      Checks if this entity is neutral.
      Specified by:
      isNeutral in interface ICombatEntity
      Returns:
      true if the entity is neutral, false otherwise
    • resurrect

      public void resurrect()
      Resurrect.
      Specified by:
      resurrect in interface ICombatEntity
    • setIndestructible

      public void setIndestructible(boolean indestructible)
      Description copied from interface: ICombatEntity
      Sets the indestructible state of this entity.
      Specified by:
      setIndestructible in interface ICombatEntity
      Parameters:
      indestructible - the indestructible state to set
    • setTarget

      public void setTarget(ICombatEntity target)
      Description copied from interface: ICombatEntity
      Sets the target of this entity.
      Specified by:
      setTarget in interface ICombatEntity
      Parameters:
      target - the target entity to set
    • setTeam

      public void setTeam(int team)
      Sets the team.
      Specified by:
      setTeam in interface ICombatEntity
      Parameters:
      team - the new team
    • wasHit

      public boolean wasHit(int timeSpan)
      Description copied from interface: ICombatEntity
      Checks if this entity was hit within a specific time span.
      Specified by:
      wasHit in interface ICombatEntity
      Parameters:
      timeSpan - the time span to check
      Returns:
      true if the entity was hit within the time span, false otherwise