java.lang.Object
de.gurkenlabs.litiengine.abilities.effects.Effect
All Implemented Interfaces:
IUpdateable
Direct Known Subclasses:
AttributeEffect, ForceEffect, SoundEffect

public abstract class Effect extends Object implements IUpdateable
The Class Effect seeks for affected entities in the game's current environment to apply certain effects to them defined by the overwritten implementation of apply/cease.
  • Constructor Details

  • Method Details

    • onEffectApplied

      public void onEffectApplied(Effect.EffectAppliedListener listener)
    • removeEffectAppliedListener

      public void removeEffectAppliedListener(Effect.EffectAppliedListener listener)
    • onEffectCeased

      public void onEffectCeased(Effect.EffectCeasedListener listener)
    • removeEffectCeasedListener

      public void removeEffectCeasedListener(Effect.EffectCeasedListener listener)
    • apply

      public void apply(Shape impactArea)
      Applies the effect in the specified impact area on the specified environment.
      Parameters:
      impactArea - The impact area
    • cease

      public void cease(ICombatEntity entity)
    • getAbility

      public Ability getAbility()
    • getActiveAppliances

      public List<EffectApplication> getActiveAppliances()
    • getDelay

      public int getDelay()
    • getDuration

      public int getDuration()
    • getEffectTargets

      public EffectTarget[] getEffectTargets()
    • getFollowUpEffects

      public List<Effect> getFollowUpEffects()
    • getTargetPriorityComparator

      public RelativeEntityComparator getTargetPriorityComparator()
    • isActive

      public boolean isActive(ICombatEntity entity)
    • setDelay

      public void setDelay(int delay)
    • setDuration

      public void setDuration(int duration)
    • setTargetPriorityComparator

      public void setTargetPriorityComparator(RelativeEntityComparator targetPriorityComparator)
    • update

      public void update()
      1. Cease the effect after its duration. 2. apply all follow-up effects 3. remove appliance 4. unregister from loop if all appliances are done
      Specified by:
      update in interface IUpdateable
      See Also:
    • apply

      protected void apply(ICombatEntity entity)
    • cease

      protected void cease(EffectApplication appliance)
    • getEntitiesInImpactArea

      protected Collection<ICombatEntity> getEntitiesInImpactArea(Shape impactArea)
    • getTotalDuration

      protected long getTotalDuration()
    • hasEnded

      protected boolean hasEnded(EffectApplication appliance)
    • lookForAffectedEntities

      protected List<ICombatEntity> lookForAffectedEntities(Shape impactArea)
    • customTarget

      protected boolean customTarget(ICombatEntity entity)
      Overwrite this method to implement a custom target predicate that determines whether an entity can be affected by this effect. The targets of this effect need to include the CUSTOM value in order for this function to be evaluated.
      Parameters:
      entity - The entity to check against the custom target predicate.
      Returns:
      True if the entity can be affected by this effect; otherwise false.
      See Also:
    • canAffectEntity

      protected boolean canAffectEntity(ICombatEntity entity)
    • isAliveFriendlyEntity

      protected boolean isAliveFriendlyEntity(ICombatEntity entity)
    • isDeadFriendlyEntity

      protected boolean isDeadFriendlyEntity(ICombatEntity entity)